annotate tests/test-symlink-basic @ 4359: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 af4f0d52f948
children 6a8e1dd18ba2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4264
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
1 #!/bin/sh
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
2
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
3 cat >> readlink.py <<EOF
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
4 import os
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
5 import sys
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
6
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
7 for f in sys.argv[1:]:
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
8 print f, '->', os.readlink(f)
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
9 EOF
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
10
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
11 hg init a
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
12 cd a
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
13 ln -s nothing dangling
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
14 hg add dangling
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
15 hg commit -m 'add symlink' -d '0 0'
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
16
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
17 hg tip -v
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
18 hg manifest --debug
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
19 echo '% rev 0:'
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
20 python ../readlink.py dangling
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
21
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
22 rm dangling
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
23 ln -s void dangling
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
24 hg commit -m 'change symlink'
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
25 echo '% rev 1:'
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
26 python ../readlink.py dangling
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
27
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
28 echo '% modifying link'
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
29 rm dangling
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
30 ln -s empty dangling
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
31 python ../readlink.py dangling
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
32
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
33 echo '% reverting to rev 0:'
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
34 hg revert -r 0 -a
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
35 python ../readlink.py dangling
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
36
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
37 echo '% backups:'
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
38 python ../readlink.py *.orig
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
39
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
40 rm *.orig
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
41 hg up -C
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
42 echo '% copies'
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
43 hg cp -v dangling dangling2
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
44 hg st -Cmard
af4f0d52f948 Add some tests for symlink tracking
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
45 python ../readlink.py dangling dangling2