tests/test-unstable.t
author Pulkit Goyal <7895pulkit@gmail.com>
Thu, 07 Jun 2018 15:54:32 +0530
changeset 3806 99469bb3854e
parent 3540 0624732c92f7
child 3590 d5adce52cef4
permissions -rw-r--r--
tests: add tests for resolving content-divergence when different parents This patch adds more tests for cases when we try to resolve content-divergence when they are on different parents. The last test shows the we are somehow missing the relocated commit in interrupted transaction. This will be fixed in next patch.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     1
  $ cat >> $HGRCPATH <<EOF
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     2
  > [defaults]
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     3
  > amend=-d "0 0"
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     4
  > fold=-d "0 0"
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     5
  > [web]
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     6
  > push_ssl = false
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     7
  > allow_push = *
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     8
  > [phases]
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     9
  > publish = False
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    10
  > [diff]
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    11
  > git = 1
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    12
  > unified = 0
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    13
  > [ui]
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    14
  > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline}\n
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    15
  > [extensions]
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    16
  > EOF
1806
9f42f819267b evolve: move the extensions to 'hgext3rd'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1639
diff changeset
    17
  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    18
  $ mkcommit() {
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    19
  >    echo "$1" > "$1"
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    20
  >    hg add "$1"
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    21
  >    hg ci -m "add $1"
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    22
  > }
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    23
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    24
  $ mkstack() {
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    25
  >    # 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
    26
  >    hg update "$1" -C
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    27
  >    shift
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    28
  >    mkcommits $*
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
  $ mkcommits() {
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    32
  >   for i in $@; do mkcommit $i ; done
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    33
  > }
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    34
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    35
==============================================================================
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    36
Test instability resolution for a changeset unstable because its parent
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    37
is obsolete with one successor
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    38
==============================================================================
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    39
  $ hg init test1
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    40
  $ cd test1
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    41
  $ mkcommits _a _b _c
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    42
  $ hg up "desc(_b)"
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    43
  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
    44
  $ hg amend -m "bprime"
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
    45
  1 new orphan changesets
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    46
  $ hg log -G
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    47
  @  3:36050226a9b9@default(draft) bprime
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    48
  |
3417
d3a17c67f85c branching: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3411
diff changeset
    49
  | *  2:102002290587@default(draft) add _c
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    50
  | |
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    51
  | x  1:37445b16603b@default(draft) add _b
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    52
  |/
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    53
  o  0:135f39f4bd78@default(draft) add _a
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    54
  
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    55
2834
38db1466c6fb log: unstable was renamed into orphan
Boris Feld <boris.feld@octobus.net>
parents: 2776
diff changeset
    56
  $ hg evo --all --any --orphan
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    57
  move:[2] add _c
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    58
  atop:[3] bprime
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    59
  working directory is now at fdcf3523a74d
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    60
  $ hg log -G
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    61
  @  4:fdcf3523a74d@default(draft) add _c
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    62
  |
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    63
  o  3:36050226a9b9@default(draft) bprime
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    64
  |
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    65
  o  0:135f39f4bd78@default(draft) add _a
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    66
  
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    67
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    68
  $ cd ..
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    69
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    70
===============================================================================
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    71
Test instability resolution for a changeset unstable because its parent
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    72
is obsolete with multiple successors on one branches but in reverse
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    73
order (cross-split).
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
  $ hg init test5
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    77
  $ cd test5
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    78
  $ mkcommits _a _b _c
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    79
  $ hg up "desc(_a)"
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    80
  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
    81
  $ mkcommits bprimesplit1 bprimesplit2
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    82
  created new head
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    83
  $ hg prune "desc(_b)" -s "desc(bprimesplit1) + desc(bprimesplit2)" --split
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    84
  1 changesets pruned
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
    85
  1 new orphan changesets
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    86
  $ hg up "desc(_a)"
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    87
  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
    88
  $ mkcommits bsecondsplit1 bsecondsplit2
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    89
  created new head
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    90
  $ hg prune "desc(bprimesplit1)" -s "desc(bsecondsplit2)"
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    91
  1 changesets pruned
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
    92
  1 new orphan changesets
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    93
  $ hg prune "desc(bprimesplit2)" -s "desc(bsecondsplit1)"
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    94
  1 changesets pruned
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    95
  $ hg log -G
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    96
  @  6:59b942dbda14@default(draft) add bsecondsplit2
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    97
  |
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    98
  o  5:8ffdae67d696@default(draft) add bsecondsplit1
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    99
  |
3417
d3a17c67f85c branching: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3411
diff changeset
   100
  | *  2:102002290587@default(draft) add _c
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   101
  | |
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   102
  | x  1:37445b16603b@default(draft) add _b
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   103
  |/
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   104
  o  0:135f39f4bd78@default(draft) add _a
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   105
  
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   106
2834
38db1466c6fb log: unstable was renamed into orphan
Boris Feld <boris.feld@octobus.net>
parents: 2776
diff changeset
   107
  $ hg evo --all --any --orphan
1481
3c0aebe73482 evolve: handle split commit for instability
Laurent Charignon <lcharignon@fb.com>
parents: 1479
diff changeset
   108
  move:[2] add _c
3c0aebe73482 evolve: handle split commit for instability
Laurent Charignon <lcharignon@fb.com>
parents: 1479
diff changeset
   109
  atop:[6] add bsecondsplit2
3c0aebe73482 evolve: handle split commit for instability
Laurent Charignon <lcharignon@fb.com>
parents: 1479
diff changeset
   110
  working directory is now at 98e3f21461ff
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   111
  $ hg log -G
1481
3c0aebe73482 evolve: handle split commit for instability
Laurent Charignon <lcharignon@fb.com>
parents: 1479
diff changeset
   112
  @  7:98e3f21461ff@default(draft) add _c
3c0aebe73482 evolve: handle split commit for instability
Laurent Charignon <lcharignon@fb.com>
parents: 1479
diff changeset
   113
  |
3c0aebe73482 evolve: handle split commit for instability
Laurent Charignon <lcharignon@fb.com>
parents: 1479
diff changeset
   114
  o  6:59b942dbda14@default(draft) add bsecondsplit2
1479
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   115
  |
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   116
  o  5:8ffdae67d696@default(draft) add bsecondsplit1
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   117
  |
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   118
  o  0:135f39f4bd78@default(draft) add _a
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   119
  
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   120
72eab894a89d evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   121
  $ cd ..