tests/test-issue-6028.t
author Anton Shestakov <av6@dwimlabs.net>
Tue, 24 Dec 2019 23:31:42 +0700
branchmercurial-4.5
changeset 5037 5ea7c807d094
parent 4843 d6e2820dac1f
permissions -rw-r--r--
heptapod-ci: skip test-evolve.t in tests-py2-pure job It seems pure mode on Mercurial 4.5 was broken in case of this test. The error was: Traceback (most recent call last): File "/tmp/hgtests.YoK65c/install/bin/hg", line 41, in <module> dispatch.run() File "/tmp/hgtests.YoK65c/install/lib/python/mercurial/dispatch.py", line 88, in run status = (dispatch(req) or 0) & 255 File "/tmp/hgtests.YoK65c/install/lib/python/mercurial/dispatch.py", line 183, in dispatch ret = _runcatch(req) File "/tmp/hgtests.YoK65c/install/lib/python/mercurial/dispatch.py", line 324, in _runcatch return _callcatch(ui, _runcatchfunc) File "/tmp/hgtests.YoK65c/install/lib/python/mercurial/dispatch.py", line 332, in _callcatch return scmutil.callcatch(ui, func) File "/tmp/hgtests.YoK65c/install/lib/python/mercurial/scmutil.py", line 154, in callcatch return func() File "/tmp/hgtests.YoK65c/install/lib/python/mercurial/dispatch.py", line 314, in _runcatchfunc return _dispatch(req) File "/tmp/hgtests.YoK65c/install/lib/python/mercurial/dispatch.py", line 918, in _dispatch cmdpats, cmdoptions) File "/tmp/hgtests.YoK65c/install/lib/python/mercurial/dispatch.py", line 673, in runcommand ret = _runcommand(ui, options, cmd, d) File "/tmp/hgtests.YoK65c/install/lib/python/mercurial/dispatch.py", line 926, in _runcommand return cmdfunc() File "/tmp/hgtests.YoK65c/install/lib/python/mercurial/dispatch.py", line 915, in <lambda> d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) File "/tmp/hgtests.YoK65c/install/lib/python/mercurial/util.py", line 1195, in check return func(*args, **kwargs) File "/builds/mercurial/evolve/hgext3rd/evolve/evolvecmd.py", line 1603, in evolve return _performevolve(ui, repo, **opts) File "/builds/mercurial/evolve/hgext3rd/evolve/evolvecmd.py", line 1726, in _performevolve targetcat, lastsolved) File "/builds/mercurial/evolve/hgext3rd/evolve/evolvecmd.py", line 1752, in _solveonerev lastsolved=lastsolved, stacktmplt=stacktmplt) File "/builds/mercurial/evolve/hgext3rd/evolve/evolvecmd.py", line 80, in _solveone lastsolved=lastsolved) File "/builds/mercurial/evolve/hgext3rd/evolve/evolvecmd.py", line 183, in _solveunstable keepbranch, b'orphan') File "/builds/mercurial/evolve/hgext3rd/evolve/evolvecmd.py", line 952, in relocate fullnode = unfi.changelog.index.partialmatch(sha1) AttributeError: 'InlinedIndexObject' object has no attribute 'partialmatch'

This test file test the #6028 issue

evolve fails with mercurial.error.ProgrammingError: unsupported changeid '' of type <type 'str'>

https://bz.mercurial-scm.org/show_bug.cgi?id=6028

Global setup
============

  $ . $TESTDIR/testlib/common.sh
  $ cat >> $HGRCPATH <<EOF
  > [ui]
  > interactive = true
  > [phases]
  > publish=False
  > [extensions]
  > evolve =
  > topic =
  > EOF

Test
====

  $ hg init $TESTTMP/issue-6028
  $ cd $TESTTMP/issue-6028

create initial commit

  $ echo "0" > 0
  $ hg ci -Am 0
  adding 0

start new topics "a" and "b" both from 0

  $ hg up default
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg topics a
  marked working directory as topic: a
  $ echo "a" > a
  $ hg ci -Am a
  adding a
  active topic 'a' grew its first changeset
  (see 'hg help topics' for more information)

  $ hg up default
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ hg topics b
  marked working directory as topic: b
  $ echo "b" > b
  $ hg ci -Am b
  adding b
  active topic 'b' grew its first changeset
  (see 'hg help topics' for more information)

create branch "integration" from 0, merge topics "a" and "b" into it

  $ hg up default
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ hg branch integration
  marked working directory as branch integration

  $ hg merge a
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)
  $ hg ci -m "merged a"

  $ hg merge b
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)
  $ hg ci -m "merged b"

commit a bad file on topic "a", merge it into "integration"

  $ hg up a
  switching to topic a
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ echo "a bad commit" >> a_bad_commit
  $ hg add a_bad_commit
  $ hg ci -m "a bad commit"
  $ hg up integration
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ hg merge a
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)
  $ hg ci -m "merged a bad commit"

add more commits on both topics and merge them into "integration"

  $ hg up a
  switching to topic a
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ echo "aa" >> a
  $ hg ci -m "aa"
  $ hg up integration
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg merge a
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)
  $ hg ci -m "merged aa"

  $ hg up b
  switching to topic b
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
  $ echo "bb" >> b
  $ hg ci -m "bb"
  $ hg up integration
  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg merge b
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)
  $ hg ci -m "merged bb"

create instability by pruning two changesets, one in a topic, one a merge

  $ hg log -r 5:6 -T '{rev}: {desc}\n'
  5: a bad commit
  6: merged a bad commit

  $ hg prune -r 5:6
  2 changesets pruned
  3 new orphan changesets

  $ hg up 4
  2 files updated, 0 files merged, 1 files removed, 0 files unresolved

start the evolve

  $ hg evolve --update --no-all
  move:[8] merged aa
  atop:[4] merged b
  working directory is now at c920dd828523

casually checking issue6141: position of p2 is not changed

  $ hg log -r 'predecessors(.) + .'
  changeset:   8:3f6f25057afb
  branch:      integration
  parent:      6:cfc4c333724f
  parent:      7:61eff7f7bb6c
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  obsolete:    rebased using evolve as 11:c920dd828523
  summary:     merged aa
  
  changeset:   11:c920dd828523
  branch:      integration
  tag:         tip
  parent:      4:e33aee2c715e
  parent:      7:61eff7f7bb6c
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  instability: orphan
  summary:     merged aa
  

test that we successfully got rid of the bad file

  $ hg d --git -r 'predecessors(.)' -r '.'
  diff --git a/a_bad_commit b/a_bad_commit
  deleted file mode 100644
  --- a/a_bad_commit
  +++ /dev/null
  @@ -1,1 +0,0 @@
  -a bad commit

evolve creates an obsolete changeset above as 11

  $ hg evolve -r .
  cannot solve instability of c920dd828523, skipping
  cannot solve instability of c920dd828523, skipping