# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1516627347 -19800 # Node ID 51c0a23b519e134becb8be45751e39057171c339 # Parent ee72cdc2387bcc7f17067019108967029d08e505 evolve: handle case when newnode can be None while continuing evolve There can be case when `hg evolve --continue` is run, when working directory is clean and there is nothing to be included in the new commit. Let's make sure we handle such cases correctly and obsolete the node which is evolved with parent of wdir as successor. This is same as what rebase does. diff -r ee72cdc2387b -r 51c0a23b519e hgext3rd/evolve/evolvecmd.py --- a/hgext3rd/evolve/evolvecmd.py Sun Jan 28 19:28:08 2018 +0530 +++ b/hgext3rd/evolve/evolvecmd.py Mon Jan 22 18:52:27 2018 +0530 @@ -1138,7 +1138,12 @@ node = repo.commit(text=message, user=user, date=date, extra=extra) - obsolete.createmarkers(repo, [(ctx, (repo[node],))]) + # resolving conflicts can lead to empty wdir and node can be None in + # those cases + if node is not None: + obsolete.createmarkers(repo, [(ctx, (repo[node],))]) + else: + obsolete.createmarkers(repo, [(ctx, (repo['.'],))]) evolvestate.delete() return diff -r ee72cdc2387b -r 51c0a23b519e tests/test-evolve-continue.t --- a/tests/test-evolve-continue.t Sun Jan 28 19:28:08 2018 +0530 +++ b/tests/test-evolve-continue.t Mon Jan 22 18:52:27 2018 +0530 @@ -130,54 +130,10 @@ XXX: maybe we should add a message here about evolve resulting in no commit $ hg evolve --continue evolving 7:ad0a59d83efe "added e" - ** Unknown exception encountered with possibly-broken third-party extension evolve - ** which supports versions 4.4 of Mercurial. - ** Please disable evolve and try your action again. - ** If that fixes the bug please report it to https://bz.mercurial-scm.org/ - ** Python 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609] - ** Mercurial Distributed SCM (version 4.5+64-87416288be98) - ** Extensions loaded: rebase, evolve - Traceback (most recent call last): - File "/tmp/hgtests.vDbR61/install/bin/hg", line 41, in - dispatch.run() - File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/dispatch.py", line 88, in run - status = (dispatch(req) or 0) & 255 - File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/dispatch.py", line 183, in dispatch - ret = _runcatch(req) - File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/dispatch.py", line 324, in _runcatch - return _callcatch(ui, _runcatchfunc) - File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/dispatch.py", line 332, in _callcatch - return scmutil.callcatch(ui, func) - File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/scmutil.py", line 154, in callcatch - return func() - File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/dispatch.py", line 314, in _runcatchfunc - return _dispatch(req) - File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/dispatch.py", line 918, in _dispatch - cmdpats, cmdoptions) - File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/dispatch.py", line 673, in runcommand - ret = _runcommand(ui, options, cmd, d) - File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/dispatch.py", line 926, in _runcommand - return cmdfunc() - File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/dispatch.py", line 915, in - d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) - File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/util.py", line 1195, in check - return func(*args, **kwargs) - File "/home/foobar/repo/mutable-history/hgext3rd/evolve/evolvecmd.py", line 1141, in evolve - obsolete.createmarkers(repo, [(ctx, (repo[node],))]) - File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/obsolete.py", line 1115, in createmarkers - ui=repo.ui) - File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/obsolete.py", line 621, in create - if len(succ) != 20: - TypeError: object of type 'NoneType' has no len() - [1] $ hg glog @ 8:00a5c774cc37 added d | () draft - | * 7:ad0a59d83efe added e - | | () draft - | x 6:2a4e03d422e2 added d - |/ () draft o 5:cb6a2ab625bb added c | () draft o 2:b1661037fa25 added b