tests/test-convert-tla.t
author Martin von Zweigbergk <martinvonz@google.com>
Tue, 28 Oct 2014 22:47:22 -0700
changeset 25233 9789b4a7c595
parent 22046 7a9cbb315d84
child 30888 561a019c0268
permissions -rw-r--r--
match: introduce boolean prefix() method tl;dr: This is another step towards a (previously unstated) goal of eliminating match.files() in conditions. There are four types of matchers: * always: Matches everything, checked with always(), files() is empty * exact: Matches exact set of files, checked with isexact(), files() contains the files to match * patterns: Matches more complex patterns, checked with anypats(), files() contains roots of the matched patterns * prefix: Matches simple 'path:' patterns as prefixes ('foo' matches both 'foo' and 'foo/bar'), no single method to check, files() contains the prefixes to match For completeness, it would be nice to have a method for checking for the "prefix" type of matcher as well, so let's add that, making it return True simply when none of the others do. The larger goal here is to eliminate uses of match.files() in conditions (i.e. bool(match.files())). The reason for this is that there are scenarios when you would like to create a "prefix" matcher that happens to match no files. One example is for 'hg files -I foo bar'. The narrowmatcher also restricts the set of files given and it would not surprise me if have bugs caused by that already. Note that 'if m.files() and not m.anypats()' and similar is sometimes used to catch the "exact" and "prefix" cases above.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22046
7a9cbb315d84 tests: replace exit 80 with #require
Matt Mackall <mpm@selenic.com>
parents: 20117
diff changeset
     1
#require tla symlink
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
     2
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     3
  $ tla my-id "mercurial <mercurial@selenic.com>"
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     4
  $ echo "[extensions]" >> $HGRCPATH
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     5
  $ echo "convert=" >> $HGRCPATH
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     6
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     7
create tla archive
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
     8
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     9
  $ tla make-archive tla@mercurial--convert `pwd`/hg-test-convert-tla
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    10
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    11
initialize tla repo
6084
a672df805855 Document and fix tla/baz conversion tests
Patrick Mezard <pmezard@gmail.com>
parents: 6079
diff changeset
    12
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    13
  $ mkdir tla-repo
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    14
  $ cd tla-repo/
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    15
  $ tla init-tree tla@mercurial--convert/tla--test--0
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    16
  $ tla import
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    17
  * creating version tla@mercurial--convert/tla--test--0
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    18
  * imported tla@mercurial--convert/tla--test--0
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    19
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    20
create initial files
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    21
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    22
  $ echo 'this is a file' > a
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    23
  $ tla add a
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    24
  $ mkdir src
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    25
  $ tla add src
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    26
  $ cd src
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    27
  $ dd count=1 if=/dev/zero of=b > /dev/null 2> /dev/null
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    28
  $ tla add b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    29
  $ tla commit -s "added a file, src and src/b (binary)"
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    30
  A/ .arch-ids
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    31
  A/ src
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    32
  A/ src/.arch-ids
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    33
  A  .arch-ids/a.id
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    34
  A  a
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    35
  A  src/.arch-ids/=id
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    36
  A  src/.arch-ids/b.id
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    37
  A  src/b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    38
  * update pristine tree (tla@mercurial--convert/tla--test--0--base-0 => tla--test--0--patch-1)
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    39
  * committed tla@mercurial--convert/tla--test--0--patch-1
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    40
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    41
create link file and modify a
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    42
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    43
  $ ln -s ../a a-link
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    44
  $ tla add a-link
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    45
  $ echo 'this a modification to a' >> ../a
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    46
  $ tla commit -s "added link to a and modify a"
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    47
  A  src/.arch-ids/a-link.id
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    48
  A  src/a-link
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    49
  M  a
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    50
  * update pristine tree (tla@mercurial--convert/tla--test--0--patch-1 => tla--test--0--patch-2)
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    51
  * committed tla@mercurial--convert/tla--test--0--patch-2
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    52
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    53
create second link and modify b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    54
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    55
  $ ln -s ../a a-link-2
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    56
  $ tla add a-link-2
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    57
  $ dd count=1 seek=1 if=/dev/zero of=b > /dev/null 2> /dev/null
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    58
  $ tla commit -s "added second link and modify b"
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    59
  A  src/.arch-ids/a-link-2.id
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    60
  A  src/a-link-2
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    61
  Mb src/b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    62
  * update pristine tree (tla@mercurial--convert/tla--test--0--patch-2 => tla--test--0--patch-3)
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    63
  * committed tla@mercurial--convert/tla--test--0--patch-3
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    64
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    65
b file to link and a-link-2 to regular file
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    66
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    67
  $ rm -f a-link-2
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    68
  $ echo 'this is now a regular file' > a-link-2
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    69
  $ ln -sf ../a b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    70
  $ tla commit -s "file to link and link to file test"
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    71
  fl src/b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    72
  lf src/a-link-2
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    73
  * update pristine tree (tla@mercurial--convert/tla--test--0--patch-3 => tla--test--0--patch-4)
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    74
  * committed tla@mercurial--convert/tla--test--0--patch-4
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    75
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    76
move a-link-2 file and src directory
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    77
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    78
  $ cd ..
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    79
  $ tla mv src/a-link-2 c
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    80
  $ tla mv src test
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    81
  $ tla commit -s "move and rename a-link-2 file and src directory"
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    82
  D/ src/.arch-ids
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    83
  A/ test/.arch-ids
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    84
  /> src	test
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    85
  => src/.arch-ids/a-link-2.id	.arch-ids/c.id
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    86
  => src/a-link-2	c
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    87
  => src/.arch-ids/=id	test/.arch-ids/=id
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    88
  => src/.arch-ids/a-link.id	test/.arch-ids/a-link.id
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    89
  => src/.arch-ids/b.id	test/.arch-ids/b.id
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    90
  * update pristine tree (tla@mercurial--convert/tla--test--0--patch-4 => tla--test--0--patch-5)
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    91
  * committed tla@mercurial--convert/tla--test--0--patch-5
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    92
  $ cd ..
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    93
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    94
converting tla repo to Mercurial
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
    95
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    96
  $ hg convert tla-repo tla-repo-hg
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    97
  initializing destination tla-repo-hg repository
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    98
  analyzing tree version tla@mercurial--convert/tla--test--0...
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    99
  scanning source...
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   100
  sorting...
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   101
  converting...
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   102
  5 initial import
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   103
  4 added a file, src and src/b (binary)
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   104
  3 added link to a and modify a
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   105
  2 added second link and modify b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   106
  1 file to link and link to file test
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   107
  0 move and rename a-link-2 file and src directory
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   108
  $ tla register-archive -d tla@mercurial--convert
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   109
  $ glog()
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   110
  > {
20117
aa9385f983fa tests: don't load unnecessary graphlog extension
Martin Geisler <martin@geisler.net>
parents: 15441
diff changeset
   111
  >     hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   112
  > }
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
   113
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   114
show graph log
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff changeset
   115
12533
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   116
  $ glog -R tla-repo-hg
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   117
  o  5 "move and rename a-link-2 file and src directory" files: c src/a-link src/a-link-2 src/b test/a-link test/b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   118
  |
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   119
  o  4 "file to link and link to file test" files: src/a-link-2 src/b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   120
  |
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   121
  o  3 "added second link and modify b" files: src/a-link-2 src/b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   122
  |
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   123
  o  2 "added link to a and modify a" files: a src/a-link
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   124
  |
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   125
  o  1 "added a file, src and src/b (binary)" files: a src/b
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   126
  |
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   127
  o  0 "initial import" files:
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   128
  
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   129
  $ hg up -q -R tla-repo-hg
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   130
  $ hg -R tla-repo-hg manifest --debug
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   131
  c4072c4b72e1cabace081888efa148ee80ca3cbb 644   a
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   132
  0201ac32a3a8e86e303dff60366382a54b48a72e 644   c
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   133
  c0067ba5ff0b7c9a3eb17270839d04614c435623 644 @ test/a-link
068449e515e2 tests: unify test-convert-tla
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   134
  375f4263d86feacdea7e3c27100abd1560f2a973 644 @ test/b