Mercurial > evolve
changeset 3656:62e4149435d8
utility: convert node from MultipleSuccessorsError to rev numbers (issue5832)
utility.builddependencies() deals with rev numbers but MultipleSuccessorsError
returns nodeid which breaks the function and also breaks instability resolution.
Previou patch demonstrate the breakage. This patch makes sure we convert those
nodeids to rev numbers before processing ahead.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 06 Apr 2018 20:13:27 +0530 |
parents | 19e3771f4bcc |
children | b36e38e3a176 |
files | hgext3rd/evolve/utility.py tests/test-evolve-issue5832.t |
diffstat | 2 files changed, 38 insertions(+), 78 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/utility.py Fri Apr 06 15:35:57 2018 +0530 +++ b/hgext3rd/evolve/utility.py Fri Apr 06 20:13:27 2018 +0530 @@ -103,7 +103,10 @@ try: succ = _singlesuccessor(repo, p) except MultipleSuccessorsError as exc: - dependencies[r] = exc.successorssets + tset = set() + for node in exc.successorssets[0]: + tset.add(repo[node].rev()) + dependencies[r] = tset continue if succ in revs: dependencies[r].add(succ)
--- a/tests/test-evolve-issue5832.t Fri Apr 06 15:35:57 2018 +0530 +++ b/tests/test-evolve-issue5832.t Fri Apr 06 20:13:27 2018 +0530 @@ -104,83 +104,40 @@ Checking what evolve is trying to do $ hg evolve --dry-run --any --all - ** unknown exception encountered, please report by visiting - ** https://mercurial-scm.org/wiki/BugTracker - ** Python 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609] - ** Mercurial Distributed SCM (version 4.5.2+1522-110be5264257) - ** Extensions loaded: evolve - Traceback (most recent call last): - File "/tmp/hgtests.Zqw2_x/install/bin/hg", line 41, in <module> - dispatch.run() - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/dispatch.py", line 93, in run - status = (dispatch(req) or 0) - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/dispatch.py", line 213, in dispatch - ret = _runcatch(req) - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/dispatch.py", line 354, in _runcatch - return _callcatch(ui, _runcatchfunc) - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/dispatch.py", line 362, in _callcatch - return scmutil.callcatch(ui, func) - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/scmutil.py", line 159, in callcatch - return func() - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/dispatch.py", line 344, in _runcatchfunc - return _dispatch(req) - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/dispatch.py", line 973, in _dispatch - cmdpats, cmdoptions) - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/dispatch.py", line 730, in runcommand - ret = _runcommand(ui, options, cmd, d) - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/dispatch.py", line 981, in _runcommand - return cmdfunc() - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/dispatch.py", line 970, in <lambda> - d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/util.py", line 1537, in check - return func(*args, **kwargs) - File "/home/foobar/repo/mutable-history/hgext3rd/evolve/evolvecmd.py", line 1232, in evolve - revs = _orderrevs(repo, revs) - File "/home/foobar/repo/mutable-history/hgext3rd/evolve/evolvecmd.py", line 463, in _orderrevs - dependencies, rdependencies = utility.builddependencies(repo, revs) - File "/home/foobar/repo/mutable-history/hgext3rd/evolve/utility.py", line 109, in builddependencies - dependencies[r].add(succ) - AttributeError: 'list' object has no attribute 'add' - [1] + move:[2] added b + atop:[5] added a + hg rebase -r a1da0651488c -d 7014ec2829cd + could not solve instability, ambiguous destination: parent split across two branches Resolving instability using `hg evolve` - $ hg evolve --any --all - ** unknown exception encountered, please report by visiting - ** https://mercurial-scm.org/wiki/BugTracker - ** Python 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609] - ** Mercurial Distributed SCM (version 4.5.2+1522-110be5264257) - ** Extensions loaded: evolve - Traceback (most recent call last): - File "/tmp/hgtests.Zqw2_x/install/bin/hg", line 41, in <module> - dispatch.run() - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/dispatch.py", line 93, in run - status = (dispatch(req) or 0) - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/dispatch.py", line 213, in dispatch - ret = _runcatch(req) - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/dispatch.py", line 354, in _runcatch - return _callcatch(ui, _runcatchfunc) - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/dispatch.py", line 362, in _callcatch - return scmutil.callcatch(ui, func) - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/scmutil.py", line 159, in callcatch - return func() - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/dispatch.py", line 344, in _runcatchfunc - return _dispatch(req) - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/dispatch.py", line 973, in _dispatch - cmdpats, cmdoptions) - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/dispatch.py", line 730, in runcommand - ret = _runcommand(ui, options, cmd, d) - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/dispatch.py", line 981, in _runcommand - return cmdfunc() - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/dispatch.py", line 970, in <lambda> - d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) - File "/tmp/hgtests.Zqw2_x/install/lib/python/mercurial/util.py", line 1537, in check - return func(*args, **kwargs) - File "/home/foobar/repo/mutable-history/hgext3rd/evolve/evolvecmd.py", line 1232, in evolve - revs = _orderrevs(repo, revs) - File "/home/foobar/repo/mutable-history/hgext3rd/evolve/evolvecmd.py", line 463, in _orderrevs - dependencies, rdependencies = utility.builddependencies(repo, revs) - File "/home/foobar/repo/mutable-history/hgext3rd/evolve/utility.py", line 109, in builddependencies - dependencies[r].add(succ) - AttributeError: 'list' object has no attribute 'add' - [1] + $ hg evolve --any --all --config ui.interactive=True <<EOF + > 0 + > EOF + move:[2] added b + atop:[5] added a + move:[4] merge commit + atop:[8] added b + ancestor '7235ef625ea3' split over multiple topological branches. + choose an evolve destination: + 0: [62fb70414f99] added c + 1: [5841d7cf9893] added d + q: quit the prompt + enter the index of the revision you want to select: 0 + move:[9] merge commit + atop:[6] added c + working directory is now at 28a0775ac832 + + $ hg glog + @ 10:28a0775ac832 merge commit + |\ () draft + | o 8:2baf8bae7ea4 added b + | | () draft + | | o 7:5841d7cf9893 added d + | | | () draft + o---+ 6:62fb70414f99 added c + / / () draft + o / 5:7014ec2829cd added a + |/ () draft + o 0:bde1d2b6b5e5 added base + () draft