##// 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 $ hg init a
4 echo "extdiff=" >> $HGRCPATH
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
12 Should diff cloned directories:
7 cd a
13
8 echo a > a
14 $ hg extdiff -o -r $opt
9 echo b > b
15 Only in a: a
10 hg add
16 Only in a: b
11 # should diff cloned directories
17
12 hg extdiff -o -r $opt
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
25 $ hg help falabala
15 echo "cmd.falabala=echo" >> $HGRCPATH
26 hg falabala [OPTION]... [FILE]...
16 echo "opts.falabala=diffing" >> $HGRCPATH
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
50 $ hg ci -d '0 0' -mtest1
19
20 hg help falabala
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
62 $ hg update -C 0
25 hg ci -d '1 0' -mtest2
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
72 Should diff cloned file against wc file:
28 hg falabala -r 0:1
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
83 $ hg ci -d '2 0' -mtest3
31 hg update -C 0
84 $ hg falabala -c 1
32 echo c >> c
85 diffing a.8a5febb7f867/a a.34eed99112ab/a
33 hg add c
86
34 hg ci -m "new branch" -d '1 0'
87 Check diff are made from the first parent:
35 hg merge 1
88
36 # should diff cloned file against wc file
89 $ hg falabala -c 3 || echo "diff-like tools yield a non-zero exit code"
37 hg falabala > out
90 diffing a.2a13a4d2da36/a a.46c0e4daeb72/a
38 # cleanup the output since the wc is a tmp directory
91 diff-like tools yield a non-zero exit code
39 sed 's:\(diffing [^ ]* \).*\(\/test-extdiff\):\1[tmp]\2:' out
92
40 # test --change option
93 Test extdiff of multiple files in tmp dir:
41 hg ci -d '2 0' -mtest3
94
42 hg falabala -c 1
95 $ hg update -C 0 > /dev/null
43 # check diff are made from the first parent
96 $ echo changed > a
44 hg falabala -c 3 || echo "diff-like tools yield a non-zero exit code"
97 $ echo changed > b
45 #hg log
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
123 $ cat > 'diff tool.py' << EOT
48 echo '% test extdiff of multiple files in tmp dir:'
124 > #!/usr/bin/env python
49 hg update -C 0 > /dev/null
125 > import time
50 echo changed > a
126 > time.sleep(1) # avoid unchanged-timestamp problems
51 echo changed > b
127 > file('a/a', 'ab').write('edited\n')
52 chmod +x b
128 > file('a/b', 'ab').write('edited\n')
53 echo '% diff in working directory, before'
129 > EOT
54 hg diff --git
130
55 echo '% edit with extdiff -p'
131 $ chmod +x 'diff tool.py'
56 # prepare custom diff/edit tool
132
57 cat > 'diff tool.py' << EOT
133 # will change to /tmp/extdiff.TMP and populate directories a.TMP and a
58 #!/usr/bin/env python
134 # and start tool
59 import time
135 $ hg extdiff -p "`pwd`/diff tool.py"
60 time.sleep(1) # avoid unchanged-timestamp problems
136
61 file('a/a', 'ab').write('edited\n')
137 Diff in working directory, after:
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
68
138
69 echo
139 $ hg diff --git
70 echo % test extdiff with --option
140 diff --git a/a b/a
71 hg extdiff -p echo -o this -c 1
141 --- a/a
72 hg falabala -o this -c 1
142 +++ b/a
73 echo
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
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now