changeset 1428:20a3b0b27bfe

evolve: raise MultipleSuccessorsError when computing dependency for split commits We don't know how to handle dependency for split commits yet. When facing a splitted commit, instead of silently adding the first successor to the dependency list and fail later, we do nothing.
author Laurent Charignon <lcharignon@fb.com>
date Mon, 22 Jun 2015 12:44:21 -0700
parents fcc467ca740e
children c3a50e54b25d
files hgext/evolve.py tests/test-evolve-split.t tests/test-evolve.t
diffstat 3 files changed, 120 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py	Tue Jun 23 15:26:51 2015 -0700
+++ b/hgext/evolve.py	Mon Jun 22 12:44:21 2015 -0700
@@ -1370,7 +1370,7 @@
                  obs)
         obs = obs.parents()[0]
         newer = obsolete.successorssets(repo, obs.node())
-    if len(newer) > 1:
+    if len(newer) > 1 or len(newer[0]) > 1:
         raise MultipleSuccessorsError(newer)
 
     return repo[newer[0][0]].rev()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-split.t	Mon Jun 22 12:44:21 2015 -0700
@@ -0,0 +1,61 @@
+Check that evolve shows error while handling split commits
+--------------------------------------
+  $ cat >> $HGRCPATH <<EOF
+  > [defaults]
+  > amend=-d "0 0"
+  > fold=-d "0 0"
+  > [web]
+  > push_ssl = false
+  > allow_push = *
+  > [phases]
+  > publish = False
+  > [diff]
+  > git = 1
+  > unified = 0
+  > [ui]
+  > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline}\n
+  > [extensions]
+  > hgext.graphlog=
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
+  $ mkcommit() {
+  >    echo "$1" > "$1"
+  >    hg add "$1"
+  >    hg ci -m "add $1"
+  > }
+
+  $ hg init split
+  $ cd split
+  $ mkcommit aa
+
+Create a split commit
+  $ printf "oo" > oo;
+  $ printf "pp" > pp;
+  $ hg add oo pp
+  $ hg commit -m "oo+pp"
+  $ mkcommit uu
+  $ hg up 0
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  $ printf "oo" > oo;
+  $ hg add oo
+  $ hg commit -m "_oo"
+  created new head
+  $ printf "pp" > pp;
+  $ hg add pp
+  $ hg commit -m "_pp"
+  $ hg prune --succ "desc(_oo) + desc(_pp)" -r "desc('oo+pp')"
+  1 changesets pruned
+  1 new unstable changesets
+  $ hg log -G
+  @  4:d0dcf24cddd3@default(draft) _pp
+  |
+  o  3:a7fdfda64c08@default(draft) _oo
+  |
+  | o  2:f52200b086ca@default(draft) add uu
+  | |
+  | x  1:d55647aaa0c6@default(draft) oo+pp
+  |/
+  o  0:58663bb03074@default(draft) add aa
+  
+  $ hg evolve --rev "0::"
+  does not handle split parents yet
--- a/tests/test-evolve.t	Tue Jun 23 15:26:51 2015 -0700
+++ b/tests/test-evolve.t	Mon Jun 22 12:44:21 2015 -0700
@@ -1239,3 +1239,61 @@
   [255]
   $ hg fold --exact "19::"
   2 changesets folded
+
+Check that evolve shows error while handling split commits
+--------------------------------------
+
+  $ cat >> $HGRCPATH <<EOF
+  > [experimental]
+  > evolution=all
+  > EOF
+
+  $ glog -r "18::"
+  o  31:5cc6eda0f00d@default(draft) add gg
+  |
+  | @  30:30ecefd67c0a@default(draft) add unstableifparentisfolded
+  |/
+  | o  20:db3d894869b0@default(draft) add gh
+  |/
+  o  18:0bb66d4c1968@default(draft) a3
+  |
+
+Create a split commit
+  $ printf "oo" > oo;
+  $ printf "pp" > pp;
+  $ hg add oo pp
+  $ hg commit -m "oo+pp"
+  $ mkcommit uu
+  $ hg up 30
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  $ printf "oo" > oo;
+  $ hg add oo
+  $ hg commit -m "_oo"
+  created new head
+  $ printf "pp" > pp;
+  $ hg add pp
+  $ hg commit -m "_pp"
+  $ hg prune --succ "desc(_oo) + desc(_pp)" -r "desc('oo+pp')"
+  1 changesets pruned
+  1 new unstable changesets
+  $ glog -r "18::"
+  @  35:072908d77206@default(draft) _pp
+  |
+  o  34:68e429987343@default(draft) _oo
+  |
+  | o  33:030868870864@default(draft) add uu
+  | |
+  | x  32:7e9688cf0a1b@default(draft) oo+pp
+  |/
+  | o  31:5cc6eda0f00d@default(draft) add gg
+  | |
+  o |  30:30ecefd67c0a@default(draft) add unstableifparentisfolded
+  |/
+  | o  20:db3d894869b0@default(draft) add gh
+  |/
+  o  18:0bb66d4c1968@default(draft) a3
+  |
+  $ hg evolve --rev "18::"
+  does not handle split parents yet
+
+