Mercurial > hg
annotate tests/test-symlinks @ 4363:2e3c54fb79a3
actually port simplemerge to hg
- use bdiff instead of patiencediff; this is a larger change, since
bdiff works on 2 multi-line strings, while patiencediff works on 2
lists;
- rename the main class from Merge3 to Merge3Text and add a Merge3
class that derives from Merge3Text. This new Merge3 class has
the same interface from the original class, so that the tests
still work;
- Merge3 uses util.binary to detect binary data and raises
util.Abort instead of a specific exception;
- don't use the @decorator syntax, to keep python2.3 compatibility;
- the test uses unittest, which likes to print how long it took to
run. This obviously doesn't play too well with hg's test suite,
so we override time.time to fool unittest;
- one test has a different (but still valid) output because of the
different diff algorithm used;
- the TestCase class used by bzr has some extras to help debugging.
test-merge3.py used 2 of them:
- log method to log some data
- assertEqualDiff method to ease viewing diffs of diffs
We add a dummy log method and use regular assertEquals instead of
assertEqualDiff.
- make simplemerge executable and add "#!/usr/bin/env python" header
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Mon, 16 Apr 2007 20:17:39 -0300 |
parents | 26596a6b6518 |
children | 25d753efd48e |
rev | line source |
---|---|
1408 | 1 #!/bin/sh |
2 #Test bug regarding symlinks that showed up in hg 0.7 | |
3 #Author: Matthew Elder <sseses@gmail.com> | |
4 | |
5 #make and initialize repo | |
6 hg init test; cd test; | |
7 | |
8 #make a file and a symlink | |
9 touch foo; ln -s foo bar; | |
10 | |
11 #import with addremove -- symlink walking should _not_ screwup. | |
12 hg addremove | |
13 | |
14 #commit -- the symlink should _not_ appear added to dir state | |
15 hg commit -m 'initial' | |
16 | |
17 #add a new file so hg will let me commit again | |
18 touch bomb | |
19 | |
20 #again, symlink should _not_ show up on dir state | |
21 hg addremove | |
22 | |
23 #Assert screamed here before, should go by without consequence | |
24 hg commit -m 'is there a bug?' | |
1487
2bc6cd62a29c
fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1408
diff
changeset
|
25 |
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:
3750
diff
changeset
|
26 cd .. ; rm -r test |
1487
2bc6cd62a29c
fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1408
diff
changeset
|
27 hg init test; cd test; |
2bc6cd62a29c
fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1408
diff
changeset
|
28 |
2bc6cd62a29c
fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1408
diff
changeset
|
29 mkdir dir |
2bc6cd62a29c
fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1408
diff
changeset
|
30 touch a.c dir/a.o dir/b.o |
2bc6cd62a29c
fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1408
diff
changeset
|
31 # test what happens if we want to trick hg |
2bc6cd62a29c
fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1408
diff
changeset
|
32 hg commit -A -m 0 |
2bc6cd62a29c
fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1408
diff
changeset
|
33 echo "relglob:*.o" > .hgignore |
2bc6cd62a29c
fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1408
diff
changeset
|
34 rm a.c |
2bc6cd62a29c
fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1408
diff
changeset
|
35 rm dir/a.o |
2bc6cd62a29c
fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1408
diff
changeset
|
36 rm dir/b.o |
2bc6cd62a29c
fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1408
diff
changeset
|
37 mkdir dir/a.o |
3750
0f550b87deb8
Compatibility fix for 'ln -sf'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2115
diff
changeset
|
38 ln -s nonexist dir/b.o |
1487
2bc6cd62a29c
fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1408
diff
changeset
|
39 mkfifo a.c |
1620
6c61646fee5e
Adjusted all but one test output for the new behaviour of localrepo.changes()
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1527
diff
changeset
|
40 # it should show a.c, dir/a.o and dir/b.o deleted |
1487
2bc6cd62a29c
fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1408
diff
changeset
|
41 hg status |
1527
c13fce7167c2
don't print anything about file of unsupported type unless
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1487
diff
changeset
|
42 hg status a.c |
2115
fd77b7ee4aac
Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents:
1620
diff
changeset
|
43 |
fd77b7ee4aac
Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents:
1620
diff
changeset
|
44 echo '# test absolute path through symlink outside repo' |
fd77b7ee4aac
Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents:
1620
diff
changeset
|
45 cd .. |
fd77b7ee4aac
Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents:
1620
diff
changeset
|
46 p=`pwd` |
fd77b7ee4aac
Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents:
1620
diff
changeset
|
47 hg init x |
fd77b7ee4aac
Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents:
1620
diff
changeset
|
48 ln -s x y |
fd77b7ee4aac
Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents:
1620
diff
changeset
|
49 cd x |
fd77b7ee4aac
Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents:
1620
diff
changeset
|
50 touch f |
fd77b7ee4aac
Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents:
1620
diff
changeset
|
51 hg add f |
fd77b7ee4aac
Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents:
1620
diff
changeset
|
52 hg status $p/y/f |
fd77b7ee4aac
Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents:
1620
diff
changeset
|
53 |
fd77b7ee4aac
Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents:
1620
diff
changeset
|
54 echo '# try symlink outside repo to file inside' |
fd77b7ee4aac
Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents:
1620
diff
changeset
|
55 ln -s x/f ../z |
fd77b7ee4aac
Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents:
1620
diff
changeset
|
56 # this should fail |
fd77b7ee4aac
Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents:
1620
diff
changeset
|
57 hg status ../z && { echo hg mistakenly exited with status 0; exit 1; } || : |
4137
26596a6b6518
Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
3988
diff
changeset
|
58 |
26596a6b6518
Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
3988
diff
changeset
|
59 cd .. ; rm -r test |
26596a6b6518
Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
3988
diff
changeset
|
60 hg init test; cd test; |
26596a6b6518
Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
3988
diff
changeset
|
61 |
26596a6b6518
Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
3988
diff
changeset
|
62 echo '# try cloning symlink in a subdir' |
26596a6b6518
Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
3988
diff
changeset
|
63 echo '1. commit a symlink' |
26596a6b6518
Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
3988
diff
changeset
|
64 mkdir -p a/b/c |
26596a6b6518
Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
3988
diff
changeset
|
65 cd a/b/c |
26596a6b6518
Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
3988
diff
changeset
|
66 ln -s /path/to/symlink/source demo |
26596a6b6518
Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
3988
diff
changeset
|
67 cd ../../.. |
26596a6b6518
Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
3988
diff
changeset
|
68 hg stat |
26596a6b6518
Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
3988
diff
changeset
|
69 hg commit -A -m 'add symlink in a/b/c subdir' |
26596a6b6518
Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
3988
diff
changeset
|
70 echo '2. clone it' |
26596a6b6518
Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
3988
diff
changeset
|
71 cd .. |
26596a6b6518
Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
3988
diff
changeset
|
72 hg clone test testclone |