annotate tests/test-newbranch @ 4188:dd0d9bd91e0a

dirstate.statwalk: explicitly test for ignored directories This removes a hack where we appended '/' to a dirname so that: - it would not appear on the "dc" dict - it would always be matched by the match function This was a contorted way of checking if the directory was matched by some hgignore pattern, and it would still fail with some uses of --include/--exclude patterns. Things would still work fine if we removed the check altogether and just appended things to "work" directly, but then we would end up walking ignored directories too, which could be quite a bit of work. This allows further simplification of the match function returned by util._matcher, and fixes walking the working directory with a --include pattern that matches only the end of a name.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sat, 10 Mar 2007 23:00:54 -0300
parents fc12ac3755d5
children aee3d312c32e a7af0eeae8a3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3435
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
1 #!/bin/sh
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
2
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
3 hg init t
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
4 cd t
3502
8dc14d630b29 add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents: 3451
diff changeset
5 hg branches
3435
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
6
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
7 echo foo > a
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
8 hg add a
3760
aeafd80c1e78 small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3502
diff changeset
9 hg ci -m "initial" -d "1000000 0"
3502
8dc14d630b29 add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents: 3451
diff changeset
10 hg branch foo
8dc14d630b29 add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents: 3451
diff changeset
11 hg branch
3760
aeafd80c1e78 small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3502
diff changeset
12 hg ci -m "add branch name" -d "1000000 0"
3502
8dc14d630b29 add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents: 3451
diff changeset
13 hg branch bar
3760
aeafd80c1e78 small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3502
diff changeset
14 hg ci -m "change branch name" -d "1000000 0"
3502
8dc14d630b29 add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents: 3451
diff changeset
15 hg branch ""
3760
aeafd80c1e78 small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3502
diff changeset
16 hg ci -m "clear branch name" -d "1000000 0"
3435
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
17
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
18 hg co foo
3502
8dc14d630b29 add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents: 3451
diff changeset
19 hg branch
3435
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
20 echo bleah > a
3760
aeafd80c1e78 small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3502
diff changeset
21 hg ci -m "modify a branch" -d "1000000 0"
3435
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
22
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
23 hg merge
3502
8dc14d630b29 add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents: 3451
diff changeset
24 hg branch
3760
aeafd80c1e78 small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3502
diff changeset
25 hg ci -m "merge" -d "1000000 0"
3435
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
26 hg log
2576b6731524 Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
27
3502
8dc14d630b29 add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents: 3451
diff changeset
28 hg branches
8dc14d630b29 add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents: 3451
diff changeset
29 hg branches -q
8dc14d630b29 add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents: 3451
diff changeset
30
3451
196baf20232b Add test for invalid branch cache (fixed by 27ebe4efe98e)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3435
diff changeset
31 echo % test for invalid branch cache
196baf20232b Add test for invalid branch cache (fixed by 27ebe4efe98e)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3435
diff changeset
32 hg rollback
3761
9433bdcaa9ae Ignore all errors while parsing the branch cache.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3760
diff changeset
33 cp .hg/branches.cache .hg/bc-invalid
3760
aeafd80c1e78 small fixes for test-newbranch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3502
diff changeset
34 hg log -r foo
3761
9433bdcaa9ae Ignore all errors while parsing the branch cache.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3760
diff changeset
35 cp .hg/bc-invalid .hg/branches.cache
9433bdcaa9ae Ignore all errors while parsing the branch cache.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3760
diff changeset
36 hg --debug log -r foo
9433bdcaa9ae Ignore all errors while parsing the branch cache.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3760
diff changeset
37 rm .hg/branches.cache
9433bdcaa9ae Ignore all errors while parsing the branch cache.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3760
diff changeset
38 echo corrupted > .hg/branches.cache
9433bdcaa9ae Ignore all errors while parsing the branch cache.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3760
diff changeset
39 hg log -qr foo
9433bdcaa9ae Ignore all errors while parsing the branch cache.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3760
diff changeset
40 cat .hg/branches.cache
4169
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
41
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
42 echo % test for different branch cache features
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
43 echo '4909a3732169c0c20011c4f4b8fdff4e3d89b23f 4' > .hg/branches.cache
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
44 hg branches --debug
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
45 echo ' features: unnamed dummy foo bar' > .hg/branches.cache
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
46 hg branches --debug
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
47 echo ' features: dummy' > .hg/branches.cache
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
48 hg branches --debug
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
49
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
50 echo % test old hg reading branch cache with feature list
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
51 python << EOF
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
52 import binascii
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
53 f = file('.hg/branches.cache')
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
54 lines = f.read().split('\n')
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
55 f.close()
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
56 firstline = lines[0]
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
57 last, lrev = lines.pop(0).rstrip().split(" ", 1)
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
58 try:
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
59 last, lrev = binascii.unhexlify(last), int(lrev)
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
60 except ValueError, inst:
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
61 if str(inst) == "invalid literal for int():%s" % firstline:
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
62 print "ValueError raised correctly, good."
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
63 else:
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
64 print "ValueError: %s" % inst
0182cb2e4aac Add tests for .hg/branches.cache feature list.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3761
diff changeset
65 EOF
4176
fc12ac3755d5 Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents: 4169
diff changeset
66
fc12ac3755d5 Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents: 4169
diff changeset
67 echo % update with no arguments: tipmost revision of the current branch
fc12ac3755d5 Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents: 4169
diff changeset
68 hg up -q -C 0
fc12ac3755d5 Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents: 4169
diff changeset
69 hg up -q
fc12ac3755d5 Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents: 4169
diff changeset
70 hg id
fc12ac3755d5 Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents: 4169
diff changeset
71 hg up -q 1
fc12ac3755d5 Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents: 4169
diff changeset
72 hg up -q
fc12ac3755d5 Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents: 4169
diff changeset
73 hg id