evolve: move the bookmarks also when updating to successor (issue5923)
When we are on an obsolete node and does `hg evolve`, it updates to it's
sucessor, however it does not move the bookmark to the successor.
This patch adds logic to make sure we move the bookmark too.
Test change demonstrates the fix.
--- a/CHANGELOG Tue Jun 19 23:21:44 2018 +0530
+++ b/CHANGELOG Tue Jun 19 23:21:54 2018 +0530
@@ -12,6 +12,7 @@
* evolve: add a help section dedicated to interrupted evolve,
* evolve: merge commit messages when resolving content divergence (issue5877)
* evolve: show unfinished state information in `hg status -v` (issue5886)
+ * evolve: move bookmarks also when updating to successors (issue5923)
* evolve: add a new `--no-update` flag to keep working copy on the initial
revision.
* evolve: new help section dedicated to resuming operation interrupted by
--- a/hgext3rd/evolve/evolvecmd.py Tue Jun 19 23:21:44 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py Tue Jun 19 23:21:54 2018 +0530
@@ -1459,6 +1459,7 @@
elif len(specifiedcategories) == 1:
targetcat = specifiedcategories[0]
elif repo['.'].obsolete():
+ oldid = repo['.'].node()
displayer = compat.changesetdisplayer(ui, repo,
{'template': shorttemplate})
# no args and parent is obsolete, update to successors
@@ -1479,7 +1480,12 @@
if dryrunopt:
return 0
res = hg.update(repo, ctx.rev())
+ newid = ctx.node()
+
if ctx != startnode:
+ with repo.wlock(), repo.lock(), repo.transaction('evolve') as tr:
+ bmupdater = rewriteutil.bookmarksupdater(repo, oldid, tr)
+ bmupdater(newid)
ui.status(_('working directory is now at %s\n') % ctx)
return res
--- a/tests/test-evolve.t Tue Jun 19 23:21:44 2018 +0530
+++ b/tests/test-evolve.t Tue Jun 19 23:21:54 2018 +0530
@@ -1589,7 +1589,7 @@
working directory is now at ab832e43dd5a
$ hg log -GT "{rev}:{node|short} {desc} ({bookmarks})\n" --hidden
- @ 1:ab832e43dd5a added a ()
+ @ 1:ab832e43dd5a added a (book)
- x 0:f7ad41964313 added a (book)
+ x 0:f7ad41964313 added a ()