evolve: make "startnode" consistently be a node, not a context
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 23 Jan 2019 11:55:20 -0800
changeset 4376 0fbf895ce160
parent 4375 07ccf1686024
child 4377 c2f9de28415a
evolve: make "startnode" consistently be a node, not a context This fixes a bug where we didn't print "working directory is not at ..." after `hg evolve --continue` because we were comparing a node and a context.
hgext3rd/evolve/evolvecmd.py
tests/test-evolve-continue.t
--- a/hgext3rd/evolve/evolvecmd.py	Tue Jan 22 22:36:29 2019 -0800
+++ b/hgext3rd/evolve/evolvecmd.py	Wed Jan 23 11:55:20 2019 -0800
@@ -1292,7 +1292,7 @@
         unfi = repo.unfiltered()
         succ = utility._singlesuccessor(repo, unfi[startnode])
         hg.updaterepo(repo, repo[succ].node(), False)
-    if repo['.'] != startnode:
+    if repo['.'].node() != startnode:
         ui.status(_('working directory is now at %s\n') % repo['.'])
 
 def divergentsets(repo, ctx):
@@ -1447,7 +1447,7 @@
     contopt = opts['continue']
     anyopt = opts['any']
     allopt = opts['all']
-    startnode = repo['.']
+    startnode = repo['.'].node()
     dryrunopt = opts['dry_run']
     confirmopt = opts['confirm']
     revopt = opts['rev']
@@ -1544,7 +1544,7 @@
         # cbor does not know how to serialize sets, using list for skippedrevs
         stateopts = {'category': targetcat, 'replacements': {},
                      'revs': list(revs), 'confirm': confirmopt,
-                     'startnode': startnode.node(), 'skippedrevs': [],
+                     'startnode': startnode, 'skippedrevs': [],
                      'command': 'evolve', 'orphanmerge': False,
                      'bookmarkchanges': [], 'temprevs': [], 'obsmarkers': []}
         evolvestate.addopts(stateopts)
@@ -1592,7 +1592,7 @@
 
 def solveobswdp(ui, repo, opts):
     oldid = repo['.'].node()
-    startnode = repo['.']
+    startctx = repo['.']
     dryrunopt = opts.get('dry_run', False)
     displayer = compat.changesetdisplayer(ui, repo,
                                           {'template': shorttemplate})
@@ -1615,7 +1615,7 @@
     res = hg.update(repo, ctx.rev())
     newid = ctx.node()
 
-    if ctx != startnode:
+    if ctx != startctx:
         with repo.wlock(), repo.lock(), repo.transaction('evolve') as tr:
             bmupdater = rewriteutil.bookmarksupdater(repo, oldid, tr)
             bmupdater(newid)
--- a/tests/test-evolve-continue.t	Tue Jan 22 22:36:29 2019 -0800
+++ b/tests/test-evolve-continue.t	Wed Jan 23 11:55:20 2019 -0800
@@ -127,6 +127,7 @@
   $ hg evolve --continue
   evolving 7:ad0a59d83efe "added e"
   evolution of 7:ad0a59d83efe created no changes to commit
+  working directory is now at 00a5c774cc37
 
   $ hg glog
   @  8:00a5c774cc37 added d