[PATCH] Have verbose flag print the changeset hash when committing

Gilles Moris gilles.moris at free.fr
Fri Aug 22 15:38:20 CDT 2008


On Fri August 22 2008 14:30:16 Adrian Buehlmann wrote:
> Good idea. Just two things:
> 
> 1) Why not using ui.status right away instead of ui.note? I think having that
> 'committed changeset xx' output line even without specifying -v would be fine.
> 

hg commands are usually pretty quiet. I remember reading in some docs that hg
usually prints nothing if the command succeed. Seems like part of the hg style.
And Matt won't allow it anyway.

> 2) 'committed changeset xx' should follow after 'created new head'
> 

Yes, that's a good suggestion. Consolidating the suggestions of the thread:
(full patch attached)

diff -r a58a611c320f mercurial/commands.py
--- a/mercurial/commands.py     Thu Aug 21 19:05:18 2008 +0200
+++ b/mercurial/commands.py     Fri Aug 22 21:59:31 2008 +0200
@@ -590,11 +590,16 @@
     parents = cl.parentrevs(rev)
     if rev - 1 in parents:
         # one of the parents was the old tip
-        return
-    if (parents == (nullrev, nullrev) or
-        len(cl.heads(cl.node(parents[0]))) > 1 and
-        (parents[1] == nullrev or len(cl.heads(cl.node(parents[1]))) > 1)):
+        pass
+    elif (parents == (nullrev, nullrev) or
+          len(cl.heads(cl.node(parents[0]))) > 1 and
+          (parents[1] == nullrev or len(cl.heads(cl.node(parents[1]))) > 1)):
         ui.status(_('created new head\n'))
+
+    if ui.debugflag:
+        ui.write(_('committed changeset %d:%s\n') % (rev,hex(node)))
+    elif ui.verbose:
+        ui.write(_('committed changeset %d:%s\n') % (rev,short(node)))

 def copy(ui, repo, *pats, **opts):
     """mark files as copied for the next commit

Regards.
Gilles.
PS: I have also checked that the updated test-commit will catching issue1193 if
it reccurs.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: verbosecommit.dif
Type: text/x-diff
Size: 6087 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20080822/d55220d3/attachment.diff 


More information about the Mercurial-devel mailing list