annotate tests/test-locate @ 5192:33015dac5df5

convert: fix mercurial_sink.putcommit Changeset 4ebc8693ce72 added some code to putcommit to avoid creating a revision that touches no files, but this can break regular conversions from some repositories: - conceptually, since we're converting a repo, we should try to make the new hg repo as similar as possible to the original repo - we should create a new changeset, even if the original revision didn't touch any files (maybe the commit message had some important bit); - even if a "regular" revision that doesn't touch any file may seem weird (and maybe even broken), it's completely legitimate for a merge revision to not touch any file, and, if we just skip it, the converted repo will end up with wrong history and possibly an extra head. As an example, say the crew and main hg repos are sync'ed. Somebody sends an important patch to the mailing list. Matt quickly applies and pushes it. But at the same time somebody also applies it to crew and pushes it. Suppose the commit message ended up being a bit different (say, there was a typo and somebody didn't fix it) or that the date ended up being different (because of different patch-applying scripts): the changeset hashes will be different, but the manifests will be the same. Since both changesets were pushed to public repos, it's hard to recall them. If both are merged, the manifest from the resulting merge revision will have the exact same contents as its parents - i.e. the merge revision really doesn't touch any file at all. To keep the file filtering stuff "working", the generic code was changed to skip empty revisions if we're filtering the repo, fixing a bug in the process (we want parents[0] instead of tip).
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 17 Aug 2007 20:18:05 -0300
parents a5cde03cd019
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1622
5e9168401a68 fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
1 #!/bin/sh
4234
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
2
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
3 hglocate()
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
4 {
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
5 echo "hg locate $@"
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
6 hg locate "$@"
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
7 ret=$?
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
8 echo
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
9 return $ret
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
10 }
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
11
1622
5e9168401a68 fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
12 mkdir t
5e9168401a68 fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
13 cd t
5e9168401a68 fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
14 hg init
5e9168401a68 fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
15 echo 0 > a
5e9168401a68 fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
16 echo 0 > b
2487
041363739ca8 Test case for #294
Brendan Cully <brendan@kublai.com>
parents: 2480
diff changeset
17 echo 0 > t.h
2480
519a1011db91 fix -I/-X when relative paths used or in subdir
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
18 mkdir t
519a1011db91 fix -I/-X when relative paths used or in subdir
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
19 echo 0 > t/x
4235
eca3277c4220 add some more tests to hg locate
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4234
diff changeset
20 echo 0 > t/b
eca3277c4220 add some more tests to hg locate
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4234
diff changeset
21 echo 0 > t/e.h
4304
702f48570eb3 change relglob: patterns to be consistent with glob: patterns
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4235
diff changeset
22 mkdir dir.h
702f48570eb3 change relglob: patterns to be consistent with glob: patterns
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4235
diff changeset
23 echo 0 > dir.h/foo
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1622
diff changeset
24 hg ci -A -m m -d "1000000 0"
1622
5e9168401a68 fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
25 touch nottracked
4234
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
26 hglocate a && echo locate succeeded || echo locate failed
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
27 hglocate NONEXISTENT && echo locate succeeded || echo locate failed
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
28 hglocate
1622
5e9168401a68 fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
29 hg rm a
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1622
diff changeset
30 hg ci -m m -d "1000000 0"
4234
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
31 hglocate a
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
32 hglocate NONEXISTENT
4305
a5cde03cd019 locate: don't print "file not found" messages.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4304
diff changeset
33 hglocate relpath:NONEXISTENT
4234
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
34 hglocate
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
35 hglocate -r 0 a
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
36 hglocate -r 0 NONEXISTENT
4305
a5cde03cd019 locate: don't print "file not found" messages.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4304
diff changeset
37 hglocate -r 0 relpath:NONEXISTENT
4234
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
38 hglocate -r 0
2480
519a1011db91 fix -I/-X when relative paths used or in subdir
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
39 echo % -I/-X with relative path should work
519a1011db91 fix -I/-X when relative paths used or in subdir
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
40 cd t
4234
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
41 hglocate
fe0c0a317c09 make the output of test-locate more readable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4191
diff changeset
42 hglocate -I ../t
2487
041363739ca8 Test case for #294
Brendan Cully <brendan@kublai.com>
parents: 2480
diff changeset
43 # test issue294
041363739ca8 Test case for #294
Brendan Cully <brendan@kublai.com>
parents: 2480
diff changeset
44 cd ..
3988
9dcf9d45cab8 Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2487
diff changeset
45 rm -r t
4304
702f48570eb3 change relglob: patterns to be consistent with glob: patterns
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4235
diff changeset
46 hglocate 't/**'
4235
eca3277c4220 add some more tests to hg locate
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4234
diff changeset
47 mkdir otherdir
eca3277c4220 add some more tests to hg locate
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4234
diff changeset
48 cd otherdir
eca3277c4220 add some more tests to hg locate
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4234
diff changeset
49 hglocate b
eca3277c4220 add some more tests to hg locate
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4234
diff changeset
50 hglocate '*.h'
eca3277c4220 add some more tests to hg locate
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4234
diff changeset
51 hglocate path:t/x
4304
702f48570eb3 change relglob: patterns to be consistent with glob: patterns
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4235
diff changeset
52 hglocate 're:.*\.h$'
4235
eca3277c4220 add some more tests to hg locate
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4234
diff changeset
53 hglocate -r 0 b
eca3277c4220 add some more tests to hg locate
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4234
diff changeset
54 hglocate -r 0 '*.h'
eca3277c4220 add some more tests to hg locate
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4234
diff changeset
55 hglocate -r 0 path:t/x
4304
702f48570eb3 change relglob: patterns to be consistent with glob: patterns
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4235
diff changeset
56 hglocate -r 0 're:.*\.h$'