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

Adrian Buehlmann adrian at cadifra.com
Fri Aug 22 12:30:16 UTC 2008


On 22.08.2008 13:44, Gilles Moris wrote:
[snip]
> # HG changeset patch
> # User Gilles Moris <gilles.moris at free.fr>
> # Date 1219404335 -7200
> # Node ID 1da4e947f9a5e3224001475ed93e955d648c4d87
> # Parent  a58a611c320fc763bb2dac5b3e468bad4c270629
> Have verbose flag print the changeset hash when committing
> 
> diff -r a58a611c320f -r 1da4e947f9a5 mercurial/commands.py
> --- a/mercurial/commands.py	Thu Aug 21 19:05:18 2008 +0200
> +++ b/mercurial/commands.py	Fri Aug 22 13:25:35 2008 +0200
> @@ -587,6 +587,7 @@
>          return
>      cl = repo.changelog
>      rev = cl.rev(node)
> +    ui.note(_('committed changeset %s\n') % short(node))
>      parents = cl.parentrevs(rev)
>      if rev - 1 in parents:
>          # one of the parents was the old tip

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.

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

Maybe something like this:

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -590,11 +590,13 @@
     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)):
-        ui.status(_('created new head\n'))
+        pass
+    else:
+        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)):
+            ui.status(_('created new head\n'))
+    ui.status(_('committed changeset %s\n') % short(node))




More information about the Mercurial-devel mailing list