tests/test-evolve-order.t
author Laurent Charignon <lcharignon@fb.com>
Tue, 16 Jun 2015 14:30:43 -0700
changeset 1369 4ed67cce8c23
child 1370 0799c5831a3d
permissions -rw-r--r--
evolve: properly evolve stacked unstable with --rev Before this patch, _singlesuccessor was not returning a revision number for the case where the parent of the argument was not obsolete. This resulted in bug when testing membership with the set of revisions. This patch fixes it and adds a test.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1369
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     1
evolve --rev reordering
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     2
-----------------------
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     3
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     4
  $ cat >> $HGRCPATH <<EOF
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     5
  > [defaults]
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     6
  > amend=-d "0 0"
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     7
  > fold=-d "0 0"
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     8
  > [web]
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     9
  > push_ssl = false
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    10
  > allow_push = *
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    11
  > [phases]
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    12
  > publish = False
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    13
  > [diff]
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    14
  > git = 1
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    15
  > unified = 0
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    16
  > [ui]
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    17
  > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline}\n
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    18
  > [extensions]
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    19
  > hgext.graphlog=
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    20
  > EOF
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    21
  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    22
  $ mkcommit() {
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    23
  >    echo "$1" > "$1"
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    24
  >    hg add "$1"
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    25
  >    hg ci -m "add $1"
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    26
  > }
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    27
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    28
  $ mkstack() {
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    29
  >    # Creates a stack of commit based on $1 with messages from $2, $3 ..
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    30
  >    hg update $1 -C
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    31
  >    shift
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    32
  >    mkcommits $*
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    33
  > }
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    34
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    35
  $ shaof() {
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    36
  >   hg log -T {node} -r "first(desc($1))"
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    37
  > }
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    38
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    39
  $ mkcommits() {
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    40
  >   for i in $@; do mkcommit $i ; done
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    41
  > }
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    42
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    43
Initial setup
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    44
  $ hg init testrevorder
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    45
  $ cd testrevorder
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    46
  $ mkcommits p _a _b _c
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    47
  $ hg phase --public 0
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    48
  $ hg up 'desc(_a)'
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    49
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    50
  $ echo "aaa" > _a
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    51
  $ hg amend
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    52
  2 new unstable changesets
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    53
  $ hg log -G
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    54
  @  5:12d519679175@default(draft) add _a
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    55
  |
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    56
  | o  3:4d156641b718@default(draft) add _c
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    57
  | |
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    58
  | o  2:4d7242ebb004@default(draft) add _b
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    59
  | |
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    60
  | x  1:2d73fcd7f07d@default(draft) add _a
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    61
  |/
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    62
  o  0:f92638be10c7@default(public) add p
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    63
  
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    64
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    65
evolve --rev reorders the rev to solve instability, trivial case 2 revs wrong order
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    66
  $ hg evolve --rev 'desc(_c) + desc(_b)'
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    67
  move:[2] add _b
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    68
  atop:[5] add _a
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    69
  move:[3] add _c
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    70
  atop:[6] add _b
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    71
  working directory is now at 52b8f9b04f83
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    72
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    73
evolve --rev reorders the rev to solve instability. Harder case, obsolescence
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    74
accross three stacks in growing rev numbers.
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    75
  $ hg up "desc(_c)"
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    76
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    77
  $ mkcommit d
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    78
  $ hg up "desc(_a)"
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    79
  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    80
  $ hg amend -m "aprime"
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    81
  3 new unstable changesets
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    82
  $ hg evolve --rev "desc(_b)"
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    83
  move:[6] add _b
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    84
  atop:[9] aprime
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    85
  working directory is now at 476c9c052aae
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    86
  $ hg up "desc(_b) - obsolete()"
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    87
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    88
  $ hg amend -m "bprime"
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    89
  $ hg up "desc(aprime)"
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    90
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    91
  $ hg amend -m "asecond"
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    92
  1 new unstable changesets
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    93
  $ hg log -G
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    94
  @  12:9a584314f3f3@default(draft) asecond
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    95
  |
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    96
  | o  11:a59c79776f7c@default(draft) bprime
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    97
  | |
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    98
  | x  9:81a687b96d4d@default(draft) aprime
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    99
  |/
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   100
  | o  8:2d86cc7ec3a9@default(draft) add d
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   101
  | |
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   102
  | o  7:52b8f9b04f83@default(draft) add _c
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   103
  | |
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   104
  | x  6:59476c3836ef@default(draft) add _b
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   105
  | |
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   106
  | x  5:12d519679175@default(draft) add _a
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   107
  |/
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   108
  o  0:f92638be10c7@default(public) add p
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   109
  
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   110
  $ hg evolve --rev "unstable()"
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   111
  move:[11] bprime
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   112
  atop:[12] asecond
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   113
  move:[7] add _c
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   114
  atop:[13] bprime
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   115
  move:[8] add d
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   116
  atop:[14] add _c
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   117
  working directory is now at fd447ba1b20b
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   118
  $ hg log -G
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   119
  @  15:fd447ba1b20b@default(draft) add d
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   120
  |
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   121
  o  14:0fc229278e4d@default(draft) add _c
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   122
  |
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   123
  o  13:c3741b9eafae@default(draft) bprime
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   124
  |
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   125
  o  12:9a584314f3f3@default(draft) asecond
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   126
  |
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   127
  o  0:f92638be10c7@default(public) add p
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   128
  
4ed67cce8c23 evolve: properly evolve stacked unstable with --rev
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   129