##// END OF EJS Templates
tests: unify test-extdiff
Adrian Buehlmann -
r12304:41dd368b default
parent child Browse files
Show More
@@ -1,73 +1,166 b''
1 #!/bin/sh
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "extdiff=" >> $HGRCPATH
2 3
3 echo "[extensions]" >> $HGRCPATH
4 echo "extdiff=" >> $HGRCPATH
4 $ hg init a
5 $ cd a
6 $ echo a > a
7 $ echo b > b
8 $ hg add
9 adding a
10 adding b
5 11
6 hg init a
7 cd a
8 echo a > a
9 echo b > b
10 hg add
11 # should diff cloned directories
12 hg extdiff -o -r $opt
12 Should diff cloned directories:
13
14 $ hg extdiff -o -r $opt
15 Only in a: a
16 Only in a: b
17
18 $ echo "[extdiff]" >> $HGRCPATH
19 $ echo "cmd.falabala=echo" >> $HGRCPATH
20 $ echo "opts.falabala=diffing" >> $HGRCPATH
21
22 $ hg falabala
23 diffing a.000000000000 a
13 24
14 echo "[extdiff]" >> $HGRCPATH
15 echo "cmd.falabala=echo" >> $HGRCPATH
16 echo "opts.falabala=diffing" >> $HGRCPATH
25 $ hg help falabala
26 hg falabala [OPTION]... [FILE]...
27
28 use 'echo' to diff repository (or selected files)
29
30 Show differences between revisions for the specified files, using the
31 'echo' program.
32
33 When two revision arguments are given, then changes are shown between
34 those revisions. If only one revision is specified then that revision is
35 compared to the working directory, and, when no revisions are specified,
36 the working directory files are compared to its parent.
37
38 options:
39
40 -o --option OPT [+] pass option to comparison program
41 -r --rev REV [+] revision
42 -c --change REV change made by revision
43 -I --include PATTERN [+] include names matching the given patterns
44 -X --exclude PATTERN [+] exclude names matching the given patterns
45
46 [+] marked option can be specified multiple times
47
48 use "hg -v help falabala" to show global options
17 49
18 hg falabala
19
20 hg help falabala
50 $ hg ci -d '0 0' -mtest1
21 51
22 hg ci -d '0 0' -mtest1
52 $ echo b >> a
53 $ hg ci -d '1 0' -mtest2
54
55 Should diff cloned files directly:
56
57 $ hg falabala -r 0:1
58 diffing a.8a5febb7f867/a a.34eed99112ab/a
59
60 Test diff during merge:
23 61
24 echo b >> a
25 hg ci -d '1 0' -mtest2
62 $ hg update -C 0
63 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
64 $ echo c >> c
65 $ hg add c
66 $ hg ci -m "new branch" -d '1 0'
67 created new head
68 $ hg merge 1
69 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
70 (branch merge, don't forget to commit)
26 71
27 # should diff cloned files directly
28 hg falabala -r 0:1
72 Should diff cloned file against wc file:
73
74 $ hg falabala > out
75
76 Cleanup the output since the wc is a tmp directory:
77
78 $ sed 's:\(diffing [^ ]* \).*\(\/test-extdiff\):\1[tmp]\2:' out
79 diffing a.2a13a4d2da36/a [tmp]/test-extdiff.t/a/a
80
81 Test --change option:
29 82
30 # test diff during merge
31 hg update -C 0
32 echo c >> c
33 hg add c
34 hg ci -m "new branch" -d '1 0'
35 hg merge 1
36 # should diff cloned file against wc file
37 hg falabala > out
38 # cleanup the output since the wc is a tmp directory
39 sed 's:\(diffing [^ ]* \).*\(\/test-extdiff\):\1[tmp]\2:' out
40 # test --change option
41 hg ci -d '2 0' -mtest3
42 hg falabala -c 1
43 # check diff are made from the first parent
44 hg falabala -c 3 || echo "diff-like tools yield a non-zero exit code"
45 #hg log
83 $ hg ci -d '2 0' -mtest3
84 $ hg falabala -c 1
85 diffing a.8a5febb7f867/a a.34eed99112ab/a
86
87 Check diff are made from the first parent:
88
89 $ hg falabala -c 3 || echo "diff-like tools yield a non-zero exit code"
90 diffing a.2a13a4d2da36/a a.46c0e4daeb72/a
91 diff-like tools yield a non-zero exit code
92
93 Test extdiff of multiple files in tmp dir:
94
95 $ hg update -C 0 > /dev/null
96 $ echo changed > a
97 $ echo changed > b
98 $ chmod +x b
99
100 Diff in working directory, before:
101
102 $ hg diff --git
103 diff --git a/a b/a
104 --- a/a
105 +++ b/a
106 @@ -1,1 +1,1 @@
107 -a
108 +changed
109 diff --git a/b b/b
110 old mode 100644
111 new mode 100755
112 --- a/b
113 +++ b/b
114 @@ -1,1 +1,1 @@
115 -b
116 +changed
117
118
119 Edit with extdiff -p:
120
121 Prepare custom diff/edit tool:
46 122
47 echo
48 echo '% test extdiff of multiple files in tmp dir:'
49 hg update -C 0 > /dev/null
50 echo changed > a
51 echo changed > b
52 chmod +x b
53 echo '% diff in working directory, before'
54 hg diff --git
55 echo '% edit with extdiff -p'
56 # prepare custom diff/edit tool
57 cat > 'diff tool.py' << EOT
58 #!/usr/bin/env python
59 import time
60 time.sleep(1) # avoid unchanged-timestamp problems
61 file('a/a', 'ab').write('edited\n')
62 file('a/b', 'ab').write('edited\n')
63 EOT
64 chmod +x 'diff tool.py'
65 hg extdiff -p "`pwd`/diff tool.py" # will change to /tmp/extdiff.TMP and populate directories a.TMP and a and start tool
66 echo '% diff in working directory, after'
67 hg diff --git
123 $ cat > 'diff tool.py' << EOT
124 > #!/usr/bin/env python
125 > import time
126 > time.sleep(1) # avoid unchanged-timestamp problems
127 > file('a/a', 'ab').write('edited\n')
128 > file('a/b', 'ab').write('edited\n')
129 > EOT
130
131 $ chmod +x 'diff tool.py'
132
133 # will change to /tmp/extdiff.TMP and populate directories a.TMP and a
134 # and start tool
135 $ hg extdiff -p "`pwd`/diff tool.py"
136
137 Diff in working directory, after:
68 138
69 echo
70 echo % test extdiff with --option
71 hg extdiff -p echo -o this -c 1
72 hg falabala -o this -c 1
73 echo
139 $ hg diff --git
140 diff --git a/a b/a
141 --- a/a
142 +++ b/a
143 @@ -1,1 +1,2 @@
144 -a
145 +changed
146 +edited
147 diff --git a/b b/b
148 old mode 100644
149 new mode 100755
150 --- a/b
151 +++ b/b
152 @@ -1,1 +1,2 @@
153 -b
154 +changed
155 +edited
156
157 Test extdiff with --option:
158
159 $ hg extdiff -p echo -o this -c 1
160 this a.8a5febb7f867/a a.34eed99112ab/a
161
162 $ hg falabala -o this -c 1
163 diffing this a.8a5febb7f867/a a.34eed99112ab/a
164
165 $ true
166
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now