Patchwork [2,of,5] histedit: record histedit source (issue3681)

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 16, 2013, 6:28 p.m.
Message ID <9a39e144ac7a29debbbd.1358360896@crater2.logilab.fr>
Download mbox | patch
Permalink /patch/660/
State Accepted
Commit 358c23e8f1c67ca181c5ba812e98e5986cb0664a
Headers show

Comments

Pierre-Yves David - Jan. 16, 2013, 6:28 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@logilab.fr>
# Date 1358360062 -3600
# Node ID 9a39e144ac7a29debbbd9b63904b40e980278642
# Parent  92817b424cf7c73a23babf4c2f9d876b6c892cba
histedit: record histedit source (issue3681)

Have histedit record the hex of the original changeset as already done by:
- graft
- commit --amend
- rebase

My main motivation for adding this is to prevent the creation of obsolescence cycle
(see issue3681).

Note that commit created during edit are not affected yet.

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -179,16 +179,19 @@  editcomment = _("""# Edit history betwee
 def commitfuncfor(repo, src):
     """Build a commit function for the replacement of <src>
 
     This function ensure we apply the same treatement to all changesets.
 
-    No such treatment is done yet.
+    - Add a 'histedit_source' entry in extra.
 
     Note that fold have its own separated logic because its handling is a bit
     different and non factorisable.
     """
     def commitfunc(**kwargs):
+        extra = kwargs.get('extra', {}).copy()
+        extra['histedit_source'] = src.hex()
+        kwargs['extra'] = extra
         return repo.commit(**kwargs)
     return commitfunc
 
 
 
@@ -268,11 +271,11 @@  def collapse(repo, first, last, commitop
         message = commitopts['message']
     else:
         message = first.description()
     user = commitopts.get('user')
     date = commitopts.get('date')
-    extra = first.extra()
+    extra = commitopts.get('extra')
 
     parents = (first.p1().node(), first.p2().node())
     new = context.memctx(repo,
                          parents=parents,
                          text=message,
@@ -346,10 +349,16 @@  def finishfold(ui, repo, ctx, oldctx, ne
         [repo[r].description() for r in internalchanges] +
         [oldctx.description()]) + '\n'
     commitopts['message'] = newmessage
     # date
     commitopts['date'] = max(ctx.date(), oldctx.date())
+    extra = ctx.extra().copy()
+    # histedit_source
+    # note: ctx is likely a temporary commit but that the best we can do here
+    #       This is sufficient to solve issue3681 anyway
+    extra['histedit_source'] = '%s,%s' % (ctx.hex(), oldctx.hex())
+    commitopts['extra'] = extra
     n = collapse(repo, ctx, repo[newnode], commitopts)
     if n is None:
         return ctx, []
     hg.update(repo, n)
     replacements = [(oldctx.node(), (newnode,)),
diff --git a/tests/test-histedit-bookmark-motion.t b/tests/test-histedit-bookmark-motion.t
--- a/tests/test-histedit-bookmark-motion.t
+++ b/tests/test-histedit-bookmark-motion.t
@@ -82,34 +82,34 @@ 
   > pick 055a42cdd887 3 d
   > fold e860deea161a 4 e
   > pick 652413bf663e 5 f
   > EOF
   $ hg histedit 1 --commands commands.txt --verbose | grep histedit
-  histedit: moving bookmarks also-two from 177f92b77385 to d36c0562f908
-  histedit: moving bookmarks five from 652413bf663e to 0efacef7cb48
-  histedit: moving bookmarks four from e860deea161a to ae467701c500
-  histedit: moving bookmarks three from 055a42cdd887 to ae467701c500
-  histedit: moving bookmarks two from 177f92b77385 to d36c0562f908
+  histedit: moving bookmarks also-two from 177f92b77385 to b346ab9a313d
+  histedit: moving bookmarks five from 652413bf663e to cacdfd884a93
+  histedit: moving bookmarks four from e860deea161a to 59d9f330561f
+  histedit: moving bookmarks three from 055a42cdd887 to 59d9f330561f
+  histedit: moving bookmarks two from 177f92b77385 to b346ab9a313d
   histedit: moving bookmarks will-move-backwards from d2ae7f538514 to cb9a9f314b8b
   saved backup bundle to $TESTTMP/r/.hg/strip-backup/d2ae7f538514-backup.hg (glob)
-  saved backup bundle to $TESTTMP/r/.hg/strip-backup/34a9919932c1-backup.hg (glob)
+  saved backup bundle to $TESTTMP/r/.hg/strip-backup/96e494a2d553-backup.hg (glob)
   $ hg log --graph
-  @  changeset:   3:0efacef7cb48
+  @  changeset:   3:cacdfd884a93
   |  bookmark:    five
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     f
   |
-  o  changeset:   2:ae467701c500
+  o  changeset:   2:59d9f330561f
   |  bookmark:    four
   |  bookmark:    three
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     d
   |
-  o  changeset:   1:d36c0562f908
+  o  changeset:   1:b346ab9a313d
   |  bookmark:    also-two
   |  bookmark:    two
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     c
@@ -119,54 +119,54 @@ 
      user:        test
      date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     a
   
   $ HGEDITOR=cat hg histedit 1
-  pick d36c0562f908 1 c
-  pick ae467701c500 2 d
-  pick 0efacef7cb48 3 f
+  pick b346ab9a313d 1 c
+  pick 59d9f330561f 2 d
+  pick cacdfd884a93 3 f
   
-  # Edit history between d36c0562f908 and 0efacef7cb48
+  # Edit history between b346ab9a313d and cacdfd884a93
   #
   # Commands:
   #  p, pick = use commit
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but fold into previous commit (combines N and N-1)
   #  d, drop = remove commit from history
   #  m, mess = edit message without changing commit content
   #
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat > commands.txt << EOF
-  > pick d36c0562f908 1 c
-  > pick 0efacef7cb48 3 f
-  > pick ae467701c500 2 d
+  > pick b346ab9a313d 1 c
+  > pick cacdfd884a93 3 f
+  > pick 59d9f330561f 2 d
   > EOF
   $ hg histedit 1 --commands commands.txt --verbose | grep histedit
-  histedit: moving bookmarks five from 0efacef7cb48 to 1be9c35b4cb2
-  histedit: moving bookmarks four from ae467701c500 to 1be9c35b4cb2
-  histedit: moving bookmarks three from ae467701c500 to 1be9c35b4cb2
-  saved backup bundle to $TESTTMP/r/.hg/strip-backup/ae467701c500-backup.hg (glob)
+  histedit: moving bookmarks five from cacdfd884a93 to c04e50810e4b
+  histedit: moving bookmarks four from 59d9f330561f to c04e50810e4b
+  histedit: moving bookmarks three from 59d9f330561f to c04e50810e4b
+  saved backup bundle to $TESTTMP/r/.hg/strip-backup/59d9f330561f-backup.hg (glob)
 
 We expect 'five' to stay at tip, since the tipmost bookmark is most
 likely the useful signal.
 
   $ hg log --graph
-  @  changeset:   3:1be9c35b4cb2
+  @  changeset:   3:c04e50810e4b
   |  bookmark:    five
   |  bookmark:    four
   |  bookmark:    three
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     d
   |
-  o  changeset:   2:7c044e3e33a9
+  o  changeset:   2:c13eb81022ca
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     f
   |
-  o  changeset:   1:d36c0562f908
+  o  changeset:   1:b346ab9a313d
   |  bookmark:    also-two
   |  bookmark:    two
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     c
diff --git a/tests/test-histedit-commute.t b/tests/test-histedit-commute.t
--- a/tests/test-histedit-commute.t
+++ b/tests/test-histedit-commute.t
@@ -92,22 +92,22 @@  rules should end up in .hg/histedit-last
   pick 652413bf663e f
   pick 055a42cdd887 d
 
 log after edit
   $ hg log --graph
-  @  changeset:   5:853c68da763f
+  @  changeset:   5:07114f51870f
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     d
   |
-  o  changeset:   4:26f6a030ae82
+  o  changeset:   4:8ade9693061e
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     f
   |
-  o  changeset:   3:b069cc29fb22
+  o  changeset:   3:d8249471110a
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     e
   |
   o  changeset:   2:177f92b77385
@@ -128,33 +128,33 @@  log after edit
 
 put things back
 
   $ cat > $EDITED <<EOF
   > pick 177f92b77385 c
-  > pick 853c68da763f d
-  > pick b069cc29fb22 e
-  > pick 26f6a030ae82 f
+  > pick 07114f51870f d
+  > pick d8249471110a e
+  > pick 8ade9693061e f
   > EOF
   $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
   0 files updated, 0 files merged, 3 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
   $ hg log --graph
-  @  changeset:   5:652413bf663e
+  @  changeset:   5:7eca9b5b1148
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     f
   |
-  o  changeset:   4:e860deea161a
+  o  changeset:   4:915da888f2de
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     e
   |
-  o  changeset:   3:055a42cdd887
+  o  changeset:   3:10517e47bbbb
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     d
   |
   o  changeset:   2:177f92b77385
@@ -174,39 +174,39 @@  put things back
   
 
 slightly different this time
 
   $ cat > $EDITED <<EOF
-  > pick 055a42cdd887 d
-  > pick 652413bf663e f
-  > pick e860deea161a e
+  > pick 10517e47bbbb d
+  > pick 7eca9b5b1148 f
+  > pick 915da888f2de e
   > pick 177f92b77385 c
   > EOF
   $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg log --graph
-  @  changeset:   5:99a62755c625
+  @  changeset:   5:38b92f448761
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     c
   |
-  o  changeset:   4:7c6fdd608667
+  o  changeset:   4:de71b079d9ce
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     e
   |
-  o  changeset:   3:c4f52e213402
+  o  changeset:   3:be9ae3a309c6
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     f
   |
-  o  changeset:   2:bfe4a5a76b37
+  o  changeset:   2:799205341b6b
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     d
   |
   o  changeset:   1:d2ae7f538514
@@ -220,52 +220,52 @@  slightly different this time
      summary:     a
   
 
 keep prevents stripping dead revs
   $ cat > $EDITED <<EOF
-  > pick bfe4a5a76b37 d
-  > pick c4f52e213402 f
-  > pick 99a62755c625 c
-  > pick 7c6fdd608667 e
+  > pick 799205341b6b d
+  > pick be9ae3a309c6 f
+  > pick 38b92f448761 c
+  > pick de71b079d9ce e
   > EOF
-  $ HGEDITOR="cat \"$EDITED\" > " hg histedit bfe4a5a76b37 --keep 2>&1 | fixbundle
+  $ HGEDITOR="cat \"$EDITED\" > " hg histedit 799205341b6b --keep 2>&1 | fixbundle
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg log --graph
   > cat > $EDITED <<EOF
-  > pick 7c6fdd608667 e
-  > pick 99a62755c625 c
+  > pick de71b079d9ce e
+  > pick 38b92f448761 c
   > EOF
-  @  changeset:   7:99e266581538
+  @  changeset:   7:803ef1c6fcfd
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     e
   |
-  o  changeset:   6:5ad36efb0653
-  |  parent:      3:c4f52e213402
+  o  changeset:   6:ece0b8d93dda
+  |  parent:      3:be9ae3a309c6
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     c
   |
-  | o  changeset:   5:99a62755c625
+  | o  changeset:   5:38b92f448761
   | |  user:        test
   | |  date:        Thu Jan 01 00:00:00 1970 +0000
   | |  summary:     c
   | |
-  | o  changeset:   4:7c6fdd608667
+  | o  changeset:   4:de71b079d9ce
   |/   user:        test
   |    date:        Thu Jan 01 00:00:00 1970 +0000
   |    summary:     e
   |
-  o  changeset:   3:c4f52e213402
+  o  changeset:   3:be9ae3a309c6
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     f
   |
-  o  changeset:   2:bfe4a5a76b37
+  o  changeset:   2:799205341b6b
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     d
   |
   o  changeset:   1:d2ae7f538514
@@ -281,38 +281,38 @@  keep prevents stripping dead revs
 
 try with --rev
   $ hg histedit --commands "$EDITED" --rev -2 2>&1 | fixbundle
   abort: may not use changesets other than the ones listed
   $ hg log --graph
-  @  changeset:   7:99e266581538
+  @  changeset:   7:803ef1c6fcfd
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     e
   |
-  o  changeset:   6:5ad36efb0653
-  |  parent:      3:c4f52e213402
+  o  changeset:   6:ece0b8d93dda
+  |  parent:      3:be9ae3a309c6
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     c
   |
-  | o  changeset:   5:99a62755c625
+  | o  changeset:   5:38b92f448761
   | |  user:        test
   | |  date:        Thu Jan 01 00:00:00 1970 +0000
   | |  summary:     c
   | |
-  | o  changeset:   4:7c6fdd608667
+  | o  changeset:   4:de71b079d9ce
   |/   user:        test
   |    date:        Thu Jan 01 00:00:00 1970 +0000
   |    summary:     e
   |
-  o  changeset:   3:c4f52e213402
+  o  changeset:   3:be9ae3a309c6
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     f
   |
-  o  changeset:   2:bfe4a5a76b37
+  o  changeset:   2:799205341b6b
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     d
   |
   o  changeset:   1:d2ae7f538514
diff --git a/tests/test-histedit-drop.t b/tests/test-histedit-drop.t
--- a/tests/test-histedit-drop.t
+++ b/tests/test-histedit-drop.t
@@ -67,22 +67,22 @@  edit the history
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 log after edit
   $ hg log --graph
-  @  changeset:   4:708943196e52
+  @  changeset:   4:f518305ce889
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     d
   |
-  o  changeset:   3:75cbdffecadb
+  o  changeset:   3:a4f7421b80f7
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     f
   |
-  o  changeset:   2:493dc0964412
+  o  changeset:   2:ee283cb5f2d5
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     e
   |
   o  changeset:   1:d2ae7f538514
@@ -94,10 +94,29 @@  log after edit
      user:        test
      date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     a
   
 
+Check histedit_source
+
+  $ hg log --debug --rev f518305ce889
+  changeset:   4:f518305ce889c07cb5bd05522176d75590ef3324
+  tag:         tip
+  phase:       draft
+  parent:      3:a4f7421b80f79fcc59fff01bcbf4a53d127dd6d3
+  parent:      -1:0000000000000000000000000000000000000000
+  manifest:    4:d3d4f51c157ff242c32ff745d4799aaa26ccda44
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  files+:      d
+  extra:       branch=default
+  extra:       histedit_source=055a42cdd88768532f9cf79daa407fc8d138de9b
+  description:
+  d
+  
+  
+
 manifest after edit
   $ hg manifest
   a
   b
   d
diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t
--- a/tests/test-histedit-edit.t
+++ b/tests/test-histedit-edit.t
@@ -86,17 +86,17 @@  commit, then edit the revision
   $ HGEDITOR='echo foobaz > ' hg histedit --continue 2>&1 | fixbundle
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
   $ hg log --graph
-  @  changeset:   6:bf757c081cd0
+  @  changeset:   6:b5f70786f9b0
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     f
   |
-  o  changeset:   5:d6b15fed32d4
+  o  changeset:   5:a5e1ba2f7afb
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     foobaz
   |
   o  changeset:   4:1a60820cd1f6
@@ -126,26 +126,46 @@  commit, then edit the revision
   
 
   $ hg cat e
   a
 
+check histedit_source
+
+  $ hg log --debug --rev 5
+  changeset:   5:a5e1ba2f7afb899ef1581cea528fd885d2fca70d
+  phase:       draft
+  parent:      4:1a60820cd1f6004a362aa622ebc47d59bc48eb34
+  parent:      -1:0000000000000000000000000000000000000000
+  manifest:    5:5ad3be8791f39117565557781f5464363b918a45
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  files:       e
+  extra:       branch=default
+  extra:       histedit_source=e860deea161a2f77de56603b340ebbb4536308ae
+  description:
+  foobaz
+  
+  
+
   $ cat > $EDITED <<EOF
-  > edit bf757c081cd0 f
+  > edit b5f70786f9b0 f
   > EOF
   $ HGEDITOR="cat \"$EDITED\" > " hg histedit tip 2>&1 | fixbundle
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   abort: Make changes as needed, you may commit or record as needed now.
   When you are finished, run hg histedit --continue to resume.
   $ hg status
   A f
   $ HGEDITOR='true' hg histedit --continue
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  saved backup bundle to $TESTTMP/r/.hg/strip-backup/b5f70786f9b0-backup.hg (glob)
+
   $ hg status
 
 log after edit
   $ hg log --limit 1
-  changeset:   6:bf757c081cd0
+  changeset:   6:a107ee126658
   tag:         tip
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     f
   
@@ -158,31 +178,31 @@  say we'll change the message, but don't.
   $ HGEDITOR="sh ../edit.sh" hg histedit tip 2>&1 | fixbundle
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg status
   $ hg log --limit 1
-  changeset:   6:bf757c081cd0
+  changeset:   6:1fd3b2fe7754
   tag:         tip
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     f
   
 
 modify the message
   $ cat > $EDITED <<EOF
-  > mess bf757c081cd0 f
+  > mess 1fd3b2fe7754 f
   > EOF
   $ HGEDITOR="cat \"$EDITED\" > " hg histedit tip 2>&1 | fixbundle
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg status
   $ hg log --limit 1
-  changeset:   6:0b16746f8e89
+  changeset:   6:5585e802ef99
   tag:         tip
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
-  summary:     mess bf757c081cd0 f
+  summary:     mess 1fd3b2fe7754 f
   
 
 rollback should not work after a histedit
   $ hg rollback
   no rollback information available
diff --git a/tests/test-histedit-fold-non-commute.t b/tests/test-histedit-fold-non-commute.t
--- a/tests/test-histedit-fold-non-commute.t
+++ b/tests/test-histedit-fold-non-commute.t
@@ -134,17 +134,17 @@  just continue this time
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 log after edit
   $ hg log --graph
-  @  changeset:   5:2696a654c663
+  @  changeset:   5:d9cf42e54966
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     f
   |
-  o  changeset:   4:ec2c1cf833a8
+  o  changeset:   4:10486af2e984
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     d
   |
   o  changeset:   3:65a9a84f33fd
diff --git a/tests/test-histedit-fold.t b/tests/test-histedit-fold.t
--- a/tests/test-histedit-fold.t
+++ b/tests/test-histedit-fold.t
@@ -70,22 +70,22 @@  edit the history
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 log after edit
   $ hg log --graph
-  @  changeset:   4:82b0c1ff1777
+  @  changeset:   4:7e0a290363ed
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     d
   |
-  o  changeset:   3:150aafb44a91
+  o  changeset:   3:5e24935bad3d
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     pick e860deea161a e
   |
-  o  changeset:   2:493dc0964412
+  o  changeset:   2:ee283cb5f2d5
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     e
   |
   o  changeset:   1:d2ae7f538514
@@ -106,10 +106,32 @@  post-fold manifest
   c
   d
   e
   f
 
+
+check histedit_source
+
+  $ hg log --debug --rev 3
+  changeset:   3:5e24935bad3d5a4486de3b90f233e991465ced72
+  phase:       draft
+  parent:      2:ee283cb5f2d5955443f23a27b697a04339e9a39a
+  parent:      -1:0000000000000000000000000000000000000000
+  manifest:    3:81eede616954057198ead0b2c73b41d1f392829a
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  files+:      c f
+  extra:       branch=default
+  extra:       histedit_source=a4f7421b80f79fcc59fff01bcbf4a53d127dd6d3,177f92b773850b59254aa5e923436f921b55483b
+  description:
+  pick e860deea161a e
+  pick 652413bf663e f
+  fold 177f92b77385 c
+  pick 055a42cdd887 d
+  
+  
+
   $ cd ..
 
 folding and creating no new change doesn't break:
   $ mkdir fold-to-empty-test
   $ cd fold-to-empty-test
@@ -256,11 +278,11 @@  dropped revision.
   HG: changed file
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/fold-with-dropped/.hg/strip-backup/617f94f13c0f-backup.hg (glob)
   $ hg log -G
-  @  changeset:   1:e29e02896e6c
+  @  changeset:   1:10c647b2cdd5
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     +4
   |
@@ -271,19 +293,19 @@  dropped revision.
   
   $ hg export tip
   # HG changeset patch
   # User test
   # Date 0 0
-  # Node ID e29e02896e6c2b149d2228a0a64b4f3a9a4237f3
+  # Node ID 10c647b2cdd54db0603ecb99b2ff5ce66d5a5323
   # Parent  0189ba417d34df9dda55f88b637dcae9917b5964
   +4
   ***
   +5.2
   ***
   +6
   
-  diff -r 0189ba417d34 -r e29e02896e6c file
+  diff -r 0189ba417d34 -r 10c647b2cdd5 file
   --- a/file	Thu Jan 01 00:00:00 1970 +0000
   +++ b/file	Thu Jan 01 00:00:00 1970 +0000
   @@ -1,3 +1,6 @@
    1
    2
diff --git a/tests/test-histedit-no-change.t b/tests/test-histedit-no-change.t
--- a/tests/test-histedit-no-change.t
+++ b/tests/test-histedit-no-change.t
@@ -94,21 +94,23 @@  editing a changeset without any actual c
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   abort: Make changes as needed, you may commit or record as needed now.
   When you are finished, run hg histedit --continue to resume.
   $ continueediting true "(leaving commit message unaltered)"
   % finalize changeset editing (leaving commit message unaltered)
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
 
 check state of working copy
   $ hg id
-  652413bf663e tip
+  794fe033d0a0 tip
 
   $ graphlog "log after history editing"
   % log after history editing
-  @  5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
+  @  5 794fe033d0a030f8df77c5de945fca35c9181c30 "f"
   |
-  o  4 e860deea161a2f77de56603b340ebbb4536308ae "e"
+  o  4 04d2fab980779f332dec458cc944f28de8b43435 "e"
   |
   o  3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
   |
   o  2 177f92b773850b59254aa5e923436f921b55483b "c"
   |
@@ -150,16 +152,18 @@  check state of working copy
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   abort: Make changes as needed, you may commit or record as needed now.
   When you are finished, run hg histedit --continue to resume.
   $ graphlog "log after first edit"
   % log after first edit
-  o  5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
+  @  6 e5ae3ca2f1ffdbd89ec41ebc273a231f7c3022f2 "d"
   |
-  o  4 e860deea161a2f77de56603b340ebbb4536308ae "e"
-  |
-  @  3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
-  |
+  | o  5 652413bf663ef2a641cab26574e46d5f5a64a55a "f"
+  | |
+  | o  4 e860deea161a2f77de56603b340ebbb4536308ae "e"
+  | |
+  | o  3 055a42cdd88768532f9cf79daa407fc8d138de9b "d"
+  |/
   o  2 177f92b773850b59254aa5e923436f921b55483b "c"
   |
   o  1 d2ae7f538514cd87c17547b0de4cea71fe1af9fb "b"
   |
   o  0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b "a"
diff --git a/tests/test-histedit-non-commute.t b/tests/test-histedit-non-commute.t
--- a/tests/test-histedit-non-commute.t
+++ b/tests/test-histedit-non-commute.t
@@ -172,17 +172,17 @@  just continue this time
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 log after edit
   $ hg log --graph
-  @  changeset:   6:8e082d1a72ea
+  @  changeset:   6:7efe1373e4bc
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     f
   |
-  o  changeset:   5:13b04d775b81
+  o  changeset:   5:e334d87a1e55
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     does not commute with e
   |
   o  changeset:   4:00f1c5383965
@@ -253,17 +253,17 @@  second edit also fails, but just continu
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 post message fix
   $ hg log --graph
-  @  changeset:   6:f14da722aa4b
+  @  changeset:   6:521c4c32c5e2
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     f
   |
-  o  changeset:   5:382ff1adf0ed
+  o  changeset:   5:f4f088e8adf6
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     pick 65a9a84f33fd 3 c
   |
   o  changeset:   4:00f1c5383965
diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -64,17 +64,17 @@  Enable obsolete
   > pick 055a42cdd887 3 d
   > fold e860deea161a 4 e
   > pick 652413bf663e 5 f
   > EOF
   $ hg histedit 1 --commands commands.txt --verbose | grep histedit
-  saved backup bundle to $TESTTMP/base/.hg/strip-backup/34a9919932c1-backup.hg (glob)
+  saved backup bundle to $TESTTMP/base/.hg/strip-backup/96e494a2d553-backup.hg (glob)
   $ hg log --graph --hidden
-  @  8:0efacef7cb48 f
+  @  8:cacdfd884a93 f
   |
-  o  7:ae467701c500 d
+  o  7:59d9f330561f d
   |
-  o  6:d36c0562f908 c
+  o  6:b346ab9a313d c
   |
   | x  5:652413bf663e f
   | |
   | x  4:e860deea161a e
   | |
@@ -86,41 +86,41 @@  Enable obsolete
   |/
   o  0:cb9a9f314b8b a
   
   $ hg debugobsolete
   d2ae7f538514cd87c17547b0de4cea71fe1af9fb 0 {'date': '* *', 'user': 'test'} (glob)
-  177f92b773850b59254aa5e923436f921b55483b d36c0562f908c692f5204d606d4ff3537d41f1bf 0 {'date': '* *', 'user': 'test'} (glob)
-  055a42cdd88768532f9cf79daa407fc8d138de9b ae467701c5006bf21ffcfdb555b3d6b63280b6b7 0 {'date': '* *', 'user': 'test'} (glob)
-  e860deea161a2f77de56603b340ebbb4536308ae ae467701c5006bf21ffcfdb555b3d6b63280b6b7 0 {'date': '* *', 'user': 'test'} (glob)
-  652413bf663ef2a641cab26574e46d5f5a64a55a 0efacef7cb481bf574f69075b82d044fdbe5c20f 0 {'date': '* *', 'user': 'test'} (glob)
+  177f92b773850b59254aa5e923436f921b55483b b346ab9a313db8537ecf96fca3ca3ca984ef3bd7 0 {'date': '* *', 'user': 'test'} (glob)
+  055a42cdd88768532f9cf79daa407fc8d138de9b 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 {'date': '* *', 'user': 'test'} (glob)
+  e860deea161a2f77de56603b340ebbb4536308ae 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 {'date': '* *', 'user': 'test'} (glob)
+  652413bf663ef2a641cab26574e46d5f5a64a55a cacdfd884a9321ec4e1de275ef3949fa953a1f83 0 {'date': '* *', 'user': 'test'} (glob)
 
 
 Ensure hidden revision does not prevent histedit
 -------------------------------------------------
 
 create an hidden revision
 
   $ cat > commands.txt <<EOF
-  > pick d36c0562f908 6 c
-  > drop ae467701c500 7 d
-  > pick 0efacef7cb48 8 f
+  > pick b346ab9a313d 6 c
+  > drop 59d9f330561f 7 d
+  > pick cacdfd884a93 8 f
   > EOF
   $ hg histedit 6 --commands commands.txt
   0 files updated, 0 files merged, 3 files removed, 0 files unresolved
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg log --graph
-  @  9:7c044e3e33a9 f
+  @  9:c13eb81022ca f
   |
-  o  6:d36c0562f908 c
+  o  6:b346ab9a313d c
   |
   o  0:cb9a9f314b8b a
   
 check hidden revision are ignored (6 have hidden children 7 and 8)
 
   $ cat > commands.txt <<EOF
-  > pick d36c0562f908 6 c
-  > pick 7c044e3e33a9 8 f
+  > pick b346ab9a313d 6 c
+  > pick c13eb81022ca 8 f
   > EOF
   $ hg histedit 6 --commands commands.txt
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 
@@ -128,13 +128,13 @@  Check that histedit respect phases
 =========================================
 
 (not directly related to the test file but doesn't deserve it's own test case)
 
   $ hg log -G
-  @  9:7c044e3e33a9 f
+  @  9:c13eb81022ca f
   |
-  o  6:d36c0562f908 c
+  o  6:b346ab9a313d c
   |
   o  0:cb9a9f314b8b a
   
   $ hg ph -pv '.^'
   phase changed for 2 changesets
@@ -148,8 +148,8 @@  Test that rewriting leaving instability 
 
   $ hg up '.^'
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg phase --force --draft .
   $ hg log -r 'children(.)'
-  9:7c044e3e33a9 f (no-eol)
+  9:c13eb81022ca f (no-eol)
   $ hg histedit -r '.'
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved