prev: add a test case which shows traceback when doing prev on obsolete cset stable
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 16 Mar 2018 14:59:10 +0530
branchstable
changeset 3531 b3d2e0576d4c
parent 3511 768f752b5364
child 3532 68e99d2c6267
prev: add a test case which shows traceback when doing prev on obsolete cset This patch adds a test which shows how `hg prev` is borken when called from a obsolete changeset and there is an active topic. The next patch will fix that.
tests/test-evolve-topic.t
--- a/tests/test-evolve-topic.t	Tue Dec 05 20:45:46 2017 -0800
+++ b/tests/test-evolve-topic.t	Fri Mar 16 14:59:10 2018 +0530
@@ -268,3 +268,103 @@
   $ hg prev
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   [18] add fff
+
+Testing issue 5708 when we are on obsolete changeset and there is active topic
+------------------------------------------------------------------------------
+
+  $ hg log --graph
+  @  18 - {bar} 793eb6370b2d add fff (draft)
+  |
+  | *  17 - {bar} 9bf430c106b7 add jjj (draft)
+  | |
+  | *  16 - {bar} d2dc89c57700 add iii (draft)
+  | |
+  | *  15 - {bar} 20bc4d02aa62 add hhh (draft)
+  | |
+  | *  14 - {bar} 16d6f664b17c add ggg (draft)
+  | |
+  | x  13 - {foo} 070c5573d8f9 add fff (draft)
+  |/
+  o  12 - {foo} 42b49017ff90 add eee (draft)
+  |
+  o  10 - {foo} d9cacd156ffc add ddd (draft)
+  |
+  o  2 - {foo} cced9bac76e3 add ccc (draft)
+  |
+  o  1 - {} a4dbed0837ea add bbb (draft)
+  |
+  o  0 - {} 199cc73e9a0b add aaa (draft)
+  
+
+  $ hg topic
+   * bar (5 changesets, 4 troubled)
+     foo (3 changesets)
+
+When the current topic, obsoleted changesets topic and successor topic are same
+
+  $ hg up 20bc4d02aa62
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo foobar >> hhh
+  $ hg amend
+  $ hg up 20bc4d02aa62
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory parent is obsolete! (20bc4d02aa62)
+  (use 'hg evolve' to update to its successor: d834582d9ee3)
+  $ hg log -Gr 14::
+  *  19 - {bar} d834582d9ee3 add hhh (draft)
+  |
+  | *  17 - {bar} 9bf430c106b7 add jjj (draft)
+  | |
+  | *  16 - {bar} d2dc89c57700 add iii (draft)
+  | |
+  | @  15 - {bar} 20bc4d02aa62 add hhh (draft)
+  |/
+  *  14 - {bar} 16d6f664b17c add ggg (draft)
+  |
+  ~
+
+  $ hg prev
+  ** Unknown exception encountered with possibly-broken third-party extension evolve
+  ** which supports versions 4.4 of Mercurial.
+  ** Please disable evolve and try your action again.
+  ** If that fixes the bug please report it to https://bz.mercurial-scm.org/
+  ** Python 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 20160609]
+  ** Mercurial Distributed SCM (version 4.5.2+1098-cdc73e5c75af)
+  ** Extensions loaded: rebase, evolve, topic
+  Traceback (most recent call last):
+    File "/tmp/hgtests.GW4RZg/install/bin/hg", line 41, in <module>
+      dispatch.run()
+    File "/tmp/hgtests.GW4RZg/install/lib/python/mercurial/dispatch.py", line 88, in run
+      status = (dispatch(req) or 0)
+    File "/tmp/hgtests.GW4RZg/install/lib/python/mercurial/dispatch.py", line 208, in dispatch
+      ret = _runcatch(req)
+    File "/tmp/hgtests.GW4RZg/install/lib/python/mercurial/dispatch.py", line 349, in _runcatch
+      return _callcatch(ui, _runcatchfunc)
+    File "/tmp/hgtests.GW4RZg/install/lib/python/mercurial/dispatch.py", line 357, in _callcatch
+      return scmutil.callcatch(ui, func)
+    File "/tmp/hgtests.GW4RZg/install/lib/python/mercurial/scmutil.py", line 154, in callcatch
+      return func()
+    File "/tmp/hgtests.GW4RZg/install/lib/python/mercurial/dispatch.py", line 339, in _runcatchfunc
+      return _dispatch(req)
+    File "/tmp/hgtests.GW4RZg/install/lib/python/mercurial/dispatch.py", line 943, in _dispatch
+      cmdpats, cmdoptions)
+    File "/tmp/hgtests.GW4RZg/install/lib/python/mercurial/dispatch.py", line 700, in runcommand
+      ret = _runcommand(ui, options, cmd, d)
+    File "/tmp/hgtests.GW4RZg/install/lib/python/mercurial/dispatch.py", line 951, in _runcommand
+      return cmdfunc()
+    File "/tmp/hgtests.GW4RZg/install/lib/python/mercurial/dispatch.py", line 940, in <lambda>
+      d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
+    File "/tmp/hgtests.GW4RZg/install/lib/python/mercurial/util.py", line 1497, in check
+      return func(*args, **kwargs)
+    File "/home/foobar/repo/mutable-history/hgext3rd/evolve/__init__.py", line 1052, in cmdprevious
+      opts.get('move_bookmark'), topic)
+    File "/home/foobar/repo/mutable-history/hgext3rd/evolve/__init__.py", line 995, in _findprevtarget
+      if currenttopic and topic and _gettopicidx(p1) != 1:
+    File "/home/foobar/repo/mutable-history/hgext3rd/evolve/__init__.py", line 957, in _gettopicidx
+      return getattr(ctx, 'topicidx', lambda: None)()
+    File "/home/foobar/repo/mutable-history/hgext3rd/topic/__init__.py", line 242, in _contexttopicidx
+      return revlist.index(self.rev())
+    File "/home/foobar/repo/mutable-history/hgext3rd/topic/stack.py", line 95, in index
+      return self.revs.index(item)
+  ValueError: 15 is not in list
+  [1]