Mercurial > evolve
changeset 5029:421b295e32b4
evolve: add logic to cover --stop when "divergent" relocation in play
Changes in test file reflect the added behaviour. The intermediate changeset has
been properly cleaned up by the `hg evolve --stop` call.
author | Sushil khanchi <sushilkhanchi97@gmail.com> |
---|---|
date | Thu, 28 Nov 2019 19:01:28 +0530 |
parents | 109889c7d02d |
children | 1403cc7c2cee |
files | hgext3rd/evolve/evolvecmd.py tests/test-evolve-content-divergent-stack.t |
diffstat | 2 files changed, 47 insertions(+), 58 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py Thu Nov 28 17:58:45 2019 +0530 +++ b/hgext3rd/evolve/evolvecmd.py Thu Nov 28 19:01:28 2019 +0530 @@ -326,6 +326,7 @@ # in case or relocation we get a new other node, we need to store the old # other for purposes like `--abort` or `--stop` evolvestate[b'old-other'] = None + evolvestate[b'old-divergent'] = None base, others = divergentdata(divergent) # we don't handle split in content-divergence yet @@ -519,6 +520,7 @@ with state.saver(evolvestate, {b'current': divergent.node()}): newdivergent = _relocate(repo, divergent, repo[succsdivp1], evolvestate, keepbranch=True) + evolvestate[b'old-divergent'] = divergent.node() divergent = repo[newdivergent] evolvestate[b'relocating-div'] = False evolvestate[b'relocated-div'] = divergent.node() @@ -1839,15 +1841,29 @@ """logic for handling of `hg evolve --stop`""" updated = False pctx = None + divrelocated = evolvestate.get(b'relocated-div') + otherrelocated = evolvestate.get(b'relocated-other') + strips = [] + if divrelocated: + strips.append(divrelocated) + if otherrelocated: + strips.append(otherrelocated) if (evolvestate[b'command'] == b'evolve' and evolvestate[b'category'] == b'contentdivergent' - and evolvestate[b'relocated-other']): + and strips): oldother = evolvestate[b'old-other'] - if oldother: + olddiv = evolvestate[b'old-divergent'] + if olddiv: + with repo.wlock(), repo.lock(): + repo = repo.unfiltered() + hg.updaterepo(repo, olddiv, True) + repair.strip(ui, repo, strips, False) + updated = True + pctx = repo[olddiv] + elif oldother: with repo.wlock(), repo.lock(): repo = repo.unfiltered() hg.updaterepo(repo, oldother, True) - strips = [evolvestate[b'relocated-other']] repair.strip(ui, repo, strips, False) updated = True pctx = repo[oldother] @@ -2026,6 +2042,7 @@ current = repo[evolvestate[b'current']] obsolete.createmarkers(repo, [(current, (repo[newdiv],))], operation=b'evolve') + evolvestate[b'old-divergent'] = repo[divergent].node() evolvestate[b'relocating-div'] = False evolvestate[b'relocated-div'] = newdiv evolvestate[b'temprevs'].append(newdiv) @@ -2049,7 +2066,7 @@ evolvestate[b'other-divergent'] = other.node() # continue the resolution by merging the content-divergence _mergecontentdivergents(repo, progresscb, - repo[divergent], + divergent, repo[newother], repo[base], evolvestate)
--- a/tests/test-evolve-content-divergent-stack.t Thu Nov 28 17:58:45 2019 +0530 +++ b/tests/test-evolve-content-divergent-stack.t Thu Nov 28 19:01:28 2019 +0530 @@ -589,18 +589,12 @@ [1] $ hg evolve --stop - 1 new orphan changesets + 2 new orphan changesets stopped the interrupted evolve - working directory is now at 509103439e5e + working directory is now at 2a955e808c53 $ hg log -G - * changeset: 22:a93be2347074 + o changeset: 21:74fbf3e6a0b6 | tag: tip - | user: test - | date: Thu Jan 01 00:00:00 1970 +0000 - | instability: content-divergent - | summary: added b - | - o changeset: 21:74fbf3e6a0b6 | parent: 9:2228e3b74514 | user: test | date: Thu Jan 01 00:00:00 1970 +0000 @@ -618,7 +612,7 @@ | | instability: orphan, content-divergent | | summary: added c | | - | @ changeset: 17:509103439e5e + | * changeset: 17:509103439e5e | | parent: 5:8e222f257bbf | | user: test | | date: Thu Jan 01 00:00:00 1970 +0000 @@ -637,11 +631,11 @@ | | | instability: orphan, content-divergent | | | summary: added c | | | - | | x changeset: 14:2a955e808c53 + | | @ changeset: 14:2a955e808c53 | | | parent: 10:c04ff147ef79 | | | user: test | | | date: Thu Jan 01 00:00:00 1970 +0000 - | | | obsolete: rebased using evolve as 22:a93be2347074 + | | | instability: orphan, content-divergent | | | summary: added b | | | +---x changeset: 10:c04ff147ef79 @@ -685,18 +679,15 @@ rewritten(parent) as c04ff147ef79 using rebase by test (Thu Jan 01 00:00:00 1970 +0000) $ hg obslog -r 'desc("added b")' --all - @ 509103439e5e (17) added b + @ 2a955e808c53 (14) added b | - | * a93be2347074 (22) added b + | * 509103439e5e (17) added b | | - | x 2a955e808c53 (14) added b - | | rewritten(parent) as a93be2347074 using evolve by test (Thu Jan 01 00:00:00 1970 +0000) + x | 6eb54b5af3fb (11) added b + | | rewritten(content) as 2a955e808c53 using amend by test (Thu Jan 01 00:00:00 1970 +0000) | | - x | d5f148423c16 (6) added b - | | rewritten(content) as 509103439e5e using amend by test (Thu Jan 01 00:00:00 1970 +0000) - | | - | x 6eb54b5af3fb (11) added b - |/ rewritten(content) as 2a955e808c53 using amend by test (Thu Jan 01 00:00:00 1970 +0000) + | x d5f148423c16 (6) added b + |/ rewritten(content) as 509103439e5e using amend by test (Thu Jan 01 00:00:00 1970 +0000) | x b1661037fa25 (2) added b rewritten(parent) as 6eb54b5af3fb using rebase by test (Thu Jan 01 00:00:00 1970 +0000) @@ -705,17 +696,10 @@ Again, let's evolve the stack $ hg evolve --content-divergent - skipping 48b0f803817a: have a different parent than eaf34afe4df3 (not handled yet) - | 48b0f803817a, eaf34afe4df3 are not based on the same changeset. - | With the current state of its implementation, - | evolve does not work in that case. - | rebase one of them next to the other and run - | this command again. - | - either: hg rebase --dest 'p1(48b0f803817a)' -r eaf34afe4df3 - | - or: hg rebase --dest 'p1(eaf34afe4df3)' -r 48b0f803817a - merge:[22] added b + merge:[14] added b with: [17] added b base: [2] added b + rebasing "divergent" content-divergent changeset 2a955e808c53 on 74fbf3e6a0b6 rebasing "other" content-divergent changeset 509103439e5e on 74fbf3e6a0b6 merging b warning: conflicts while merging b! (edit, then use 'hg resolve --mark') @@ -729,33 +713,21 @@ (no more unresolved files) continue: hg evolve --continue $ hg evolve --continue - skipping 91c8ccb9c241: have a different parent than c351be27f199 (not handled yet) - | 91c8ccb9c241, c351be27f199 are not based on the same changeset. - | With the current state of its implementation, - | evolve does not work in that case. - | rebase one of them next to the other and run - | this command again. - | - either: hg rebase --dest 'p1(91c8ccb9c241)' -r c351be27f199 - | - or: hg rebase --dest 'p1(c351be27f199)' -r 91c8ccb9c241 + merge:[15] added c + with: [18] added c + base: [3] added c + rebasing "divergent" content-divergent changeset 48b0f803817a on 4e29776e83a5 + rebasing "other" content-divergent changeset eaf34afe4df3 on 4e29776e83a5 + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + merge:[16] added d + with: [19] added d + base: [4] added d + rebasing "divergent" content-divergent changeset 91c8ccb9c241 on 77126af93a25 + rebasing "other" content-divergent changeset c351be27f199 on 77126af93a25 + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved working directory is now at 4e29776e83a5 $ hg evolve -l - 48b0f803817a: added c - orphan: 2a955e808c53 (obsolete parent) - content-divergent: eaf34afe4df3 (draft) (precursor ca1b80f7960a) - - 91c8ccb9c241: added d - orphan: 48b0f803817a (orphan parent) - content-divergent: c351be27f199 (draft) (precursor c41c793e0ef1) - - eaf34afe4df3: added c - orphan: 509103439e5e (obsolete parent) - content-divergent: 48b0f803817a (draft) (precursor ca1b80f7960a) - - c351be27f199: added d - orphan: eaf34afe4df3 (orphan parent) - content-divergent: 91c8ccb9c241 (draft) (precursor c41c793e0ef1) - $ cd ..