tests/test-mq-caches.t
author Patrick Mezard <pmezard@gmail.com>
Sun, 06 Mar 2011 15:30:39 +0100
changeset 13542 6e3bf361f70c
parent 13272 5ccdca7df211
child 15885 222fb8a512eb
permissions -rw-r--r--
Merge with stable
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13272
5ccdca7df211 move tags.cache and branchheads.cache to a collected cache folder .hg/cache/
jfh <jason@jasonfharris.com>
parents: 12156
diff changeset
     1
  $ branches=.hg/cache/branchheads
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
     2
  $ echo '[extensions]' >> $HGRCPATH
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
     3
  $ echo 'mq =' >> $HGRCPATH
3492
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     4
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
     5
  $ show_branch_cache()
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
     6
  > {
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
     7
  >     # force cache (re)generation
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
     8
  >     hg log -r does-not-exist 2> /dev/null
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
     9
  >     hg log -r tip --template 'tip: {rev}\n'
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    10
  >     if [ -f $branches ]; then
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    11
  >       sort $branches
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    12
  >     else
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    13
  >       echo No branch cache
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    14
  >     fi
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    15
  >     if [ "$1" = 1 ]; then
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    16
  >       for b in foo bar; do
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    17
  >         hg log -r $b --template "branch $b: "'{rev}\n'
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    18
  >       done
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    19
  >     fi
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    20
  > }
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    21
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    22
  $ hg init a
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    23
  $ cd a
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    24
  $ hg qinit -c
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    25
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    26
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    27
mq patch on an empty repo
3492
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    28
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    29
  $ hg qnew p1
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    30
  $ show_branch_cache
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    31
  tip: 0
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    32
  No branch cache
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    33
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    34
  $ echo > pfile
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    35
  $ hg add pfile
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    36
  $ hg qrefresh -m 'patch 1'
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    37
  $ show_branch_cache
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    38
  tip: 0
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    39
  No branch cache
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    40
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    41
some regular revisions
3492
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    42
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    43
  $ hg qpop
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    44
  popping p1
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    45
  patch queue now empty
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    46
  $ echo foo > foo
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    47
  $ hg add foo
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    48
  $ echo foo > .hg/branch
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    49
  $ hg ci -m 'branch foo'
3492
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    50
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    51
  $ echo bar > bar
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    52
  $ hg add bar
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    53
  $ echo bar > .hg/branch
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    54
  $ hg ci -m 'branch bar'
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    55
  $ show_branch_cache
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    56
  tip: 1
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    57
  c229711f16da3d7591f89b1b8d963b79bda22714 1
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    58
  c229711f16da3d7591f89b1b8d963b79bda22714 bar
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    59
  dc25e3827021582e979f600811852e36cbe57341 foo
3492
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    60
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    61
add some mq patches
3492
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    62
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    63
  $ hg qpush
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    64
  applying p1
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    65
  now at: p1
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    66
  $ show_branch_cache
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    67
  tip: 2
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    68
  c229711f16da3d7591f89b1b8d963b79bda22714 1
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    69
  c229711f16da3d7591f89b1b8d963b79bda22714 bar
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    70
  dc25e3827021582e979f600811852e36cbe57341 foo
3492
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    71
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    72
  $ hg qnew p2
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    73
  $ echo foo > .hg/branch
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    74
  $ echo foo2 >> foo
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    75
  $ hg qrefresh -m 'patch 2'
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    76
  $ show_branch_cache 1
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    77
  tip: 3
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    78
  c229711f16da3d7591f89b1b8d963b79bda22714 1
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    79
  c229711f16da3d7591f89b1b8d963b79bda22714 bar
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    80
  dc25e3827021582e979f600811852e36cbe57341 foo
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    81
  branch foo: 3
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    82
  branch bar: 2
3492
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    83
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    84
removing the cache
3492
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    85
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    86
  $ rm $branches
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    87
  $ show_branch_cache 1
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    88
  tip: 3
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    89
  c229711f16da3d7591f89b1b8d963b79bda22714 1
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    90
  c229711f16da3d7591f89b1b8d963b79bda22714 bar
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    91
  dc25e3827021582e979f600811852e36cbe57341 foo
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    92
  branch foo: 3
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    93
  branch bar: 2
3492
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    94
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    95
importing rev 1 (the cache now ends in one of the patches)
3492
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    96
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    97
  $ hg qimport -r 1 -n p0
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    98
  $ show_branch_cache 1
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    99
  tip: 3
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
   100
  c229711f16da3d7591f89b1b8d963b79bda22714 1
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
   101
  c229711f16da3d7591f89b1b8d963b79bda22714 bar
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
   102
  dc25e3827021582e979f600811852e36cbe57341 foo
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   103
  branch foo: 3
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   104
  branch bar: 2
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   105
  $ hg log -r qbase --template 'qbase: {rev}\n'
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   106
  qbase: 1
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   107
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   108
detect an invalid cache
3492
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
   109
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   110
  $ hg qpop -a
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   111
  popping p2
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   112
  popping p1
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   113
  popping p0
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   114
  patch queue now empty
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   115
  $ hg qpush -a
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   116
  applying p0
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   117
  applying p1
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   118
  applying p2
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   119
  now at: p2
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   120
  $ show_branch_cache
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   121
  tip: 3
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
   122
  dc25e3827021582e979f600811852e36cbe57341 0
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
   123
  dc25e3827021582e979f600811852e36cbe57341 foo
3492
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
   124