Mercurial > evolve
changeset 550:362e65fc6146 stable
evolve-cmd: fix merge error detection for external tools.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Tue, 11 Sep 2012 11:45:00 +0200 |
parents | b047e9417d96 |
children | 38fbcc760ec6 |
files | hgext/evolve.py tests/test-stabilize-conflict.t |
diffstat | 2 files changed, 261 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/evolve.py Mon Sep 10 18:56:44 2012 +0200 +++ b/hgext/evolve.py Tue Sep 11 11:45:00 2012 +0200 @@ -1232,15 +1232,18 @@ cmdutil.duplicatecopies(repo, orig.node(), dest.node()) nodesrc = orig.node() destphase = repo[nodesrc].phase() - if rebase.rebasenode.func_code.co_argcount == 5: - # rebasenode collapse argument was introduced by - # d1afbf03e69a (2.3) - rebase.rebasenode(repo, orig.node(), dest.node(), - {node.nullrev: node.nullrev}, False) - else: - rebase.rebasenode(repo, orig.node(), dest.node(), - {node.nullrev: node.nullrev}) try: + if rebase.rebasenode.func_code.co_argcount == 5: + # rebasenode collapse argument was introduced by + # d1afbf03e69a (2.3) + r = rebase.rebasenode(repo, orig.node(), dest.node(), + {node.nullrev: node.nullrev}, False) + else: + r = rebase.rebasenode(repo, orig.node(), dest.node(), + {node.nullrev: node.nullrev}) + if r[-1]: #some conflict + raise util.Abort( + 'unresolved merge conflicts (see hg help resolve)') nodenew = rebase.concludenode(repo, orig.node(), dest.node(), node.nullid) except util.Abort, exc:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-stabilize-conflict.t Tue Sep 11 11:45:00 2012 +0200 @@ -0,0 +1,250 @@ +================================================================= +This files test the proper behavior of evo during merge conflict. +================================================================= + +Initial setup + + $ cat >> $HGRCPATH <<EOF + > [ui] + > interactive=false + > merge=internal:merge + > [defaults] + > amend=-d "0 0" + > [merge-tools] + > touch.checkchanged=true + > touch.gui=true + > touch.args=babar + > [extensions] + > hgext.rebase= + > EOF + $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH + + +create a simple repo + + $ hg init repo + $ cd repo + $ cat << EOF > babar + > un + > deux + > trois + > quatre + > cinq + > EOF + $ hg add babar + $ hg commit -m "babar count up to five" + $ cat << EOF >> babar + > six + > sept + > huit + > neuf + > dix + > EOF + $ hg commit -m "babar count up to ten" + $ cat << EOF >> babar + > onze + > douze + > treize + > quatorze + > quinze + > EOF + $ hg commit -m "babar count up to fifteen" + + +proper behavior without conflict +---------------------------------- + + $ hg gdown + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + [1] babar count up to ten + $ sed -i'' 's/huit/height/' babar + $ hg diff + diff -r 9d5daf8bd956 babar + --- a/babar Thu Jan 01 00:00:00 1970 +0000 + +++ b/babar * (glob) + @@ -5,6 +5,6 @@ + cinq + six + sept + -huit + +height + neuf + dix + $ hg amend + 1 new unstable changesets + $ hg evolve + move:[2] babar count up to fifteen + atop:[4] babar count up to ten + merging babar + $ hg resolve -l + $ hg log -G + @ changeset: 5:fd62611d0178 + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: babar count up to fifteen + | + o changeset: 4:83066dedff55 + | parent: 0:29ec1554cfaf + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: babar count up to ten + | + o changeset: 0:29ec1554cfaf + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: babar count up to five + + + +proper behavior with conflict using internal:merge +-------------------------------------------------- + + $ hg gdown + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + [4] babar count up to ten + $ sed -i'' 's/dix/ten/' babar + $ hg diff + diff -r 83066dedff55 babar + --- a/babar Thu Jan 01 00:00:00 1970 +0000 + +++ b/babar * (glob) + @@ -7,4 +7,4 @@ + sept + height + neuf + -dix + +ten + $ hg amend + 1 new unstable changesets + $ hg evolve + move:[5] babar count up to fifteen + atop:[7] babar count up to ten + merging babar + warning: conflicts during merge. + merging babar incomplete! (edit conflicts, then use 'hg resolve --mark') + evolve failed! + fix conflict and run "hg evolve --continue" + abort: unresolved merge conflicts (see hg help resolve) + [255] + $ hg resolve -l + U babar + $ hg log -G + @ changeset: 7:cc96f75eae0b + | tag: tip + | parent: 0:29ec1554cfaf + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: babar count up to ten + | + | @ changeset: 5:fd62611d0178 + | | user: test + | | date: Thu Jan 01 00:00:00 1970 +0000 + | | summary: babar count up to fifteen + | | + | x changeset: 4:83066dedff55 + |/ parent: 0:29ec1554cfaf + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: babar count up to ten + | + o changeset: 0:29ec1554cfaf + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: babar count up to five + +(fix the conflict and continue) + + $ hg revert -r 5 --all + reverting babar + $ sed -i'' 's/dix/ten/' babar + $ hg resolve --all -m + $ hg evolve --continue + grafting revision 5 + $ hg resolve -l + $ hg log -G + @ changeset: 8:ce7ee8fecf30 + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: babar count up to fifteen + | + o changeset: 7:cc96f75eae0b + | parent: 0:29ec1554cfaf + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: babar count up to ten + | + o changeset: 0:29ec1554cfaf + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: babar count up to five + +proper behavior with conflict using an external merge tools +----------------------------------------------------------- + + $ sed -i'' 's/merge=.*/merge=touch/' $HGRCPATH + $ sed -i'' 's/touch.gui=.*/touch.gui=false/' $HGRCPATH + $ hg gdown + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + [7] babar count up to ten + $ sed -i'' 's/ten/zehn/' babar + $ hg diff + diff -r cc96f75eae0b babar + --- a/babar Thu Jan 01 00:00:00 1970 +0000 + +++ b/babar * (glob) + @@ -7,4 +7,4 @@ + sept + height + neuf + -ten + +zehn + $ hg amend + 1 new unstable changesets + $ sed -i'' 's/interactive=.*/interactive=true/' $HGRCPATH + $ yes n 2> ../shutup | HGMERGE=touch hg evolve + move:[8] babar count up to fifteen + atop:[10] babar count up to ten + merging babar + output file babar appears unchanged + was merge successful (yn)? merging babar failed! + evolve failed! + fix conflict and run "hg evolve --continue" + abort: unresolved merge conflicts (see hg help resolve) + [255] + $ hg resolve -l + U babar + $ hg log -G + @ changeset: 10:02c637e61375 + | tag: tip + | parent: 0:29ec1554cfaf + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: babar count up to ten + | + | @ changeset: 8:ce7ee8fecf30 + | | user: test + | | date: Thu Jan 01 00:00:00 1970 +0000 + | | summary: babar count up to fifteen + | | + | x changeset: 7:cc96f75eae0b + |/ parent: 0:29ec1554cfaf + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: babar count up to ten + | + o changeset: 0:29ec1554cfaf + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: babar count up to five + + $ cat babar + un + deux + trois + quatre + cinq + six + sept + height + neuf + zehn