diff --git a/tests/test-copytrace-heuristics.t b/tests/test-copytrace-heuristics.t --- a/tests/test-copytrace-heuristics.t +++ b/tests/test-copytrace-heuristics.t @@ -825,3 +825,156 @@ $ cd .. $ rm -rf repo +Test which demonstrate that fullcopytracing algorithm can fail to handle a case when both the csets are dirty +---------------------------------------------------------------------------------------------------------- + + $ hg init repo + $ cd repo + $ echo a > a + $ hg add a + $ hg ci -m "added a" + $ echo b > b + $ hg add b + $ hg ci -m "added b" + + $ echo foobar > willconflict + $ hg add willconflict + $ hg ci -m "added willconflict" + $ echo c > c + $ hg add c + $ hg ci -m "added c" + + $ hg log -G -T '{rev} : {node|short} {desc} \n{phase}\n' + @ 3 : 9a8bb7cc6814 added c + | draft + o 2 : d2ea38baf44e added willconflict + | draft + o 1 : 5f6d8a4bf34a added b + | draft + o 0 : 9092f1db7931 added a + draft + + $ hg up .^^ + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ echo d > d + $ hg add d + $ hg ci -m "added d" + created new head + + $ echo barfoo > willconflict + $ hg add willconflict + $ hg ci --amend -m "added willconflict and d" + + $ hg log -G -T '{rev} : {node|short} {desc} \n{phase}\n' + @ 5 : 5018b1509e94 added willconflict and d + | draft + | o 3 : 9a8bb7cc6814 added c + | | draft + | o 2 : d2ea38baf44e added willconflict + |/ draft + o 1 : 5f6d8a4bf34a added b + | draft + o 0 : 9092f1db7931 added a + draft + + $ hg rebase -r . -d 2 + rebasing 5:5018b1509e94 "added willconflict and d" (tip) + merging willconflict + warning: conflicts while merging willconflict! (edit, then use 'hg resolve --mark') + unresolved conflicts (see hg resolve, then hg rebase --continue) + [1] + + $ hg diff + diff -r d2ea38baf44e d + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/d Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +d + diff -r d2ea38baf44e willconflict + --- a/willconflict Thu Jan 01 00:00:00 1970 +0000 + +++ b/willconflict Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,5 @@ + +<<<<<<< dest: d2ea38baf44e - test: added willconflict + foobar + +======= + +barfoo + +>>>>>>> source: 5018b1509e94 - test: added willconflict and d + + $ echo barfoo > willconflict + $ hg resolve -m + (no more unresolved files) + continue: hg rebase --continue + $ hg rebase --continue + rebasing 5:5018b1509e94 "added willconflict and d" (tip) + + $ hg up 3 -q + + $ hg log -G --hidden -T '{rev} : {node|short} {desc} \n{phase}\n' + o 6 : 99802e4f1e46 added willconflict and d + | draft + | x 5 : 5018b1509e94 added willconflict and d + | | draft + | | x 4 : c9241b0f2d5b added d + | |/ draft + +---@ 3 : 9a8bb7cc6814 added c + | | draft + o | 2 : d2ea38baf44e added willconflict + |/ draft + o 1 : 5f6d8a4bf34a added b + | draft + o 0 : 9092f1db7931 added a + draft + +Now if we trigger a merge between cset revision 3 and 6 using base revision 4, in this case +both the merging csets will be dirty as no one is descendent of base revision: + + $ hg graft -r 6 --base c9241b0f2d5b --hidden + grafting 6:99802e4f1e46 "added willconflict and d" (tip) + ** unknown exception encountered, please report by visiting + ** https://mercurial-scm.org/wiki/BugTracker + ** Python 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609] + ** Mercurial Distributed SCM (version 4.8.1+539-b6c610bf567e+20181221) + ** Extensions loaded: rebase, shelve + Traceback (most recent call last): + File "/home/khanchi/hg/hg-committed/hg", line 43, in + dispatch.run() + File "/home/khanchi/hg/hg-committed/mercurial/dispatch.py", line 99, in run + status = dispatch(req) + File "/home/khanchi/hg/hg-committed/mercurial/dispatch.py", line 225, in dispatch + ret = _runcatch(req) or 0 + File "/home/khanchi/hg/hg-committed/mercurial/dispatch.py", line 376, in _runcatch + return _callcatch(ui, _runcatchfunc) + File "/home/khanchi/hg/hg-committed/mercurial/dispatch.py", line 384, in _callcatch + return scmutil.callcatch(ui, func) + File "/home/khanchi/hg/hg-committed/mercurial/scmutil.py", line 165, in callcatch + return func() + File "/home/khanchi/hg/hg-committed/mercurial/dispatch.py", line 367, in _runcatchfunc + return _dispatch(req) + File "/home/khanchi/hg/hg-committed/mercurial/dispatch.py", line 1021, in _dispatch + cmdpats, cmdoptions) + File "/home/khanchi/hg/hg-committed/mercurial/dispatch.py", line 756, in runcommand + ret = _runcommand(ui, options, cmd, d) + File "/home/khanchi/hg/hg-committed/mercurial/dispatch.py", line 1030, in _runcommand + return cmdfunc() + File "/home/khanchi/hg/hg-committed/mercurial/dispatch.py", line 1018, in + d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) + File "/home/khanchi/hg/hg-committed/mercurial/util.py", line 1676, in check + return func(*args, **kwargs) + File "/home/khanchi/hg/hg-committed/mercurial/commands.py", line 2378, in graft + return _dograft(ui, repo, *revs, **opts) + File "/home/khanchi/hg/hg-committed/mercurial/commands.py", line 2590, in _dograft + stats = mergemod.graft(repo, ctx, base, ['local', 'graft']) + File "/home/khanchi/hg/hg-committed/mercurial/merge.py", line 2234, in graft + mergeancestor=mergeancestor, labels=labels) + File "/home/khanchi/hg/hg-committed/mercurial/merge.py", line 2075, in update + followcopies, matcher=matcher, mergeforce=mergeforce) + File "/home/khanchi/hg/hg-committed/mercurial/merge.py", line 1342, in calculateupdates + acceptremote, followcopies) + File "/home/khanchi/hg/hg-committed/mercurial/merge.py", line 1146, in manifestmerge + ret = copies.mergecopies(repo, wctx, p2, pa) + File "/home/khanchi/hg/hg-committed/mercurial/copies.py", line 416, in mergecopies + return _fullcopytracing(repo, c1, c2, base) + File "/home/khanchi/hg/hg-committed/mercurial/copies.py", line 568, in _fullcopytracing + assert not both2['incomplete'] + AssertionError + [1]