tests/test-evolve-issue6097.t
author Sushil khanchi <sushilkhanchi97@gmail.com>
Wed, 27 Nov 2019 12:34:19 +0530
changeset 5016 64868b7dc112
parent 4825 9af212b8565a
child 5123 900668a93629
permissions -rw-r--r--
evolve: add logic to cover --continue case when relocating "divergent" Changes in test file demonstrate the added behaviour.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4824
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     1
Orphan changeset and trying to relocate a node on top of itself (issue6097)
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     2
https://bz.mercurial-scm.org/show_bug.cgi?id=6097
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     3
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     4
  $ . $TESTDIR/testlib/common.sh
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     5
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     6
  $ cat << EOF >> $HGRCPATH
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     7
  > [extensions]
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     8
  > rebase =
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     9
  > evolve =
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    10
  > EOF
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    11
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    12
  $ hg init issue6097
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    13
  $ cd issue6097
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    14
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    15
  $ echo apricot > a
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    16
  $ hg ci -qAm apricot
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    17
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    18
  $ echo banana > b
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    19
  $ hg ci -qAm banana
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    20
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    21
Let's go back to amend 0 and make an orphan out of 1
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    22
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    23
  $ hg up -q 0
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    24
  $ echo coconut > c
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    25
  $ hg add -q c
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    26
  $ hg ci --amend -m 'apricot and coconut'
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    27
  1 new orphan changesets
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    28
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    29
Now rebase the successor of 0 on top of 1
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    30
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    31
  $ hg rebase -r . -d 1
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    32
  rebasing 2:32acf8fb1b23 "apricot and coconut" (tip)
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    33
  1 new orphan changesets
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    34
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    35
Pruning 1 just to get it out of the way
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    36
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    37
  $ hg prune -q 1
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    38
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    39
Note how both the regular DAG and the obsolescence graph are linear, but the
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    40
paths from 3 to 0 are different: 3-1-0 and 3-2-0
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    41
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    42
  $ hg log -G
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    43
  @  changeset:   3:2868fe6df617
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    44
  |  tag:         tip
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    45
  |  parent:      1:e0486f65907d
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    46
  |  user:        test
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    47
  |  date:        Thu Jan 01 00:00:00 1970 +0000
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    48
  |  instability: orphan
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    49
  |  summary:     apricot and coconut
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    50
  |
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    51
  x  changeset:   1:e0486f65907d
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    52
  |  user:        test
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    53
  |  date:        Thu Jan 01 00:00:00 1970 +0000
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    54
  |  obsolete:    pruned using prune
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    55
  |  summary:     banana
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    56
  |
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    57
  x  changeset:   0:692cc7b6212c
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    58
     user:        test
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    59
     date:        Thu Jan 01 00:00:00 1970 +0000
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    60
     obsolete:    rewritten using amend, rebase as 3:2868fe6df617
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    61
     summary:     apricot
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    62
  
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    63
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    64
  $ hg obslog
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    65
  @  2868fe6df617 (3) apricot and coconut
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    66
  |
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    67
  x  32acf8fb1b23 (2) apricot and coconut
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    68
  |    rewritten(parent, content) as 2868fe6df617 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    69
  |
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    70
  x  692cc7b6212c (0) apricot
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    71
       rewritten(description, content) as 32acf8fb1b23 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    72
  
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    73
4825
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    74
  $ hg evolve -r .
4824
f9d436b64b3f tests: demonstrate an orphan changeset cause "relocate node on top of itself"
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    75
  move:[3] apricot and coconut
4825
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    76
  atop:[-1] 
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    77
  working directory is now at bb847d1d3a5f
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    78
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    79
  $ hg log -G
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    80
  @  changeset:   4:bb847d1d3a5f
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    81
     tag:         tip
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    82
     parent:      -1:000000000000
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    83
     user:        test
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    84
     date:        Thu Jan 01 00:00:00 1970 +0000
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    85
     summary:     apricot and coconut
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    86
  
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    87
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    88
  $ hg obslog
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    89
  @  bb847d1d3a5f (4) apricot and coconut
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    90
  |
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    91
  x  2868fe6df617 (3) apricot and coconut
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    92
  |    rewritten(parent) as bb847d1d3a5f using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    93
  |
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    94
  x  32acf8fb1b23 (2) apricot and coconut
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    95
  |    rewritten(parent, content) as 2868fe6df617 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    96
  |
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    97
  x  692cc7b6212c (0) apricot
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    98
       rewritten(description, content) as 32acf8fb1b23 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
9af212b8565a evolve: test that target is not orig in _solveunstable() (issue6097)
Anton Shestakov <av6@dwimlabs.net>
parents: 4824
diff changeset
    99