tests/test-unstable-orphan.t
author Sushil khanchi <sushilkhanchi97@gmail.com>
Fri, 20 Dec 2019 17:32:07 +0530
branchstable
changeset 5025 21168e99ba88
parent 4577 bcd52ce0916d
child 4675 79bc0f1a832e
permissions -rw-r--r--
evolve: add test to demonstrate a bug when no active topic Added test shows that the logic to find the destination for `hg up` in the case when "working directory parent has a topic but wdir has no active topic" is buggy. This will be fixed in next patch.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4468
a2273aa71a4b test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3540
diff changeset
     1
==================================
a2273aa71a4b test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3540
diff changeset
     2
Test for "orphan" type instability
a2273aa71a4b test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3540
diff changeset
     3
==================================
a2273aa71a4b test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3540
diff changeset
     4
a2273aa71a4b test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3540
diff changeset
     5
This file gather test case around the "orphan" changeset instability. This
a2273aa71a4b test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3540
diff changeset
     6
instability happens when a changesets has obsolete ancestors.
a2273aa71a4b test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3540
diff changeset
     7
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     8
  $ cat >> $HGRCPATH <<EOF
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     9
  > [defaults]
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    10
  > amend=-d "0 0"
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    11
  > fold=-d "0 0"
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    12
  > [web]
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    13
  > push_ssl = false
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    14
  > allow_push = *
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    15
  > [phases]
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    16
  > publish = False
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    17
  > [diff]
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    18
  > git = 1
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    19
  > unified = 0
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    20
  > [ui]
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    21
  > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline}\n
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    22
  > [extensions]
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    23
  > EOF
1806
9f42f819267b evolve: move the extensions to 'hgext3rd'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1639
diff changeset
    24
  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    25
  $ mkcommit() {
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    26
  >    echo "$1" > "$1"
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    27
  >    hg add "$1"
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    28
  >    hg ci -m "add $1"
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    29
  > }
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    30
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    31
  $ mkstack() {
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    32
  >    # Creates a stack of commit based on $1 with messages from $2, $3 ..
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    33
  >    hg update "$1" -C
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    34
  >    shift
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    35
  >    mkcommits $*
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    36
  > }
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    37
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    38
  $ mkcommits() {
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    39
  >   for i in $@; do mkcommit $i ; done
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    40
  > }
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    41
4468
a2273aa71a4b test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3540
diff changeset
    42
orphan parent is obsolete with a single successor
a2273aa71a4b test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3540
diff changeset
    43
=================================================
a2273aa71a4b test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3540
diff changeset
    44
a2273aa71a4b test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3540
diff changeset
    45
Test orphan resolution for a changeset orphan because its parent is obsolete
a2273aa71a4b test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3540
diff changeset
    46
with one successor.
a2273aa71a4b test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3540
diff changeset
    47
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    48
  $ hg init test1
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    49
  $ cd test1
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    50
  $ mkcommits _a _b _c
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    51
  $ hg up "desc(_b)"
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    52
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    53
  $ hg amend -m "bprime"
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
    54
  1 new orphan changesets
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    55
  $ hg log -G
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    56
  @  3:36050226a9b9@default(draft) bprime
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    57
  |
3417
d3a17c67f85c branching: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3411
diff changeset
    58
  | *  2:102002290587@default(draft) add _c
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    59
  | |
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    60
  | x  1:37445b16603b@default(draft) add _b
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    61
  |/
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    62
  o  0:135f39f4bd78@default(draft) add _a
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    63
  
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    64
2834
38db1466c6fb log: unstable was renamed into orphan
Boris Feld <boris.feld@octobus.net>
parents: 2776
diff changeset
    65
  $ hg evo --all --any --orphan
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    66
  move:[2] add _c
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    67
  atop:[3] bprime
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    68
  $ hg log -G
4577
bcd52ce0916d evolve: don't update after instability resolution by default (BC)
Anton Shestakov <av6@dwimlabs.net>
parents: 4468
diff changeset
    69
  o  4:fdcf3523a74d@default(draft) add _c
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    70
  |
4577
bcd52ce0916d evolve: don't update after instability resolution by default (BC)
Anton Shestakov <av6@dwimlabs.net>
parents: 4468
diff changeset
    71
  @  3:36050226a9b9@default(draft) bprime
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    72
  |
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    73
  o  0:135f39f4bd78@default(draft) add _a
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    74
  
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    75
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    76
  $ cd ..
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    77
4468
a2273aa71a4b test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3540
diff changeset
    78
a2273aa71a4b test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3540
diff changeset
    79
orphan parent is obsolete with a multiple successors (reversed order)
a2273aa71a4b test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3540
diff changeset
    80
=====================================================================
a2273aa71a4b test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3540
diff changeset
    81
a2273aa71a4b test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3540
diff changeset
    82
Test orphan resolution for a changeset orphan because its parent is obsolete
a2273aa71a4b test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3540
diff changeset
    83
with multiple successors on the same branch but in reverse order (cross-split).
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    84
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    85
  $ hg init test5
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    86
  $ cd test5
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    87
  $ mkcommits _a _b _c
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    88
  $ hg up "desc(_a)"
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    89
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    90
  $ mkcommits bprimesplit1 bprimesplit2
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    91
  created new head
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    92
  $ hg prune "desc(_b)" -s "desc(bprimesplit1) + desc(bprimesplit2)" --split
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    93
  1 changesets pruned
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
    94
  1 new orphan changesets
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    95
  $ hg up "desc(_a)"
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    96
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    97
  $ mkcommits bsecondsplit1 bsecondsplit2
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    98
  created new head
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    99
  $ hg prune "desc(bprimesplit1)" -s "desc(bsecondsplit2)"
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   100
  1 changesets pruned
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
   101
  1 new orphan changesets
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   102
  $ hg prune "desc(bprimesplit2)" -s "desc(bsecondsplit1)"
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   103
  1 changesets pruned
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   104
  $ hg log -G
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   105
  @  6:59b942dbda14@default(draft) add bsecondsplit2
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   106
  |
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   107
  o  5:8ffdae67d696@default(draft) add bsecondsplit1
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   108
  |
3417
d3a17c67f85c branching: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3411
diff changeset
   109
  | *  2:102002290587@default(draft) add _c
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   110
  | |
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   111
  | x  1:37445b16603b@default(draft) add _b
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   112
  |/
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   113
  o  0:135f39f4bd78@default(draft) add _a
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   114
  
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   115
2834
38db1466c6fb log: unstable was renamed into orphan
Boris Feld <boris.feld@octobus.net>
parents: 2776
diff changeset
   116
  $ hg evo --all --any --orphan
1481
3c0aebe73482 evolve: handle split commit for instability
Laurent Charignon <lcharignon@fb.com>
parents: 1479
diff changeset
   117
  move:[2] add _c
3c0aebe73482 evolve: handle split commit for instability
Laurent Charignon <lcharignon@fb.com>
parents: 1479
diff changeset
   118
  atop:[6] add bsecondsplit2
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   119
  $ hg log -G
4577
bcd52ce0916d evolve: don't update after instability resolution by default (BC)
Anton Shestakov <av6@dwimlabs.net>
parents: 4468
diff changeset
   120
  o  7:98e3f21461ff@default(draft) add _c
1481
3c0aebe73482 evolve: handle split commit for instability
Laurent Charignon <lcharignon@fb.com>
parents: 1479
diff changeset
   121
  |
4577
bcd52ce0916d evolve: don't update after instability resolution by default (BC)
Anton Shestakov <av6@dwimlabs.net>
parents: 4468
diff changeset
   122
  @  6:59b942dbda14@default(draft) add bsecondsplit2
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   123
  |
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   124
  o  5:8ffdae67d696@default(draft) add bsecondsplit1
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   125
  |
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   126
  o  0:135f39f4bd78@default(draft) add _a
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   127
  
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   128
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   129
  $ cd ..