fold: make sure we move bookmarks after folding (issue5772)
The rewriteutil.rewrite() API currently only handles moving bookmark from a old
node to new node. In case on fold, we have multiple old nodes, from where a
bookmark move is possible. The rewriteutil.rewrite() API is used by another
commands also and it's not good to plug in some logic there. This patch handles
bookmark movement from all the old nodes to the new node.
--- a/CHANGELOG Mon Jan 22 13:33:58 2018 +0530
+++ b/CHANGELOG Mon Jan 22 13:44:32 2018 +0530
@@ -1,6 +1,11 @@
Changelog
=========
+7.2.2 -- (in-progress)
+----------------------
+
+ * fold: fix issue related to bookmarks movement (issue5772)
+
7.2.1 --2018-01-20
-------------------
--- a/hgext3rd/evolve/cmdrewrite.py Mon Jan 22 13:33:58 2018 +0530
+++ b/hgext3rd/evolve/cmdrewrite.py Mon Jan 22 13:44:32 2018 +0530
@@ -611,6 +611,11 @@
phases.retractboundary(repo, tr, targetphase, [newid])
obsolete.createmarkers(repo, [(ctx, (repo[newid],))
for ctx in allctx], metadata=metadata)
+ # move bookmarks from old nodes to the new one
+ # XXX: we should make rewriteutil.rewrite() handle such cases
+ for ctx in allctx:
+ bmupdater = rewriteutil.bookmarksupdater(repo, ctx.node(), tr)
+ bmupdater(newid)
tr.close()
finally:
tr.release()
--- a/tests/test-fold.t Mon Jan 22 13:33:58 2018 +0530
+++ b/tests/test-fold.t Mon Jan 22 13:44:32 2018 +0530
@@ -91,7 +91,7 @@
Checking whether the bookmarks are moved or not
$ hg log -G
- @ 11 - 198b5c405d01 r5 [debugbuilddag] (draft)
+ @ 11 - 198b5c405d01 r5 [debugbuilddag] (draft) bm1
|
| o 10 - a8407f9a3dc1 r10 [debugbuilddag] (draft)
| |
@@ -99,12 +99,6 @@
| |
| o 8 - abf57d94268b r8 [debugbuilddag] (draft)
| |
- | | x 7 - 4de32a90b66c r7 [debugbuilddag] (draft) bm1
- | | |
- | | x 6 - f69452c5b1af r6 [debugbuilddag] (draft)
- | | |
- +---x 5 - c8d03c1b5e94 r5 [debugbuilddag] (draft)
- | |
o | 4 - bebd167eb94d r4 [debugbuilddag] (draft)
|/
o 3 - 2dc09a01254d r3 [debugbuilddag] (draft)
@@ -115,10 +109,6 @@
|
o 0 - 1ea73414a91b r0 [debugbuilddag] (public)
-XXX: bookmark not moved, manually moving it (issue5772)
- $ hg bookmark -r . bm1
- moving bookmark 'bm1' forward from 4de32a90b66c
-
(test inherited from test-evolve.t)
$ hg fold --from 6 # want to run hg fold 6
@@ -223,15 +213,11 @@
2 changesets folded
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg log -G
- @ 14 - 29b470a33594 r5 [Victor Rataxes <victor@rhino.savannah>] (draft)
+ @ 14 - 29b470a33594 r5 [Victor Rataxes <victor@rhino.savannah>] (draft) bm1
|
- | x 13 - 14d0e0da8e91 r11 [test] (draft) bm1
+ | o 12 - b568edbee6e0 r8 [debugbuilddag] (draft)
| |
- | | o 12 - b568edbee6e0 r8 [debugbuilddag] (draft)
- | | |
- | x | 11 - 198b5c405d01 r5 [debugbuilddag] (draft)
- |/ /
- o / 4 - bebd167eb94d r4 [debugbuilddag] (draft)
+ o | 4 - bebd167eb94d r4 [debugbuilddag] (draft)
|/
o 3 - 2dc09a01254d r3 [debugbuilddag] (draft)
|
@@ -246,15 +232,9 @@
2 changesets folded
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg log -G
- @ 15 - 91880abed0f2 r4 [test] (draft)
+ @ 15 - 91880abed0f2 r4 [test] (draft) bm1
|
- | x 13 - 14d0e0da8e91 r11 [test] (draft) bm1
- | |
- +---o 12 - b568edbee6e0 r8 [debugbuilddag] (draft)
- | |
- | x 11 - 198b5c405d01 r5 [debugbuilddag] (draft)
- | |
- | x 4 - bebd167eb94d r4 [debugbuilddag] (draft)
+ | o 12 - b568edbee6e0 r8 [debugbuilddag] (draft)
|/
o 3 - 2dc09a01254d r3 [debugbuilddag] (draft)
|