diff tests/test-topic-stack-complex.t @ 3277:0a6954bd6502 stable

tests: add a test showing traceback on `hg stack` in case of split The traceback will be fixed in the next patch.
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 11 Dec 2017 23:33:50 +0530
parents
children e4c0332ecee4
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-topic-stack-complex.t	Mon Dec 11 23:33:50 2017 +0530
@@ -0,0 +1,168 @@
+Testing `hg stack` on complex cases when we have multiple successors because of
+divergence, split etc.
+  $ . "$TESTDIR/testlib/topic_setup.sh"
+
+Setup
+
+  $ cat << EOF >> $HGRCPATH
+  > [experimental]
+  > evolution = all
+  > [ui]
+  > interactive = True
+  > [extensions]
+  > show =
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+
+  $ hg init test
+  $ cd test
+  $ echo foo > foo
+  $ hg add foo
+  $ hg ci -m "Added foo"
+  $ hg phase -r . --public
+  $ hg topic foo
+  marked working directory as topic: foo
+  $ echo a > a
+  $ echo b > b
+  $ hg ci -Aqm "Added a and b"
+  $ echo c > c
+  $ echo d > d
+  $ hg ci -Aqm "Added c and d"
+  $ echo e > e
+  $ echo f > f
+  $ hg ci -Aqm "Added e and f"
+  $ hg show work
+  @  f1d3 (foo) Added e and f
+  o  8e82 (foo) Added c and d
+  o  002b (foo) Added a and b
+  o  f360 Added foo
+
+Testing in case of split within the topic
+
+  $ hg stack
+  ### topic: foo
+  ### target: default (branch)
+  t3@ Added e and f (current)
+  t2: Added c and d
+  t1: Added a and b
+  t0^ Added foo (base)
+  $ hg prev
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  [2] Added c and d
+
+  $ echo 0 > num
+  $ cat > editor.sh << '__EOF__'
+  > NUM=$(cat num)
+  > NUM=`expr "$NUM" + 1`
+  > echo "$NUM" > num
+  > echo "split$NUM" > "$1"
+  > __EOF__
+  $ export HGEDITOR="\"sh\" \"editor.sh\""
+
+  $ hg split << EOF
+  > y
+  > y
+  > n
+  > y
+  > EOF
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  adding c
+  adding d
+  diff --git a/c b/c
+  new file mode 100644
+  examine changes to 'c'? [Ynesfdaq?] y
+  
+  @@ -0,0 +1,1 @@
+  +c
+  record change 1/2 to 'c'? [Ynesfdaq?] y
+  
+  diff --git a/d b/d
+  new file mode 100644
+  examine changes to 'd'? [Ynesfdaq?] n
+  
+  Done splitting? [yN] y
+
+  $ hg stack
+  ### topic: foo
+  ### target: default (branch)
+  t4$ Added e and f (unstable)
+  t3@ split2 (current)
+  t2: split1
+  t1: Added a and b
+  t0^ Added foo (base)
+
+  $ hg show work
+  @  5cce (foo) split2
+  o  f26c (foo) split1
+  | o  f1d3 (foo) Added e and f
+  | x  8e82 (foo) Added c and d
+  |/
+  o  002b (foo) Added a and b
+  o  f360 Added foo
+
+  $ hg prev
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [4] split1
+  $ echo foo > c
+  $ hg diff
+  diff -r f26c1b9addde c
+  --- a/c	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/c	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,1 @@
+  -c
+  +foo
+
+  $ hg amend
+  1 new orphan changesets
+  $ hg show work
+  @  7d94 (foo) split1
+  | o  5cce (foo) split2
+  | x  f26c (foo) split1
+  |/
+  | o  f1d3 (foo) Added e and f
+  | x  8e82 (foo) Added c and d
+  |/
+  o  002b (foo) Added a and b
+  o  f360 Added foo
+
+  $ hg stack
+  ### topic: foo (2 heads)
+  ### target: default (branch), 2 behind
+  ** unknown exception encountered, please report by visiting
+  ** https://mercurial-scm.org/wiki/BugTracker
+  ** Python 2.7.12 (default, Jul 18 2016, 15:04:44) [GCC 4.8.4]
+  ** Mercurial Distributed SCM (version 4.4.2+379-6812f5c492c7)
+  ** Extensions loaded: rebase, topic, show, evolve
+  Traceback (most recent call last):
+    File "/tmp/hgtests.d2IKdr/install/bin/hg", line 41, in <module>
+      dispatch.run()
+    File "/tmp/hgtests.d2IKdr/install/lib/python/mercurial/dispatch.py", line 88, in run
+      status = (dispatch(req) or 0) & 255
+    File "/tmp/hgtests.d2IKdr/install/lib/python/mercurial/dispatch.py", line 177, in dispatch
+      ret = _runcatch(req)
+    File "/tmp/hgtests.d2IKdr/install/lib/python/mercurial/dispatch.py", line 318, in _runcatch
+      return _callcatch(ui, _runcatchfunc)
+    File "/tmp/hgtests.d2IKdr/install/lib/python/mercurial/dispatch.py", line 326, in _callcatch
+      return scmutil.callcatch(ui, func)
+    File "/tmp/hgtests.d2IKdr/install/lib/python/mercurial/scmutil.py", line 154, in callcatch
+      return func()
+    File "/tmp/hgtests.d2IKdr/install/lib/python/mercurial/dispatch.py", line 308, in _runcatchfunc
+      return _dispatch(req)
+    File "/tmp/hgtests.d2IKdr/install/lib/python/mercurial/dispatch.py", line 912, in _dispatch
+      cmdpats, cmdoptions)
+    File "/tmp/hgtests.d2IKdr/install/lib/python/mercurial/dispatch.py", line 667, in runcommand
+      ret = _runcommand(ui, options, cmd, d)
+    File "/tmp/hgtests.d2IKdr/install/lib/python/mercurial/dispatch.py", line 920, in _runcommand
+      return cmdfunc()
+    File "/tmp/hgtests.d2IKdr/install/lib/python/mercurial/dispatch.py", line 909, in <lambda>
+      d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
+    File "/tmp/hgtests.d2IKdr/install/lib/python/mercurial/util.py", line 1188, in check
+      return func(*args, **kwargs)
+    File "/home/pulkit/repo/mutable-history/hgext3rd/topic/__init__.py", line 663, in cmdstack
+      return stack.showstack(ui, repo, branch=branch, topic=topic, opts=opts)
+    File "/home/pulkit/repo/mutable-history/hgext3rd/topic/stack.py", line 288, in showstack
+      p1 = repo[_singlesuccessor(repo, p1)]
+    File "/home/pulkit/repo/mutable-history/hgext3rd/topic/evolvebits.py", line 92, in _singlesuccessor
+      raise MultipleSuccessorsError(newer)
+  hgext3rd.topic.evolvebits.MultipleSuccessorsError
+  [1]