tests/test-evolve-continue.t
author Pulkit Goyal <7895pulkit@gmail.com>
Sun, 28 Jan 2018 19:28:08 +0530
changeset 3489 ee72cdc2387b
child 3490 51c0a23b519e
permissions -rw-r--r--
tests: add tests for `hg evolve --continue` This patch adds a new test file containing tests for `hg evolve --continue`. The test file still does not contains all the tests related to `hg evolve --continue` as one of the case is broken which needs to be fixed first. The case is when resolving a conflicting evolve results in empty wdir. Next patch will fix the traceback and then a later patch will add more tests.

Testing the continue functionality of `hg evolve`

  $ cat >> $HGRCPATH <<EOF
  > [ui]
  > interactive = True
  > [alias]
  > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}"
  > [extensions]
  > rebase =
  > EOF
  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH

Setting up the repo

  $ hg init repo
  $ cd repo
  $ echo ".*\.orig" > .hgignore
  $ hg add .hgignore
  $ hg ci -m "added hgignore"
  $ for ch in a b c d; do echo foo>$ch; hg add $ch; hg ci -qm "added "$ch; done

  $ hg glog
  @  4:c41c793e0ef1 added d
  |   () draft
  o  3:ca1b80f7960a added c
  |   () draft
  o  2:b1661037fa25 added b
  |   () draft
  o  1:c7586e2a9264 added a
  |   () draft
  o  0:8fa14d15e168 added hgignore
      () draft

Simple case of evolve --continue

  $ hg up ca1b80f7960a
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ echo bar > d
  $ hg add d
  $ hg amend
  1 new orphan changesets
  $ hg glog
  @  5:cb6a2ab625bb added c
  |   () draft
  | *  4:c41c793e0ef1 added d
  | |   () draft
  | x  3:ca1b80f7960a added c
  |/    () draft
  o  2:b1661037fa25 added b
  |   () draft
  o  1:c7586e2a9264 added a
  |   () draft
  o  0:8fa14d15e168 added hgignore
      () draft

  $ hg evolve --all
  move:[4] added d
  atop:[5] added c
  merging d
  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
  evolve failed!
  fix conflict and run 'hg evolve --continue' or use 'hg update -C .' to abort
  abort: unresolved merge conflicts (see hg help resolve)
  [255]

  $ echo foo > d
  $ hg resolve -m
  (no more unresolved files)
  continue: hg evolve --continue

  $ hg evolve --continue
  evolving 4:c41c793e0ef1 "added d"

  $ hg glog
  @  6:2a4e03d422e2 added d
  |   () draft
  o  5:cb6a2ab625bb added c
  |   () draft
  o  2:b1661037fa25 added b
  |   () draft
  o  1:c7586e2a9264 added a
  |   () draft
  o  0:8fa14d15e168 added hgignore
      () draft

Case when conflicts resolution lead to empty wdir in evolve --continue

  $ echo foo > e
  $ hg ci -Aqm "added e"
  $ hg prev
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  [6] added d
  $ echo bar > e
  $ hg add e
  $ hg amend
  1 new orphan changesets

  $ hg glog
  @  8:00a5c774cc37 added d
  |   () draft
  | *  7:ad0a59d83efe added e
  | |   () draft
  | x  6:2a4e03d422e2 added d
  |/    () draft
  o  5:cb6a2ab625bb added c
  |   () draft
  o  2:b1661037fa25 added b
  |   () draft
  o  1:c7586e2a9264 added a
  |   () draft
  o  0:8fa14d15e168 added hgignore
      () draft

  $ hg evolve
  move:[7] added e
  atop:[8] added d
  merging e
  warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
  evolve failed!
  fix conflict and run 'hg evolve --continue' or use 'hg update -C .' to abort
  abort: unresolved merge conflicts (see hg help resolve)
  [255]

  $ echo bar > e
  $ hg resolve -m
  (no more unresolved files)
  continue: hg evolve --continue
  $ hg diff

XXX: maybe we should add a message here about evolve resulting in no commit
  $ hg evolve --continue
  evolving 7:ad0a59d83efe "added e"
  ** 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+64-87416288be98)
  ** Extensions loaded: rebase, evolve
  Traceback (most recent call last):
    File "/tmp/hgtests.vDbR61/install/bin/hg", line 41, in <module>
      dispatch.run()
    File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/dispatch.py", line 88, in run
      status = (dispatch(req) or 0) & 255
    File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/dispatch.py", line 183, in dispatch
      ret = _runcatch(req)
    File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/dispatch.py", line 324, in _runcatch
      return _callcatch(ui, _runcatchfunc)
    File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/dispatch.py", line 332, in _callcatch
      return scmutil.callcatch(ui, func)
    File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/scmutil.py", line 154, in callcatch
      return func()
    File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/dispatch.py", line 314, in _runcatchfunc
      return _dispatch(req)
    File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/dispatch.py", line 918, in _dispatch
      cmdpats, cmdoptions)
    File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/dispatch.py", line 673, in runcommand
      ret = _runcommand(ui, options, cmd, d)
    File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/dispatch.py", line 926, in _runcommand
      return cmdfunc()
    File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/dispatch.py", line 915, in <lambda>
      d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
    File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/util.py", line 1195, in check
      return func(*args, **kwargs)
    File "/home/foobar/repo/mutable-history/hgext3rd/evolve/evolvecmd.py", line 1141, in evolve
      obsolete.createmarkers(repo, [(ctx, (repo[node],))])
    File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/obsolete.py", line 1115, in createmarkers
      ui=repo.ui)
    File "/tmp/hgtests.vDbR61/install/lib/python/mercurial/obsolete.py", line 621, in create
      if len(succ) != 20:
  TypeError: object of type 'NoneType' has no len()
  [1]

  $ hg glog
  @  8:00a5c774cc37 added d
  |   () draft
  | *  7:ad0a59d83efe added e
  | |   () draft
  | x  6:2a4e03d422e2 added d
  |/    () draft
  o  5:cb6a2ab625bb added c
  |   () draft
  o  2:b1661037fa25 added b
  |   () draft
  o  1:c7586e2a9264 added a
  |   () draft
  o  0:8fa14d15e168 added hgignore
      () draft