Commits

Mike Bayer committed 540b41f

better logging

Comments (0)

Files changed (2)

publishthing/core.py

 def update_git_mirror(path, origin):
     """Update a git repo that is mirroring with --mirror
     """
+    log("Updating git repo %s %s", path, origin)
     with chdir_as(path):
         check_call(["git", "remote", "update", "--prune", origin])
 
 def git_push(path, remote):
+    log("Pushing git repo %s to %s", path, remote)
     with chdir_as(path):
         check_call(["git", "push", remote])
 
 def update_hg_mirror(path):
     """Update an hg repo
     """
+    log("Updating hg repo %s", path)
     with chdir_as(path):
         check_call(["hg", "pull"])
 
 def hg_push(path, remote):
+    log("Pushing hg repo %s to %s", path, remote)
     with chdir_as(path):
         check_call(["hg", "push", remote])
 
     return os.path.exists(os.path.join(path, ".hg")) or \
             os.path.exists(os.path.join(path, "hgrc"))
 
+# TODO: use logging
 def log(msg, *args):
-    print(msg % args)
+    print("[publishthing] " + (msg % args))

publishthing/dvcs_hooks.py

             log("repo url: %s", repo)
             if repo in mapping and message['repository']['scm'] == 'git':
                 entry = mapping[repo]
-                log("Updating repo %s %s", entry['local_repo'], entry['remote'])
                 update_git_mirror(entry['local_repo'], entry['remote'])
                 if 'push_to' in entry:
                     for push_to in entry['push_to']: