[MERGE] Show commit hook names during commit.

Martin Pool mbp at sourcefrog.net
Thu Jun 28 05:03:23 BST 2007


+0

(bb gets an internal error when i vote.)

@@ -494,6 +493,9 @@
         else:
             old_revid = bzrlib.revision.NULL_REVISION
         for hook in Branch.hooks['post_commit']:
+            self.pb_stage_name = "Running post commit hooks [%s]" % \
+                Branch.hooks.get_hook_name(hook)
+            self._emit_progress()
             hook(hook_local, hook_master, old_revno, old_revid, new_revno,
                 self.rev_id)

Would it maybe be better to show these as regular messages (notes)
rather than through the progress bar, so that a view of what was done
remains visible on the user's screen?


+    def get_hook_name(self, a_callable):
+        """Get the name for a_callable for UI display.
+
+        If no name has been registered, the string 'No hook name' is returned.
+        """
+        return self._callable_names.get(a_callable, "No hook name")

Would it be better to show the callable repr or class name if no name is set?

How about making the name an attribute of the hook object, rather than
separately registered?  I suppose the problem is that the hooks are
typically just callables not objects and so it is ugly to set
attributes on them?


-- 
Martin



More information about the bazaar mailing list