Patchwork [3,of,3] graft: record the user who performed the command in the extras dictionary

login
register
mail settings
Submitter Matt Harbison
Date April 10, 2015, 3:38 a.m.
Message ID <4ead5029e58ca8f2f852.1428637084@Envy>
Download mbox | patch
Permalink /patch/8588/
State Superseded
Headers show

Comments

Matt Harbison - April 10, 2015, 3:38 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1428635183 14400
#      Thu Apr 09 23:06:23 2015 -0400
# Node ID 4ead5029e58ca8f2f85292fda0e372ca9086b113
# Parent  ca0da0fe83538ab7cb6bc4a754cebbfe0a8c8520
graft: record the user who performed the command in the extras dictionary

Similar to the username stored with an obsolete marker, this comes only from the
configured username or environment (i.e. -u is ignored).  While not unspoofable,
it should help provide additional forensic detail, without requiring the
developer to remember to specify -U.  It's also not clear that overwriting the
author attribute is appropriate in all environments.

Since there might be some automated systems that don't have a username
configured, just skip adding the field if it isn't available instead of
aborting.
Matt Mackall - April 10, 2015, 8:55 p.m.
On Thu, 2015-04-09 at 23:38 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1428635183 14400
> #      Thu Apr 09 23:06:23 2015 -0400
> # Node ID 4ead5029e58ca8f2f85292fda0e372ca9086b113
> # Parent  ca0da0fe83538ab7cb6bc4a754cebbfe0a8c8520
> graft: record the user who performed the command in the extras dictionary
> 
> Similar to the username stored with an obsolete marker, this comes only from the
> configured username or environment (i.e. -u is ignored).  While not unspoofable,
> it should help provide additional forensic detail, without requiring the
> developer to remember to specify -U.  It's also not clear that overwriting the
> author attribute is appropriate in all environments.

Seems reasonable.

> Since there might be some automated systems that don't have a username
> configured, just skip adding the field if it isn't available instead of
> aborting.

Awesome. Is this tested in the test suite? I can't spot it.
Matt Harbison - April 11, 2015, 1:22 a.m.
On Fri, 10 Apr 2015 16:55:25 -0400, Matt Mackall <mpm@selenic.com> wrote:

> On Thu, 2015-04-09 at 23:38 -0400, Matt Harbison wrote:
>> # HG changeset patch
>> # User Matt Harbison <matt_harbison@yahoo.com>
>> # Date 1428635183 14400
>> #      Thu Apr 09 23:06:23 2015 -0400
>> # Node ID 4ead5029e58ca8f2f85292fda0e372ca9086b113
>> # Parent  ca0da0fe83538ab7cb6bc4a754cebbfe0a8c8520
>> graft: record the user who performed the command in the extras  
>> dictionary
>>
>> Similar to the username stored with an obsolete marker, this comes only  
>> from the
>> configured username or environment (i.e. -u is ignored).  While not  
>> unspoofable,
>> it should help provide additional forensic detail, without requiring the
>> developer to remember to specify -U.  It's also not clear that  
>> overwriting the
>> author attribute is appropriate in all environments.
>
> Seems reasonable.
>
>> Since there might be some automated systems that don't have a username
>> configured, just skip adding the field if it isn't available instead of
>> aborting.
>
> Awesome. Is this tested in the test suite? I can't spot it.

Nope.  Added in V2.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3553,6 +3553,12 @@ 
                 extra['intermediate-source'] = ctx.hex()
             else:
                 extra['source'] = ctx.hex()
+            try:
+                extra['graft-user'] = ui.username()
+            except util.Abort:
+                # Ignore missing username for backward compatibility
+                pass
+
             user = ctx.user()
             if opts.get('user'):
                 user = opts['user']
diff --git a/tests/test-annotate.t b/tests/test-annotate.t
--- a/tests/test-annotate.t
+++ b/tests/test-annotate.t
@@ -557,13 +557,13 @@ 
   $ echo C >> a
   $ hg commit -m 'contentC'
   $ hg log -G
-  @  changeset:   4:072f1e8df249
+  @  changeset:   4:71292c0e0ffd
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     contentC
   |
-  o  changeset:   3:ff38df03cc4b
+  o  changeset:   3:dee4cfbd763f
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     contentB
diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t
--- a/tests/test-commit-amend.t
+++ b/tests/test-commit-amend.t
@@ -491,10 +491,11 @@ 
   $ hg graft 12
   grafting 12:2647734878ef "fork" (tip)
   $ hg ci --amend -m 'graft amend'
-  saved backup bundle to $TESTTMP/.hg/strip-backup/bd010aea3f39-eedb103b-amend-backup.hg (glob)
+  saved backup bundle to $TESTTMP/.hg/strip-backup/b5d551c7648e-183220de-amend-backup.hg (glob)
   $ hg log -r . --debug | grep extra
-  extra:       amend_source=bd010aea3f39f3fb2a2f884b9ccb0471cd77398e
+  extra:       amend_source=b5d551c7648ed0e21e2f1a5fe35b4d53e8465a21
   extra:       branch=a
+  extra:       graft-user=test
   extra:       source=2647734878ef0236dda712fae9c1651cf694ea8a
 
 Preserve phase
@@ -529,7 +530,7 @@ 
   $ hg id -n
   14
   $ hg log -Gl 3 --style=compact
-  @  14[tip]:11   b650e6ee8614   1970-01-01 00:00 +0000   test
+  @  14[tip]:11   b49f7d517369   1970-01-01 00:00 +0000   test
   |    babar
   |
   | o  12:0   2647734878ef   1970-01-01 00:00 +0000   test
@@ -539,10 +540,10 @@ 
   | |    a''
   | |
   $ hg log -Gl 4 --hidden --style=compact
-  @  14[tip]:11   b650e6ee8614   1970-01-01 00:00 +0000   test
+  @  14[tip]:11   b49f7d517369   1970-01-01 00:00 +0000   test
   |    babar
   |
-  | x  13:11   68ff8ff97044   1970-01-01 00:00 +0000   test
+  | x  13:11   0c6bbe5a4f99   1970-01-01 00:00 +0000   test
   |/     amend for phase
   |
   | o  12:0   2647734878ef   1970-01-01 00:00 +0000   test
@@ -560,16 +561,16 @@ 
   $ echo 'babar' >> a
   $ hg commit --amend
   $ hg log -Gl 6 --hidden --style=compact
-  @  16[tip]:11   9f9e9bccf56c   1970-01-01 00:00 +0000   test
+  @  16[tip]:11   664ba24d9168   1970-01-01 00:00 +0000   test
   |    babar
   |
-  | x  15   90fef497c56f   1970-01-01 00:00 +0000   test
-  | |    temporary amend commit for b650e6ee8614
+  | x  15   a445195da31b   1970-01-01 00:00 +0000   test
+  | |    temporary amend commit for b49f7d517369
   | |
-  | x  14:11   b650e6ee8614   1970-01-01 00:00 +0000   test
+  | x  14:11   b49f7d517369   1970-01-01 00:00 +0000   test
   |/     babar
   |
-  | x  13:11   68ff8ff97044   1970-01-01 00:00 +0000   test
+  | x  13:11   0c6bbe5a4f99   1970-01-01 00:00 +0000   test
   |/     amend for phase
   |
   | o  12:0   2647734878ef   1970-01-01 00:00 +0000   test
@@ -584,12 +585,12 @@ 
 ---------------------------------------------------------------------
 
   $ hg id -r 14 --hidden
-  b650e6ee8614 (a)
+  b49f7d517369 (a)
   $ hg revert -ar 14 --hidden
   reverting a
   $ hg commit --amend
   $ hg id
-  b99e5df575f7 (a) tip
+  652a5981358a (a) tip
 
 Test that rewriting leaving instability behind is allowed
 ---------------------------------------------------------------------
@@ -598,12 +599,12 @@ 
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ echo 'b' >> a
   $ hg log --style compact -r 'children(.)'
-  18[tip]:11   b99e5df575f7   1970-01-01 00:00 +0000   test
+  18[tip]:11   652a5981358a   1970-01-01 00:00 +0000   test
     babar
   
   $ hg commit --amend
   $ hg log -r 'unstable()'
-  changeset:   18:b99e5df575f7
+  changeset:   18:652a5981358a
   branch:      a
   parent:      11:3334b7925910
   user:        test
diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -99,7 +99,7 @@ 
   # User foo
   # Date 0 0
   #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID ef0ef43d49e79e81ddafdc7997401ba0041efc82
+  # Node ID d452e566af438cafadbf31f66115f48798b49b11
   # Parent  68795b066622ca79a25816a662041d8f78f3cd9e
   2
   
@@ -110,7 +110,7 @@ 
 Look for extra:source
 
   $ hg log --debug -r tip
-  changeset:   7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
+  changeset:   7:d452e566af438cafadbf31f66115f48798b49b11
   tag:         tip
   phase:       draft
   parent:      0:68795b066622ca79a25816a662041d8f78f3cd9e
@@ -121,6 +121,7 @@ 
   files+:      b
   files-:      a
   extra:       branch=default
+  extra:       graft-user=test
   extra:       source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
   description:
   2
@@ -132,7 +133,7 @@ 
 
   $ hg graft 1 5 4 3 'merge()' 2 -n
   skipping ungraftable merge revision 6
-  skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
+  skipping revision 2:5c095ad7e90f (already grafted to 7:d452e566af43)
   grafting 1:5d205f8b35b6 "1"
   grafting 5:97f8bfe72746 "5"
   grafting 4:9c233e8e184d "4"
@@ -141,7 +142,7 @@ 
   $ HGEDITOR=cat hg graft 1 5 4 3 'merge()' 2 --debug
   skipping ungraftable merge revision 6
   scanning for duplicate grafts
-  skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
+  skipping revision 2:5c095ad7e90f (already grafted to 7:d452e566af43)
   grafting 1:5d205f8b35b6 "1"
     searching for copies back to rev 1
     unmatched files in local:
@@ -151,13 +152,13 @@ 
     checking for directory renames
   resolving manifests
    branchmerge: True, force: True, partial: False
-   ancestor: 68795b066622, local: ef0ef43d49e7+, remote: 5d205f8b35b6
+   ancestor: 68795b066622, local: d452e566af43+, remote: 5d205f8b35b6
    preserving b for resolve of b
    b: local copied/moved from a -> m
   updating: b 1/1 files (100.00%)
   picked tool 'internal:merge' for b (binary False symlink False)
   merging b and a to b
-  my b@ef0ef43d49e7+ other a@5d205f8b35b6 ancestor a@68795b066622
+  my b@d452e566af43+ other a@5d205f8b35b6 ancestor a@68795b066622
    premerge successful
   committing files:
   b
@@ -167,7 +168,7 @@ 
     searching for copies back to rev 1
   resolving manifests
    branchmerge: True, force: True, partial: False
-   ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746
+   ancestor: 4c60f11aa304, local: d337da988110+, remote: 97f8bfe72746
    e: remote is newer -> g
   getting e
   updating: e 1/1 files (100.00%)
@@ -180,7 +181,7 @@ 
     searching for copies back to rev 1
   resolving manifests
    branchmerge: True, force: True, partial: False
-   ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d
+   ancestor: 4c60f11aa304, local: 3b0735937dcd+, remote: 9c233e8e184d
    preserving e for resolve of e
    d: remote is newer -> g
   getting d
@@ -190,7 +191,7 @@ 
   updating: e 2/2 files (100.00%)
   picked tool 'internal:merge' for e (binary False symlink False)
   merging e
-  my e@1905859650ec+ other e@9c233e8e184d ancestor e@68795b066622
+  my e@3b0735937dcd+ other e@9c233e8e184d ancestor e@68795b066622
   warning: conflicts during merge.
   merging e incomplete! (edit conflicts, then use 'hg resolve --mark')
   abort: unresolved conflicts, can't continue
@@ -219,9 +220,9 @@ 
 
   $ hg graft 1 5 4 3 'merge()' 2
   skipping ungraftable merge revision 6
-  skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
-  skipping revision 1:5d205f8b35b6 (already grafted to 8:6b9e5368ca4e)
-  skipping revision 5:97f8bfe72746 (already grafted to 9:1905859650ec)
+  skipping revision 2:5c095ad7e90f (already grafted to 7:d452e566af43)
+  skipping revision 1:5d205f8b35b6 (already grafted to 8:d337da988110)
+  skipping revision 5:97f8bfe72746 (already grafted to 9:3b0735937dcd)
   grafting 4:9c233e8e184d "4"
   merging e
   warning: conflicts during merge.
@@ -305,15 +306,15 @@ 
   $ hg ci -m 7
   created new head
   $ hg graft 7
-  grafting 7:ef0ef43d49e7 "2"
+  grafting 7:d452e566af43 "2"
 
   $ hg log -r 7 --template '{rev}:{node}\n'
-  7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
+  7:d452e566af438cafadbf31f66115f48798b49b11
   $ hg log -r 2 --template '{rev}:{node}\n'
   2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4
 
   $ hg log --debug -r tip
-  changeset:   13:7a4785234d87ec1aa420ed6b11afe40fa73e12a9
+  changeset:   13:8053cfc6e1785815e9c9886fdbc576acbec93ebf
   tag:         tip
   phase:       draft
   parent:      12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
@@ -324,7 +325,8 @@ 
   files+:      b
   files-:      a
   extra:       branch=default
-  extra:       intermediate-source=ef0ef43d49e79e81ddafdc7997401ba0041efc82
+  extra:       graft-user=test
+  extra:       intermediate-source=d452e566af438cafadbf31f66115f48798b49b11
   extra:       source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
   description:
   2
@@ -333,24 +335,24 @@ 
 Disallow grafting an already grafted cset onto its original branch
   $ hg up -q 6
   $ hg graft 7
-  skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f)
+  skipping already grafted revision 7:d452e566af43 (was grafted from 2:5c095ad7e90f)
   [255]
 
 Disallow grafting already grafted csets with the same origin onto each other
   $ hg up -q 13
   $ hg graft 2
-  skipping revision 2:5c095ad7e90f (already grafted to 13:7a4785234d87)
+  skipping revision 2:5c095ad7e90f (already grafted to 13:8053cfc6e178)
   [255]
   $ hg graft 7
-  skipping already grafted revision 7:ef0ef43d49e7 (13:7a4785234d87 also has origin 2:5c095ad7e90f)
+  skipping already grafted revision 7:d452e566af43 (13:8053cfc6e178 also has origin 2:5c095ad7e90f)
   [255]
 
   $ hg up -q 7
   $ hg graft 2
-  skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
+  skipping revision 2:5c095ad7e90f (already grafted to 7:d452e566af43)
   [255]
   $ hg graft tip
-  skipping already grafted revision 13:7a4785234d87 (7:ef0ef43d49e7 also has origin 2:5c095ad7e90f)
+  skipping already grafted revision 13:8053cfc6e178 (7:d452e566af43 also has origin 2:5c095ad7e90f)
   [255]
 
 Graft with --log
@@ -396,7 +398,7 @@ 
   # User bar
   # Date 0 0
   #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID f67661df0c4804d301f064f332b57e7d5ddaf2be
+  # Node ID e02bbdce9555c186d12893a3422dc591ea8faa70
   # Parent  aaa4406d4f0ae9befd6e58c82ec63706460cbca6
   1
   
@@ -425,8 +427,8 @@ 
   # User test
   # Date 0 0
   #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID 9627f653b421c61fc1ea4c4e366745070fa3d2bc
-  # Parent  ee295f490a40b97f3d18dd4c4f1c8936c233b612
+  # Node ID a9ec06f45aec459d88609692ca8f743af9ce1a0b
+  # Parent  82d8da9722361a54658f65f61bf789576e3ee8ce
   2
   
   diff --git a/a b/b
@@ -486,9 +488,10 @@ 
 
 The graft case
   $ hg -R ../converted log -r 7 --template "{rev}: {node}\n{join(extras, '\n')}\n"
-  7: 7ae846e9111fc8f57745634250c7b9ac0a60689b
+  7: f4d0502f8520f854d52847aa832227382cbabba9
   branch=default
-  convert_revision=ef0ef43d49e79e81ddafdc7997401ba0041efc82
+  convert_revision=d452e566af438cafadbf31f66115f48798b49b11
+  graft-user=test
   source=e0213322b2c1a5d5d236c74e79666441bee67a7d
   $ hg -R ../converted log -r 'origin(7)'
   changeset:   2:e0213322b2c1
@@ -499,16 +502,16 @@ 
 Test that template correctly expands more than one 'extra' (issue4362)
   $ hg -R ../converted log -r 7 --template "{extras % ' Extra: {extra}\n'}"
    Extra: branch=default
-   Extra: convert_revision=ef0ef43d49e79e81ddafdc7997401ba0041efc82
+   Extra: convert_revision=d452e566af438cafadbf31f66115f48798b49b11
+   Extra: graft-user=test
    Extra: source=e0213322b2c1a5d5d236c74e79666441bee67a7d
 
 The transplant case
   $ hg -R ../converted log -r tip --template "{rev}: {node}\n{join(extras, '\n')}\n"
-  21: fbb6c5cc81002f2b4b49c9d731404688bcae5ade
+  21: 24c78a176adb0e024569be6344174466fc786516
   branch=dev
-  convert_revision=7e61b508e709a11d28194a5359bc3532d910af21
-  transplant_source=z\xe8F\xe9\x11\x1f\xc8\xf5wEcBP\xc7\xb9\xac (esc)
-  `h\x9b (esc)
+  convert_revision=2a42e305f5d8f44c559e6d1586c3b8b255f70b55
+  transplant_source=\xf4\xd0P/\x85 \xf8T\xd5(G\xaa\x83"'8,\xba\xbb\xa9 (esc)
   $ hg -R ../converted log -r 'origin(tip)'
   changeset:   2:e0213322b2c1
   user:        test
@@ -518,54 +521,54 @@ 
 
 Test simple destination
   $ hg log -r 'destination()'
-  changeset:   7:ef0ef43d49e7
+  changeset:   7:d452e566af43
   parent:      0:68795b066622
   user:        foo
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     2
   
-  changeset:   8:6b9e5368ca4e
+  changeset:   8:d337da988110
   user:        bar
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     1
   
-  changeset:   9:1905859650ec
+  changeset:   9:3b0735937dcd
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     5
   
-  changeset:   10:52dc0b4c6907
+  changeset:   10:8e96d5bf786c
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     4
   
-  changeset:   11:882b35362a6b
+  changeset:   11:b8fc062c62fa
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     3
   
-  changeset:   13:7a4785234d87
+  changeset:   13:8053cfc6e178
   user:        foo
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     2
   
-  changeset:   14:f64defefacee
+  changeset:   14:b9c68a2f3cd9
   parent:      1:5d205f8b35b6
   user:        foo
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     3
   
-  changeset:   17:f67661df0c48
+  changeset:   17:e02bbdce9555
   user:        bar
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     1
   
-  changeset:   19:9627f653b421
+  changeset:   19:a9ec06f45aec
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     2
   
-  changeset:   21:7e61b508e709
+  changeset:   21:2a42e305f5d8
   branch:      dev
   tag:         tip
   user:        foo
@@ -573,23 +576,23 @@ 
   summary:     2
   
   $ hg log -r 'destination(2)'
-  changeset:   7:ef0ef43d49e7
+  changeset:   7:d452e566af43
   parent:      0:68795b066622
   user:        foo
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     2
   
-  changeset:   13:7a4785234d87
+  changeset:   13:8053cfc6e178
   user:        foo
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     2
   
-  changeset:   19:9627f653b421
+  changeset:   19:a9ec06f45aec
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     2
   
-  changeset:   21:7e61b508e709
+  changeset:   21:2a42e305f5d8
   branch:      dev
   tag:         tip
   user:        foo
@@ -598,7 +601,7 @@ 
   
 Transplants of grafts can find a destination...
   $ hg log -r 'destination(7)'
-  changeset:   21:7e61b508e709
+  changeset:   21:2a42e305f5d8
   branch:      dev
   tag:         tip
   user:        foo
@@ -616,29 +619,29 @@ 
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     2
   
-  changeset:   7:ef0ef43d49e7
+  changeset:   7:d452e566af43
   parent:      0:68795b066622
   user:        foo
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     2
   
-  changeset:   13:7a4785234d87
+  changeset:   13:8053cfc6e178
   user:        foo
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     2
   
-  changeset:   19:9627f653b421
+  changeset:   19:a9ec06f45aec
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     2
   
-  changeset:   21:7e61b508e709
+  changeset:   21:2a42e305f5d8
   branch:      dev
   user:        foo
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     2
   
-  changeset:   22:d1cb6591fa4b
+  changeset:   22:34433923cf1e
   branch:      dev
   tag:         tip
   user:        foo
@@ -649,14 +652,14 @@ 
 graft works on complex revset
 
   $ hg graft 'origin(13) or destination(origin(13))'
-  skipping ancestor revision 21:7e61b508e709
-  skipping ancestor revision 22:d1cb6591fa4b
-  skipping revision 2:5c095ad7e90f (already grafted to 22:d1cb6591fa4b)
-  grafting 7:ef0ef43d49e7 "2"
+  skipping ancestor revision 21:2a42e305f5d8
+  skipping ancestor revision 22:34433923cf1e
+  skipping revision 2:5c095ad7e90f (already grafted to 22:34433923cf1e)
+  grafting 7:d452e566af43 "2"
   warning: can't find ancestor for 'b' copied from 'a'!
-  grafting 13:7a4785234d87 "2"
+  grafting 13:8053cfc6e178 "2"
   warning: can't find ancestor for 'b' copied from 'a'!
-  grafting 19:9627f653b421 "2"
+  grafting 19:a9ec06f45aec "2"
   merging b
   warning: can't find ancestor for 'b' copied from 'a'!
 
@@ -665,11 +668,11 @@ 
   $ hg graft 19 0 6
   skipping ungraftable merge revision 6
   skipping ancestor revision 0:68795b066622
-  skipping already grafted revision 19:9627f653b421 (22:d1cb6591fa4b also has origin 2:5c095ad7e90f)
+  skipping already grafted revision 19:a9ec06f45aec (22:34433923cf1e also has origin 2:5c095ad7e90f)
   [255]
   $ hg graft 19 0 6 --force
   skipping ungraftable merge revision 6
-  grafting 19:9627f653b421 "2"
+  grafting 19:a9ec06f45aec "2"
   merging b
   warning: can't find ancestor for 'b' copied from 'a'!
   grafting 0:68795b066622 "0"
@@ -680,12 +683,12 @@ 
   $ hg ci -m 28
   $ hg backout 28
   reverting a
-  changeset 29:53177ba928f6 backs out changeset 28:50a516bb8b57
+  changeset 29:685c3691c756 backs out changeset 28:8238368be245
   $ hg graft 28
-  skipping ancestor revision 28:50a516bb8b57
+  skipping ancestor revision 28:8238368be245
   [255]
   $ hg graft 28 --force
-  grafting 28:50a516bb8b57 "28"
+  grafting 28:8238368be245 "28"
   merging a
   $ cat a
   abc
@@ -695,7 +698,7 @@ 
   $ echo def > a
   $ hg ci -m 31
   $ hg graft 28 --force --tool internal:fail
-  grafting 28:50a516bb8b57 "28"
+  grafting 28:8238368be245 "28"
   abort: unresolved conflicts, can't continue
   (use hg resolve and hg graft --continue)
   [255]
@@ -708,7 +711,7 @@ 
   $ hg resolve -m a
   (no more unresolved files)
   $ hg graft -c
-  grafting 28:50a516bb8b57 "28"
+  grafting 28:8238368be245 "28"
   $ cat a
   abc
 
@@ -720,7 +723,7 @@ 
   $ hg --config extensions.strip= strip 2
   saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg (glob)
   $ hg graft tmp
-  skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f)
+  skipping already grafted revision 8:8053cfc6e178 (2:d452e566af43 also has unknown origin 5c095ad7e90f)
   [255]
 
 Empty graft
@@ -729,8 +732,8 @@ 
   $ hg tag -f something
   $ hg graft -qr 27
   $ hg graft -f 27
-  grafting 27:ed6c7e54e319 "28"
-  note: graft of 27:ed6c7e54e319 created no changes to commit
+  grafting 27:a3e0fb7916e0 "28"
+  note: graft of 27:a3e0fb7916e0 created no changes to commit
 
   $ cd ..
 
@@ -761,7 +764,7 @@ 
 
   $ hg up -q 0
   $ hg graft -r 2
-  grafting 2:044ec77f6389 "b" (tip)
+  grafting 2:9d160879b7d0 "b" (tip)
   $ hg log -G -T '{rev}\n'
   @  3
   |
diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
--- a/tests/test-hgweb-commands.t
+++ b/tests/test-hgweb-commands.t
@@ -2224,10 +2224,10 @@ 
   \r (esc)
   
   # HG graph
-  # Node ID 1d9b947fef1fbb382a95c11a8f5a67e9a10b5026
+  # Node ID 7e5cdb66ed0d035d986e81f6dcb7a1d9e675db4a
   # Rows shown 7
   
-  changeset:   1d9b947fef1f
+  changeset:   7e5cdb66ed0d
   user:        test
   date:        1970-01-01
   summary:     5
@@ -2237,7 +2237,7 @@ 
   node:        (0, 0) (color 1)
   edge:        (0, 0) -> (0, 1) (color 1)
   
-  changeset:   0cfd435fd222
+  changeset:   4bad68993305
   user:        test
   date:        1970-01-01
   summary:     4
@@ -2245,7 +2245,7 @@ 
   node:        (0, 1) (color 1)
   edge:        (0, 1) -> (0, 2) (color 1)
   
-  changeset:   6768b9939e82
+  changeset:   451a66d39eb8
   user:        test
   date:        1970-01-01
   summary:     3
@@ -2253,7 +2253,7 @@ 
   node:        (0, 2) (color 1)
   edge:        (0, 2) -> (0, 3) (color 1)
   
-  changeset:   05b0497fd125
+  changeset:   8cbacae59a05
   user:        test
   date:        1970-01-01
   summary:     2
@@ -2261,7 +2261,7 @@ 
   node:        (0, 3) (color 1)
   edge:        (0, 3) -> (0, 4) (color 1)
   
-  changeset:   9c102df67cfb
+  changeset:   ea4b3451ae2b
   user:        test
   date:        1970-01-01
   summary:     1
@@ -2269,7 +2269,7 @@ 
   node:        (0, 4) (color 1)
   edge:        (0, 4) -> (0, 5) (color 1)
   
-  changeset:   3ebcd7db11bf
+  changeset:   e25a151d6e86
   user:        test
   date:        1970-01-01
   summary:     0
diff --git a/tests/test-issue1175.t b/tests/test-issue1175.t
--- a/tests/test-issue1175.t
+++ b/tests/test-issue1175.t
@@ -83,7 +83,7 @@ 
   grafting 1:5974126fad84 "b1"
   warning: can't find ancestor for 'b' copied from 'a'!
   $ hg log -f b -T 'changeset:   {rev}:{node|short}\nsummary:     {desc}\n\n'
-  changeset:   3:376d30ccffc0
+  changeset:   3:c0d77e1fd3b6
   summary:     b1
   
   changeset:   2:416baaa2e5e4
diff --git a/tests/test-keyword.t b/tests/test-keyword.t
--- a/tests/test-keyword.t
+++ b/tests/test-keyword.t
@@ -1276,7 +1276,7 @@ 
 
   $ hg graft -q 10
   $ hg diff -r 9 -r 13 a
-  diff -r 800511b3a22d -r 01a68de1003a a
+  diff -r 800511b3a22d -r d7b4c234e4d0 a
   --- a/a	Thu Jan 01 00:00:00 1970 +0000
   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
   @@ -1,4 +1,6 @@
@@ -1291,7 +1291,7 @@ 
 
   $ hg backout -q 11
   $ hg diff a
-  diff -r 01a68de1003a a
+  diff -r d7b4c234e4d0 a
   --- a/a	Thu Jan 01 00:00:00 1970 +0000
   +++ b/a	* (glob)
   @@ -3,4 +3,3 @@
diff --git a/tests/test-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -1779,13 +1779,13 @@ 
   $ echo 3 > a
   $ hg commit -m 'content3'
   $ hg log -G
-  @  changeset:   4:50b9b36e9c5d
+  @  changeset:   4:8c64310177c4
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     content3
   |
-  o  changeset:   3:15b2327059e5
+  o  changeset:   3:65e2d727bc5a
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     content2
@@ -1810,13 +1810,13 @@ 
 log -f on the file should list the graft result.
 
   $ hg log -Gf a
-  @  changeset:   4:50b9b36e9c5d
+  @  changeset:   4:8c64310177c4
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     content3
   |
-  o  changeset:   3:15b2327059e5
+  o  changeset:   3:65e2d727bc5a
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     content2
@@ -1831,7 +1831,7 @@ 
 (XXX we should probably list both)
 
   $ hg log -G a
-  @  changeset:   4:50b9b36e9c5d
+  @  changeset:   4:8c64310177c4
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
@@ -1854,7 +1854,7 @@ 
   $ hg up 'desc(content3)^'
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg log -Gf a
-  @  changeset:   3:15b2327059e5
+  @  changeset:   3:65e2d727bc5a
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     content2
@@ -1873,13 +1873,13 @@ 
   2294ae80ad8447bc78383182eeac50cb049df623
   $ hg debugobsolete 2294ae80ad8447bc78383182eeac50cb049df623
   $ hg log -G
-  o  changeset:   4:50b9b36e9c5d
+  o  changeset:   4:8c64310177c4
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     content3
   |
-  @  changeset:   3:15b2327059e5
+  @  changeset:   3:65e2d727bc5a
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     content2
@@ -1899,13 +1899,13 @@ 
 Check that log on the file does not drop the file revision.
 
   $ hg log -G a
-  o  changeset:   4:50b9b36e9c5d
+  o  changeset:   4:8c64310177c4
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     content3
   |
-  @  changeset:   3:15b2327059e5
+  @  changeset:   3:65e2d727bc5a
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     content2
@@ -1920,7 +1920,7 @@ 
 
   $ hg debugobsolete `hg log -T '{node}\n' -r 4`
   $ hg log -G a
-  @  changeset:   3:15b2327059e5
+  @  changeset:   3:65e2d727bc5a
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -130,11 +130,11 @@ 
   rebasing 3:32af7686d403 "D"
   note: rebase of 3:32af7686d403 created no changes to commit
   $ hg log -G
-  o  10:5ae4c968c6ac C
+  o  10:db9889d34533 C
   |
-  @  9:08483444fef9 D
+  @  9:5eb4cb53f44a D
   |
-  o  8:8877864f1edb B
+  o  8:bab4bb98e985 B
   |
   | o  7:02de42196ebe H
   | |
@@ -147,11 +147,11 @@ 
   o  0:cd010b8cd998 A
   
   $ hg log --hidden -G
-  o  10:5ae4c968c6ac C
+  o  10:db9889d34533 C
   |
-  @  9:08483444fef9 D
+  @  9:5eb4cb53f44a D
   |
-  o  8:8877864f1edb B
+  o  8:bab4bb98e985 B
   |
   | o  7:02de42196ebe H
   | |
@@ -171,27 +171,27 @@ 
   
   $ hg debugobsolete
   42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (*) {'user': 'test'} (glob)
-  5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (*) {'user': 'test'} (glob)
+  5fddd98957c8a54a4d436dfe1da9d87f21a1b97b db9889d34533a9424450adcd8140ecee888f5dfb 0 (*) {'user': 'test'} (glob)
   32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (*) {'user': 'test'} (glob)
 
 
 More complex case were part of the rebase set were already rebased
 
   $ hg rebase --rev 'desc(D)' --dest 'desc(H)'
-  rebasing 9:08483444fef9 "D"
+  rebasing 9:5eb4cb53f44a "D"
   $ hg debugobsolete
   42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (*) {'user': 'test'} (glob)
-  5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (*) {'user': 'test'} (glob)
+  5fddd98957c8a54a4d436dfe1da9d87f21a1b97b db9889d34533a9424450adcd8140ecee888f5dfb 0 (*) {'user': 'test'} (glob)
   32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (*) {'user': 'test'} (glob)
-  08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (*) {'user': 'test'} (glob)
+  5eb4cb53f44a1af5b367881840d251e39e6cf542 e592289ce2ed2f8dbf29b97f22cccfa89342b954 0 (*) {'user': 'test'} (glob)
   $ hg log -G
-  @  11:4596109a6a43 D
+  @  11:e592289ce2ed D
   |
-  | o  10:5ae4c968c6ac C
+  | o  10:db9889d34533 C
   | |
-  | x  9:08483444fef9 D
+  | x  9:5eb4cb53f44a D
   | |
-  | o  8:8877864f1edb B
+  | o  8:bab4bb98e985 B
   | |
   o |  7:02de42196ebe H
   | |
@@ -204,25 +204,25 @@ 
   o  0:cd010b8cd998 A
   
   $ hg rebase --source 'desc(B)' --dest 'tip'
-  rebasing 8:8877864f1edb "B"
-  rebasing 9:08483444fef9 "D"
-  note: rebase of 9:08483444fef9 created no changes to commit
-  rebasing 10:5ae4c968c6ac "C"
+  rebasing 8:bab4bb98e985 "B"
+  rebasing 9:5eb4cb53f44a "D"
+  note: rebase of 9:5eb4cb53f44a created no changes to commit
+  rebasing 10:db9889d34533 "C"
   $ hg debugobsolete
   42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (*) {'user': 'test'} (glob)
-  5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (*) {'user': 'test'} (glob)
+  5fddd98957c8a54a4d436dfe1da9d87f21a1b97b db9889d34533a9424450adcd8140ecee888f5dfb 0 (*) {'user': 'test'} (glob)
   32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (*) {'user': 'test'} (glob)
-  08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (*) {'user': 'test'} (glob)
-  8877864f1edb05d0e07dc4ba77b67a80a7b86672 462a34d07e599b87ea08676a449373fe4e2e1347 0 (*) {'user': 'test'} (glob)
-  08483444fef91d6224f6655ee586a65d263ad34c 0 {8877864f1edb05d0e07dc4ba77b67a80a7b86672} (*) {'user': 'test'} (glob)
-  5ae4c968c6aca831df823664e706c9d4aa34473d 98f6af4ee9539e14da4465128f894c274900b6e5 0 (*) {'user': 'test'} (glob)
+  5eb4cb53f44a1af5b367881840d251e39e6cf542 e592289ce2ed2f8dbf29b97f22cccfa89342b954 0 (*) {'user': 'test'} (glob)
+  bab4bb98e985fde36637f54612f1de83057aea6e e236ff420125131da5499cfe5994e5a509333923 0 (*) {'user': 'test'} (glob)
+  5eb4cb53f44a1af5b367881840d251e39e6cf542 0 {bab4bb98e985fde36637f54612f1de83057aea6e} (*) {'user': 'test'} (glob)
+  db9889d34533a9424450adcd8140ecee888f5dfb 73d205a6b4a18d612e7bd3e8c4a94e3f462a691f 0 (*) {'user': 'test'} (glob)
   $ hg log --rev 'divergent()'
   $ hg log -G
-  o  13:98f6af4ee953 C
+  o  13:73d205a6b4a1 C
   |
-  o  12:462a34d07e59 B
+  o  12:e236ff420125 B
   |
-  @  11:4596109a6a43 D
+  @  11:e592289ce2ed D
   |
   o  7:02de42196ebe H
   |
@@ -234,8 +234,8 @@ 
   |/
   o  0:cd010b8cd998 A
   
-  $ hg log --style default --debug -r 4596109a6a4328c398bde3a4a3b6737cfade3003
-  changeset:   11:4596109a6a4328c398bde3a4a3b6737cfade3003
+  $ hg log --style default --debug -r e592289ce2ed2f8dbf29b97f22cccfa89342b954
+  changeset:   11:e592289ce2ed2f8dbf29b97f22cccfa89342b954
   phase:       draft
   parent:      7:02de42196ebee42ef284b6780a87cdc96e8eaab6
   parent:      -1:0000000000000000000000000000000000000000
@@ -244,7 +244,7 @@ 
   date:        Sat Apr 30 15:24:48 2011 +0200
   files+:      D
   extra:       branch=default
-  extra:       rebase_source=08483444fef91d6224f6655ee586a65d263ad34c
+  extra:       rebase_source=5eb4cb53f44a1af5b367881840d251e39e6cf542
   extra:       source=32af7686d403cf45b5d95f2d70cebea587ac806a
   description:
   D