tests/test-mq-caches.t
author Pierre-Yves David <pierre-yves.david@logilab.fr>
Fri, 28 Dec 2012 00:13:32 +0100
changeset 18166 3a2e810dd3d8
parent 17013 c8eda7bbdcab
permissions -rw-r--r--
branchmap: improve invalid cache message when reading This factors out the generation of the message. This helps future error reporting when reading cache for filtered repository.
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
15885
222fb8a512eb tests: make qnew in test-mq-caches.t stable
Mads Kiilerich <mads@kiilerich.com>
parents: 13272
diff changeset
    29
  $ hg qnew -d '0 0' p1
11897
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
16101
20ad8f0512a2 mq: restore _branchtags() fast path (issue3223)
Patrick Mezard <patrick@mezard.eu>
parents: 15886
diff changeset
    32
  No branch cache
11897
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
17013
c8eda7bbdcab strip: incrementally update the branchheads cache after a strip
Joshua Redstone <joshua.redstone@fb.com>
parents: 16913
diff changeset
    39
  d986d5caac23a7d44a46efc0ddaf5eb9665844cf 0
c8eda7bbdcab strip: incrementally update the branchheads cache after a strip
Joshua Redstone <joshua.redstone@fb.com>
parents: 16913
diff changeset
    40
  d986d5caac23a7d44a46efc0ddaf5eb9665844cf default
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    41
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    42
some regular revisions
3492
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    43
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    44
  $ hg qpop
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    45
  popping p1
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    46
  patch queue now empty
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    47
  $ echo foo > foo
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    48
  $ hg add foo
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    49
  $ echo foo > .hg/branch
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    50
  $ 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
    51
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    52
  $ echo bar > bar
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    53
  $ hg add bar
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    54
  $ echo bar > .hg/branch
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    55
  $ hg ci -m 'branch bar'
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    56
  $ show_branch_cache
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    57
  tip: 1
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    58
  c229711f16da3d7591f89b1b8d963b79bda22714 1
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    59
  c229711f16da3d7591f89b1b8d963b79bda22714 bar
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    60
  dc25e3827021582e979f600811852e36cbe57341 foo
3492
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    61
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    62
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
    63
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    64
  $ hg qpush
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    65
  applying p1
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    66
  now at: p1
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    67
  $ show_branch_cache
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    68
  tip: 2
16101
20ad8f0512a2 mq: restore _branchtags() fast path (issue3223)
Patrick Mezard <patrick@mezard.eu>
parents: 15886
diff changeset
    69
  c229711f16da3d7591f89b1b8d963b79bda22714 1
20ad8f0512a2 mq: restore _branchtags() fast path (issue3223)
Patrick Mezard <patrick@mezard.eu>
parents: 15886
diff changeset
    70
  c229711f16da3d7591f89b1b8d963b79bda22714 bar
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    71
  dc25e3827021582e979f600811852e36cbe57341 foo
3492
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    72
15885
222fb8a512eb tests: make qnew in test-mq-caches.t stable
Mads Kiilerich <mads@kiilerich.com>
parents: 13272
diff changeset
    73
  $ hg qnew -d '0 0' p2
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    74
  $ echo foo > .hg/branch
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    75
  $ echo foo2 >> foo
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    76
  $ hg qrefresh -m 'patch 2'
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    77
  $ show_branch_cache 1
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    78
  tip: 3
17013
c8eda7bbdcab strip: incrementally update the branchheads cache after a strip
Joshua Redstone <joshua.redstone@fb.com>
parents: 16913
diff changeset
    79
  982611f6955f9c48d3365decea203217c945ef0d 2
c8eda7bbdcab strip: incrementally update the branchheads cache after a strip
Joshua Redstone <joshua.redstone@fb.com>
parents: 16913
diff changeset
    80
  982611f6955f9c48d3365decea203217c945ef0d bar
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    81
  dc25e3827021582e979f600811852e36cbe57341 foo
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    82
  branch foo: 3
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    83
  branch bar: 2
3492
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    84
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    85
removing the cache
3492
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    86
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    87
  $ rm $branches
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    88
  $ show_branch_cache 1
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    89
  tip: 3
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    90
  c229711f16da3d7591f89b1b8d963b79bda22714 1
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    91
  c229711f16da3d7591f89b1b8d963b79bda22714 bar
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
    92
  dc25e3827021582e979f600811852e36cbe57341 foo
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    93
  branch foo: 3
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    94
  branch bar: 2
3492
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    95
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    96
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
    97
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    98
  $ hg qimport -r 1 -n p0
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    99
  $ show_branch_cache 1
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   100
  tip: 3
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
   101
  c229711f16da3d7591f89b1b8d963b79bda22714 1
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
   102
  c229711f16da3d7591f89b1b8d963b79bda22714 bar
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11897
diff changeset
   103
  dc25e3827021582e979f600811852e36cbe57341 foo
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   104
  branch foo: 3
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   105
  branch bar: 2
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   106
  $ hg log -r qbase --template 'qbase: {rev}\n'
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   107
  qbase: 1
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   108
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   109
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
   110
11897
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   111
  $ hg qpop -a
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   112
  popping p2
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   113
  popping p1
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   114
  popping p0
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   115
  patch queue now empty
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   116
  $ hg qpush -a
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   117
  applying p0
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   118
  applying p1
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   119
  applying p2
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   120
  now at: p2
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   121
  $ show_branch_cache
0e4bbe18ff95 tests: unify test-mq-caches
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   122
  tip: 3
16101
20ad8f0512a2 mq: restore _branchtags() fast path (issue3223)
Patrick Mezard <patrick@mezard.eu>
parents: 15886
diff changeset
   123
  dc25e3827021582e979f600811852e36cbe57341 0
20ad8f0512a2 mq: restore _branchtags() fast path (issue3223)
Patrick Mezard <patrick@mezard.eu>
parents: 15886
diff changeset
   124
  dc25e3827021582e979f600811852e36cbe57341 foo
3492
fbf8320f25c8 make mq play nicely with the branch cache
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
   125
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16745
diff changeset
   126
  $ cd ..