Patchwork absorb: print '{rev}:' as a prefix to the hash

login
register
mail settings
Submitter Matt Harbison
Date Oct. 12, 2018, 2:58 a.m.
Message ID <c58143ee3fb6cf75ff77.1539313134@Envy>
Download mbox | patch
Permalink /patch/35645/
State Accepted
Headers show

Comments

Matt Harbison - Oct. 12, 2018, 2:58 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1539311951 14400
#      Thu Oct 11 22:39:11 2018 -0400
# Node ID c58143ee3fb6cf75ff779f705cf8e9223f9f8c0c
# Parent  fc6a549e7896dab7402e2110199309fa0b518558
absorb: print '{rev}:' as a prefix to the hash

I don't see a sane way to print the summary to identify the changed commit, but
this at least makes it a bit easier to identify a commit when a group of them
changes.
Yuya Nishihara - Oct. 12, 2018, 5:30 a.m.
On Thu, 11 Oct 2018 22:58:54 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1539311951 14400
> #      Thu Oct 11 22:39:11 2018 -0400
> # Node ID c58143ee3fb6cf75ff779f705cf8e9223f9f8c0c
> # Parent  fc6a549e7896dab7402e2110199309fa0b518558
> absorb: print '{rev}:' as a prefix to the hash

Queued, thanks.

> --- a/hgext/absorb.py
> +++ b/hgext/absorb.py
> @@ -727,9 +727,9 @@ class fixupstate(object):
>  
>      def _ctx2str(self, ctx):
>          if self.ui.debugflag:
> -            return ctx.hex()
> +            return '%d:%s' % (ctx.rev(), ctx.hex())
>          else:
> -            return node.short(ctx.node())
> +            return '%d:%s' % (ctx.rev(), node.short(ctx.node()))

scmutil.formatchangeid() does exactly the same thing.

Patch

diff --git a/hgext/absorb.py b/hgext/absorb.py
--- a/hgext/absorb.py
+++ b/hgext/absorb.py
@@ -727,9 +727,9 @@  class fixupstate(object):
 
     def _ctx2str(self, ctx):
         if self.ui.debugflag:
-            return ctx.hex()
+            return '%d:%s' % (ctx.rev(), ctx.hex())
         else:
-            return node.short(ctx.node())
+            return '%d:%s' % (ctx.rev(), node.short(ctx.node()))
 
     def _getnewfilecontents(self, ctx):
         """(ctx) -> {path: str}
diff --git a/tests/test-absorb.t b/tests/test-absorb.t
--- a/tests/test-absorb.t
+++ b/tests/test-absorb.t
@@ -394,10 +394,10 @@  Remove lines may delete changesets:
   30970db -3
   a393a58 -4
   $ hg absorb -v | grep became
-  bfafb49242db: 1 file(s) changed, became 1a2de97fc652
-  115485984805: 2 file(s) changed, became 0c930dfab74c
-  30970dbf7b40: became empty and was dropped
-  a393a58b9a85: became empty and was dropped
+  0:bfafb49242db: 1 file(s) changed, became 4:1a2de97fc652
+  1:115485984805: 2 file(s) changed, became 5:0c930dfab74c
+  2:30970dbf7b40: became empty and was dropped
+  3:a393a58b9a85: became empty and was dropped
   $ hg log -T '{rev} {desc}\n' -Gp
   @  5 b12
   |  diff --git a/b b/b
@@ -444,8 +444,8 @@  This should move us to the non-obsolete 
   f1c23dd -3
   82dbe7f -4
   $ hg absorb --verbose
-  f1c23dd5d08d: became empty and was dropped
-  82dbe7fd19f0: became empty and was dropped
+  1:f1c23dd5d08d: became empty and was dropped
+  2:82dbe7fd19f0: became empty and was dropped
   a: 1 of 1 chunk(s) applied
   $ hg id
   bfafb49242db tip