Mercurial > evolve
changeset 4491:bdaf34903430
branching: merge with stable
merge with new changeset on stable.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 10 Apr 2019 16:59:58 +0200 |
parents | 7a5c6109ee84 (current diff) 099e0ca8285e (diff) |
children | 91e0d05e06c6 |
files | CHANGELOG hgext3rd/evolve/cmdrewrite.py hgext3rd/evolve/evolvecmd.py tests/test-grab.t tests/test-pick.t tests/test-sharing.t |
diffstat | 7 files changed, 498 insertions(+), 341 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGELOG Wed Apr 10 16:59:28 2019 +0200 +++ b/CHANGELOG Wed Apr 10 16:59:58 2019 +0200 @@ -20,6 +20,9 @@ * touch: fix error message when touching public changesets * evolve: make sure the extensions are only active on repository that enables it. Double check your server configuration (issue6057) + * evolve: make sure divergence resolution don't replace the initial author + (issue6113) + * pick: align working dir branch with the one from the pick result (issue6089) 8.4.0 -- 2019-12-22 -------------------
--- a/hgext3rd/evolve/cmdrewrite.py Wed Apr 10 16:59:28 2019 +0200 +++ b/hgext3rd/evolve/cmdrewrite.py Wed Apr 10 16:59:58 2019 +0200 @@ -1467,6 +1467,7 @@ newnode = repo.commit(text=origctx.description(), user=origctx.user(), date=origctx.date(), extra=origctx.extra()) + repo.dirstate.setbranch(origctx.branch()) if pickstate: pickstate.delete()
--- a/hgext3rd/evolve/evolvecmd.py Wed Apr 10 16:59:28 2019 +0200 +++ b/hgext3rd/evolve/evolvecmd.py Wed Apr 10 16:59:58 2019 +0200 @@ -652,7 +652,7 @@ mergehook(repo, base, divergent, other) - newnode = repo.commit(text=desc, user=repo.ui.username()) + newnode = repo.commit(text=desc, user=other.user()) if newnode == divergent.node() or newnode is None: # no changes new = divergent
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-evolve-content-divergence-meta.t Wed Apr 10 16:59:58 2019 +0200 @@ -0,0 +1,102 @@ ++==================================================== ++Tests the resolution of content divergence: metadata ++==================================================== + +This file intend to cover cases focused around meta data merging. + +Setup +----- + + $ cat >> $HGRCPATH <<EOF + > [alias] + > glog = log -GT "{rev}:{node|short} {desc|firstline}\n {phase} {troubles}\n\n" + > [phases] + > publish = False + > [extensions] + > rebase = + > EOF + $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH + +Check we preserve the author properly +------------------------------------- + +Testing issue6113 to make sure that content-divergence resolution don't +replace initial author with the user running the resolution command: + + $ hg init userfoo + $ cd userfoo + $ unset HGUSER + $ echo "[ui]" >> ./.hg/hgrc + $ echo "username = foo <foo@test.com>" >> ./.hg/hgrc + $ for ch in a b c; do + > echo $ch > $ch; + > hg add $ch; + > hg ci -m "added "$ch; + > done; + + $ cd .. + $ hg init userbar + $ cd userbar + $ unset HGUSER + $ echo "[ui]" >> ./.hg/hgrc + $ echo "username = bar <bar@test.com>" >> ./.hg/hgrc + $ hg pull ./../userfoo -q + + $ cd ../userfoo + $ hg up -r "desc('added b')" + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ echo c > c + $ echo e > e + $ hg add c e + $ hg ci -m "added c e" + created new head + + $ hg up -r "desc('added b')" + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ echo cc > c + $ hg add c + $ hg ci -m "added c" + created new head + + $ hg prune -r "min(desc('added c'))" -s "desc('added c e')" + 1 changesets pruned + $ hg prune -r "min(desc('added c'))" -s "max(desc('added c'))" --hidden + 1 changesets pruned + 2 new content-divergent changesets + + $ hg glog + @ 4:6c06cda6dc99 added c + | draft content-divergent + | + | * 3:0c9267e23c9d added c e + |/ draft content-divergent + | + o 1:1740ad2a1eda added b + | draft + | + o 0:f863f39764c4 added a + draft + + + $ cd ../userbar + $ hg pull ./../userfoo -q + 2 new content-divergent changesets + + $ hg evolve --content-divergent --any + merge:[3] added c e + with: [4] added c + base: [2] added c + updating to "local" side of the conflict: 0c9267e23c9d + merging "other" content-divergent changeset '6c06cda6dc99' + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + working directory is now at 443bd2972210 + +Make sure resultant cset don't replace the initial user with user running the command: + $ hg log -r tip + changeset: 5:443bd2972210 + tag: tip + parent: 1:1740ad2a1eda + user: foo <foo@test.com> + date: Thu Jan 01 00:00:00 1970 +0000 + summary: added c e +
--- a/tests/test-grab.t Wed Apr 10 16:59:28 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,337 +0,0 @@ -Test for the grab command - - $ cat >> $HGRCPATH <<EOF - > [alias] - > glog = log -G -T "{rev}:{node|short} {desc}\n" - > [extensions] - > EOF - $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH - - $ mkcommit() { - > echo "$1" > "$1" - > hg add "$1" - > hg ci -m "add $1" - > } - - $ hg init repo - $ cd repo - $ hg help grab - hg pick [-r] rev - - aliases: grab - - move a commit on the top of working directory parent and updates to it. - - options: - - -r --rev REV revision to pick - -c --continue continue interrupted pick - -a --abort abort interrupted pick - -t --tool TOOL specify merge tool - - (some details hidden, use --verbose to show complete help) - - $ mkcommit a - $ mkcommit b - $ mkcommit c - - $ hg glog - @ 2:4538525df7e2 add c - | - o 1:7c3bad9141dc add b - | - o 0:1f0dee641bb7 add a - - -Grabbing an ancestor - - $ hg pick -r 7c3bad9141dc - abort: cannot pick an ancestor revision - [255] - -Grabbing the working directory parent - - $ hg pick -r . - abort: cannot pick an ancestor revision - [255] - -Specifying multiple revisions to grab - - $ hg pick 1f0dee641bb7 -r 7c3bad9141dc - abort: specify just one revision - [255] - -Specifying no revisions to grab - - $ hg pick - abort: empty revision set - [255] - -Continuing without interrupted grab - - $ hg pick --continue - abort: no interrupted pick state exists - [255] - -Aborting without interrupted grab - - $ hg pick --abort - abort: no interrupted pick state exists - [255] - -Specifying both continue and revs - - $ hg up 1f0dee641bb7 - 0 files updated, 0 files merged, 2 files removed, 0 files unresolved - $ hg pick -r 4538525df7e2 --continue - abort: cannot specify both --continue and revision - [255] - -Making new branch heads - - $ mkcommit x - created new head - $ mkcommit y - - $ hg glog - @ 4:d46dc301d92f add y - | - o 3:8e224524cd09 add x - | - | o 2:4538525df7e2 add c - | | - | o 1:7c3bad9141dc add b - |/ - o 0:1f0dee641bb7 add a - -Grabbing a revision - - $ hg pick 7c3bad9141dc - picking 1:7c3bad9141dc "add b" - 1 new orphan changesets - $ hg glog - @ 5:7c15c05db6fa add b - | - o 4:d46dc301d92f add y - | - o 3:8e224524cd09 add x - | - | * 2:4538525df7e2 add c - | | - | x 1:7c3bad9141dc add b - |/ - o 0:1f0dee641bb7 add a - - -When grab does not create any changes - - $ hg graft -r 4538525df7e2 - grafting 2:4538525df7e2 "add c" - - $ hg glog - @ 6:c4636a81ebeb add c - | - o 5:7c15c05db6fa add b - | - o 4:d46dc301d92f add y - | - o 3:8e224524cd09 add x - | - | * 2:4538525df7e2 add c - | | - | x 1:7c3bad9141dc add b - |/ - o 0:1f0dee641bb7 add a - - $ hg pick -r 4538525df7e2 - picking 2:4538525df7e2 "add c" - note: picking 2:4538525df7e2 created no changes to commit - - $ hg glog - @ 6:c4636a81ebeb add c - | - o 5:7c15c05db6fa add b - | - o 4:d46dc301d92f add y - | - o 3:8e224524cd09 add x - | - o 0:1f0dee641bb7 add a - -interrupted grab - - $ hg up d46dc301d92f - 0 files updated, 0 files merged, 2 files removed, 0 files unresolved - $ echo foo > c - $ hg ci -Aqm "foo to c" - $ hg pick -r c4636a81ebeb - picking 6:c4636a81ebeb "add c" - merging c - warning: conflicts while merging c! (edit, then use 'hg resolve --mark') - unresolved merge conflicts (see hg help resolve) - [1] - - $ echo foobar > c - $ hg resolve --all --mark - (no more unresolved files) - continue: hg pick --continue - $ hg pick --continue - $ hg glog - @ 8:44e155eb95c7 add c - | - o 7:2ccc03d1d096 foo to c - | - | o 5:7c15c05db6fa add b - |/ - o 4:d46dc301d92f add y - | - o 3:8e224524cd09 add x - | - o 0:1f0dee641bb7 add a - - -When interrupted grab results in no changes to commit - - $ hg up d46dc301d92f - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ echo bar > c - $ hg add c - $ hg ci -m "foo to c" - created new head - - $ hg up 44e155eb95c7 - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - - $ hg pick 4e04628911f6 - picking 9:4e04628911f6 "foo to c" - merging c - warning: conflicts while merging c! (edit, then use 'hg resolve --mark') - unresolved merge conflicts (see hg help resolve) - [1] - $ echo foobar > c - $ hg resolve -m - (no more unresolved files) - continue: hg pick --continue - - $ hg pick --continue - note: picking 9:4e04628911f6 created no changes to commit - -Testing the abort functionality of hg pick - - $ echo foo > b - $ hg ci -Aqm "foo to b" - $ hg glog -r .^:: - @ 10:c437988de89f foo to b - | - o 8:44e155eb95c7 add c - | - ~ - - $ hg pick -r 7c15c05db6fa - picking 5:7c15c05db6fa "add b" - merging b - warning: conflicts while merging b! (edit, then use 'hg resolve --mark') - unresolved merge conflicts (see hg help resolve) - [1] - - $ hg pick --abort - aborting pick, updating to c437988de89f - - $ hg glog - @ 10:c437988de89f foo to b - | - o 8:44e155eb95c7 add c - | - o 7:2ccc03d1d096 foo to c - | - | o 5:7c15c05db6fa add b - |/ - o 4:d46dc301d92f add y - | - o 3:8e224524cd09 add x - | - o 0:1f0dee641bb7 add a - - -Trying to grab a public changeset - - $ hg phase -r 7c15c05db6fa -p - - $ hg pick -r 7c15c05db6fa - abort: cannot pick public changesets: 7c15c05db6fa - (see 'hg help phases' for details) - [255] - - $ hg glog - @ 10:c437988de89f foo to b - | - o 8:44e155eb95c7 add c - | - o 7:2ccc03d1d096 foo to c - | - | o 5:7c15c05db6fa add b - |/ - o 4:d46dc301d92f add y - | - o 3:8e224524cd09 add x - | - o 0:1f0dee641bb7 add a - -Checking phase preservation while grabbing secret changeset - -In case of merge conflicts - - $ hg phase -r 7c15c05db6fa -s -f - - $ hg pick -r 7c15c05db6fa - picking 5:7c15c05db6fa "add b" - merging b - warning: conflicts while merging b! (edit, then use 'hg resolve --mark') - unresolved merge conflicts (see hg help resolve) - [1] - - $ echo bar > b - $ hg resolve -m - (no more unresolved files) - continue: hg pick --continue - - $ hg pick --continue - $ hg phase -r . - 11: secret - -No merge conflicts - - $ hg up d46dc301d92f - 0 files updated, 0 files merged, 3 files removed, 0 files unresolved - $ echo foo > l - $ hg add l - $ hg ci -qm "added l" --secret - - $ hg phase -r . - 12: secret - - $ hg glog - @ 12:508d572e7053 added l - | - | o 11:10427de9e26e add b - | | - | o 10:c437988de89f foo to b - | | - | o 8:44e155eb95c7 add c - | | - | o 7:2ccc03d1d096 foo to c - |/ - o 4:d46dc301d92f add y - | - o 3:8e224524cd09 add x - | - o 0:1f0dee641bb7 add a - - $ hg up 10427de9e26e - 3 files updated, 0 files merged, 1 files removed, 0 files unresolved - - $ hg pick -r 508d572e7053 - picking 12:508d572e7053 "added l" - - $ hg phase -r . - 13: secret
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-pick.t Wed Apr 10 16:59:58 2019 +0200 @@ -0,0 +1,388 @@ +Test for the pick command + + $ cat >> $HGRCPATH <<EOF + > [alias] + > glog = log -G -T "{rev}:{node|short} {desc}\n" + > [extensions] + > EOF + $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH + + $ mkcommit() { + > echo "$1" > "$1" + > hg add "$1" + > hg ci -m "add $1" + > } + + $ hg init repo + $ cd repo + $ hg help pick + hg pick [-r] rev + + aliases: grab + + move a commit on the top of working directory parent and updates to it. + + options: + + -r --rev REV revision to pick + -c --continue continue interrupted pick + -a --abort abort interrupted pick + -t --tool TOOL specify merge tool + + (some details hidden, use --verbose to show complete help) + + $ mkcommit a + $ mkcommit b + $ mkcommit c + + $ hg glog + @ 2:4538525df7e2 add c + | + o 1:7c3bad9141dc add b + | + o 0:1f0dee641bb7 add a + + +Grabbing an ancestor + + $ hg pick -r 7c3bad9141dc + abort: cannot pick an ancestor revision + [255] + +Grabbing the working directory parent + + $ hg pick -r . + abort: cannot pick an ancestor revision + [255] + +Specifying multiple revisions to pick + + $ hg pick 1f0dee641bb7 -r 7c3bad9141dc + abort: specify just one revision + [255] + +Specifying no revisions to pick + + $ hg pick + abort: empty revision set + [255] + +Continuing without interrupted pick + + $ hg pick --continue + abort: no interrupted pick state exists + [255] + +Aborting without interrupted pick + + $ hg pick --abort + abort: no interrupted pick state exists + [255] + +Specifying both continue and revs + + $ hg up 1f0dee641bb7 + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ hg pick -r 4538525df7e2 --continue + abort: cannot specify both --continue and revision + [255] + +Making new branch heads + + $ mkcommit x + created new head + $ mkcommit y + + $ hg glog + @ 4:d46dc301d92f add y + | + o 3:8e224524cd09 add x + | + | o 2:4538525df7e2 add c + | | + | o 1:7c3bad9141dc add b + |/ + o 0:1f0dee641bb7 add a + +Grabbing a revision + + $ hg pick 7c3bad9141dc + picking 1:7c3bad9141dc "add b" + 1 new orphan changesets + $ hg glog + @ 5:7c15c05db6fa add b + | + o 4:d46dc301d92f add y + | + o 3:8e224524cd09 add x + | + | * 2:4538525df7e2 add c + | | + | x 1:7c3bad9141dc add b + |/ + o 0:1f0dee641bb7 add a + + +When pick does not create any changes + + $ hg graft -r 4538525df7e2 + grafting 2:4538525df7e2 "add c" + + $ hg glog + @ 6:c4636a81ebeb add c + | + o 5:7c15c05db6fa add b + | + o 4:d46dc301d92f add y + | + o 3:8e224524cd09 add x + | + | * 2:4538525df7e2 add c + | | + | x 1:7c3bad9141dc add b + |/ + o 0:1f0dee641bb7 add a + + $ hg pick -r 4538525df7e2 + picking 2:4538525df7e2 "add c" + note: picking 2:4538525df7e2 created no changes to commit + + $ hg glog + @ 6:c4636a81ebeb add c + | + o 5:7c15c05db6fa add b + | + o 4:d46dc301d92f add y + | + o 3:8e224524cd09 add x + | + o 0:1f0dee641bb7 add a + +interrupted pick + + $ hg up d46dc301d92f + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ echo foo > c + $ hg ci -Aqm "foo to c" + $ hg pick -r c4636a81ebeb + picking 6:c4636a81ebeb "add c" + merging c + warning: conflicts while merging c! (edit, then use 'hg resolve --mark') + unresolved merge conflicts (see hg help resolve) + [1] + + $ echo foobar > c + $ hg resolve --all --mark + (no more unresolved files) + continue: hg pick --continue + $ hg pick --continue + $ hg glog + @ 8:44e155eb95c7 add c + | + o 7:2ccc03d1d096 foo to c + | + | o 5:7c15c05db6fa add b + |/ + o 4:d46dc301d92f add y + | + o 3:8e224524cd09 add x + | + o 0:1f0dee641bb7 add a + + +When interrupted pick results in no changes to commit + + $ hg up d46dc301d92f + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ echo bar > c + $ hg add c + $ hg ci -m "foo to c" + created new head + + $ hg up 44e155eb95c7 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ hg pick 4e04628911f6 + picking 9:4e04628911f6 "foo to c" + merging c + warning: conflicts while merging c! (edit, then use 'hg resolve --mark') + unresolved merge conflicts (see hg help resolve) + [1] + $ echo foobar > c + $ hg resolve -m + (no more unresolved files) + continue: hg pick --continue + + $ hg pick --continue + note: picking 9:4e04628911f6 created no changes to commit + +Testing the abort functionality of hg pick + + $ echo foo > b + $ hg ci -Aqm "foo to b" + $ hg glog -r .^:: + @ 10:c437988de89f foo to b + | + o 8:44e155eb95c7 add c + | + ~ + + $ hg pick -r 7c15c05db6fa + picking 5:7c15c05db6fa "add b" + merging b + warning: conflicts while merging b! (edit, then use 'hg resolve --mark') + unresolved merge conflicts (see hg help resolve) + [1] + + $ hg pick --abort + aborting pick, updating to c437988de89f + + $ hg glog + @ 10:c437988de89f foo to b + | + o 8:44e155eb95c7 add c + | + o 7:2ccc03d1d096 foo to c + | + | o 5:7c15c05db6fa add b + |/ + o 4:d46dc301d92f add y + | + o 3:8e224524cd09 add x + | + o 0:1f0dee641bb7 add a + + +Trying to pick a public changeset + + $ hg phase -r 7c15c05db6fa -p + + $ hg pick -r 7c15c05db6fa + abort: cannot pick public changesets: 7c15c05db6fa + (see 'hg help phases' for details) + [255] + + $ hg glog + @ 10:c437988de89f foo to b + | + o 8:44e155eb95c7 add c + | + o 7:2ccc03d1d096 foo to c + | + | o 5:7c15c05db6fa add b + |/ + o 4:d46dc301d92f add y + | + o 3:8e224524cd09 add x + | + o 0:1f0dee641bb7 add a + +Checking phase preservation while picking secret changeset + +In case of merge conflicts + + $ hg phase -r 7c15c05db6fa -s -f + + $ hg pick -r 7c15c05db6fa + picking 5:7c15c05db6fa "add b" + merging b + warning: conflicts while merging b! (edit, then use 'hg resolve --mark') + unresolved merge conflicts (see hg help resolve) + [1] + + $ echo bar > b + $ hg resolve -m + (no more unresolved files) + continue: hg pick --continue + + $ hg pick --continue + $ hg phase -r . + 11: secret + +No merge conflicts + + $ hg up d46dc301d92f + 0 files updated, 0 files merged, 3 files removed, 0 files unresolved + $ echo foo > l + $ hg add l + $ hg ci -qm "added l" --secret + + $ hg phase -r . + 12: secret + + $ hg glog + @ 12:508d572e7053 added l + | + | o 11:10427de9e26e add b + | | + | o 10:c437988de89f foo to b + | | + | o 8:44e155eb95c7 add c + | | + | o 7:2ccc03d1d096 foo to c + |/ + o 4:d46dc301d92f add y + | + o 3:8e224524cd09 add x + | + o 0:1f0dee641bb7 add a + + $ hg up 10427de9e26e + 3 files updated, 0 files merged, 1 files removed, 0 files unresolved + + $ hg pick -r 508d572e7053 + picking 12:508d572e7053 "added l" + + $ hg phase -r . + 13: secret + $ cd .. + +Check pick behavior regarding working copy branch (issue6089) +------------------------------------------------------------- + +The branch of the picked changeset should be preserved, and the working copy updated + + $ hg init issue6089 + $ cd issue6089 + + $ touch a + $ hg add a + $ hg ci -m 'first commit on default' + + $ hg branch foo + marked working directory as branch foo + (branches are permanent and global, did you want a bookmark?) + $ touch b + $ hg add b + $ hg ci -m 'first commit on foo' + + $ hg up default + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ echo test > a + $ hg ci -m 'second commit on default' + $ hg log -G --template '{node|short}: {branch}\n' --rev 'all()+wdir()' + o ffffffffffff: default + | + @ 5f07cbf7d111: default + | + | o 96bb2057779e: foo + |/ + o d03a6bcc83cd: default + + + $ hg pick 1 + picking 1:96bb2057779e "first commit on foo" + $ hg log --template '{branch}\n' -r tip + foo + $ hg branch + foo + $ hg log -G --template '{node|short}: {branch}\n' --rev 'all()+wdir()' + o ffffffffffff: foo + | + @ 5344a77549bd: foo + | + o 5f07cbf7d111: default + | + o d03a6bcc83cd: default + + $ cd ..
--- a/tests/test-sharing.t Wed Apr 10 16:59:28 2019 +0200 +++ b/tests/test-sharing.t Wed Apr 10 16:59:58 2019 +0200 @@ -518,12 +518,12 @@ base: [4] fix bug 24 (v1) merging "other" content-divergent changeset 'e3f99ce9d9cd' 0 files updated, 1 files merged, 0 files removed, 0 files unresolved - working directory is now at 711ede2d7a26 + working directory is now at b1499b0f03ca $ hg log -q -r 'contentdivergent()' Figure SG10: Bob's repository after fixing divergence. $ hg --hidden shortlog -G -r 3:: - @ 7:711ede2d7a26 draft fix bug 24 (v2 by bob) + @ 7:b1499b0f03ca draft fix bug 24 (v2 by bob) | | x 6:e3f99ce9d9cd draft fix bug 24 (v2 by alice) |/ @@ -534,7 +534,7 @@ o 3:a06ec1bf97bd public fix bug 15 (v2) | ~ - $ hg --hidden shortlog -r 'precursors(711ede2d7a26)' + $ hg --hidden shortlog -r 'precursors(b1499b0f03ca)' 5:a360947f6faf draft fix bug 24 (v2 by bob) 6:e3f99ce9d9cd draft fix bug 24 (v2 by alice) $ cat file1