Show More
@@ -148,6 +148,7 b' diffopts2 = [' | |||||
148 | ('U', 'unified', '', |
|
148 | ('U', 'unified', '', | |
149 | _('number of lines of context to show'), _('NUM')), |
|
149 | _('number of lines of context to show'), _('NUM')), | |
150 | ('', 'stat', None, _('output diffstat-style summary of changes')), |
|
150 | ('', 'stat', None, _('output diffstat-style summary of changes')), | |
|
151 | ('', 'relative', '', _('produce diffs relative to subdirectory'), _('DIR')), | |||
151 | ] |
|
152 | ] | |
152 |
|
153 | |||
153 | mergetoolopts = [ |
|
154 | mergetoolopts = [ | |
@@ -3169,7 +3170,8 b' def diff(ui, repo, *pats, **opts):' | |||||
3169 | diffopts = patch.diffallopts(ui, opts) |
|
3170 | diffopts = patch.diffallopts(ui, opts) | |
3170 | m = scmutil.match(repo[node2], pats, opts) |
|
3171 | m = scmutil.match(repo[node2], pats, opts) | |
3171 | cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat, |
|
3172 | cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat, | |
3172 |
listsubrepos=opts.get('subrepos') |
|
3173 | listsubrepos=opts.get('subrepos'), | |
|
3174 | relative=opts.get('relative')) | |||
3173 |
|
3175 | |||
3174 | @command('^export', |
|
3176 | @command('^export', | |
3175 | [('o', 'output', '', |
|
3177 | [('o', 'output', '', |
@@ -203,7 +203,7 b' Show all commands + options' | |||||
203 | annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, ignore-all-space, ignore-space-change, ignore-blank-lines, include, exclude, template |
|
203 | annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, ignore-all-space, ignore-space-change, ignore-blank-lines, include, exclude, template | |
204 | clone: noupdate, updaterev, rev, branch, pull, uncompressed, ssh, remotecmd, insecure |
|
204 | clone: noupdate, updaterev, rev, branch, pull, uncompressed, ssh, remotecmd, insecure | |
205 | commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos |
|
205 | commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos | |
206 | diff: rev, change, text, git, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, stat, include, exclude, subrepos |
|
206 | diff: rev, change, text, git, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, stat, relative, include, exclude, subrepos | |
207 | export: output, switch-parent, rev, text, git, nodates |
|
207 | export: output, switch-parent, rev, text, git, nodates | |
208 | forget: include, exclude |
|
208 | forget: include, exclude | |
209 | init: ssh, remotecmd, insecure |
|
209 | init: ssh, remotecmd, insecure |
@@ -44,4 +44,24 b' inside beta' | |||||
44 | @@ -0,0 +1,1 @@ |
|
44 | @@ -0,0 +1,1 @@ | |
45 | +2 |
|
45 | +2 | |
46 |
|
46 | |||
|
47 | relative to beta | |||
|
48 | ||||
47 | $ cd .. |
|
49 | $ cd .. | |
|
50 | $ hg diff --nodates --relative beta | |||
|
51 | diff -r 7d5ef1aea329 two | |||
|
52 | --- a/two | |||
|
53 | +++ b/two | |||
|
54 | @@ -0,0 +1,1 @@ | |||
|
55 | +2 | |||
|
56 | ||||
|
57 | inside beta | |||
|
58 | ||||
|
59 | $ cd beta | |||
|
60 | $ hg diff --nodates --relative . | |||
|
61 | diff -r 7d5ef1aea329 two | |||
|
62 | --- a/two | |||
|
63 | +++ b/two | |||
|
64 | @@ -0,0 +1,1 @@ | |||
|
65 | +2 | |||
|
66 | ||||
|
67 | $ cd .. |
@@ -69,4 +69,39 b' Filename with spaces git diffstat:' | |||||
69 | file with spaces | Bin |
|
69 | file with spaces | Bin | |
70 | 1 files changed, 0 insertions(+), 0 deletions(-) |
|
70 | 1 files changed, 0 insertions(+), 0 deletions(-) | |
71 |
|
71 | |||
|
72 | diffstat within directories: | |||
|
73 | ||||
|
74 | $ hg rm -f 'file with spaces' | |||
|
75 | ||||
|
76 | $ mkdir dir1 dir2 | |||
|
77 | $ echo new1 > dir1/new | |||
|
78 | $ echo new2 > dir2/new | |||
|
79 | $ hg add dir1/new dir2/new | |||
|
80 | $ hg diff --stat | |||
|
81 | dir1/new | 1 + | |||
|
82 | dir2/new | 1 + | |||
|
83 | 2 files changed, 2 insertions(+), 0 deletions(-) | |||
|
84 | ||||
|
85 | $ hg diff --stat --relative dir1 | |||
|
86 | new | 1 + | |||
|
87 | 1 files changed, 1 insertions(+), 0 deletions(-) | |||
|
88 | ||||
|
89 | $ hg diff --stat --relative dir1 dir2 | |||
|
90 | warning: dir2 not inside relative root dir1 | |||
|
91 | ||||
|
92 | $ hg diff --stat --relative dir1 -I dir1/old | |||
|
93 | ||||
|
94 | $ cd dir1 | |||
|
95 | $ hg diff --stat . | |||
|
96 | dir1/new | 1 + | |||
|
97 | 1 files changed, 1 insertions(+), 0 deletions(-) | |||
|
98 | $ hg diff --stat --relative . | |||
|
99 | new | 1 + | |||
|
100 | 1 files changed, 1 insertions(+), 0 deletions(-) | |||
|
101 | ||||
|
102 | $ hg diff --stat --relative ../dir1 ../dir2 | |||
|
103 | warning: ../dir2 not inside relative root . | |||
|
104 | ||||
|
105 | $ hg diff --stat --relative . -I old | |||
|
106 | ||||
72 | $ cd .. |
|
107 | $ cd .. |
@@ -5,46 +5,279 b'' | |||||
5 |
|
5 | |||
6 | New file: |
|
6 | New file: | |
7 |
|
7 | |||
8 | $ echo new > new |
|
8 | $ mkdir dir1 | |
|
9 | $ echo new > dir1/new | |||
9 |
$ |
|
10 | $ hg ci -Amnew | |
10 | adding new |
|
11 | adding dir1/new | |
11 | $ hg diff --git -r 0 |
|
12 | $ hg diff --git -r 0 | |
12 | diff --git a/new b/new |
|
13 | diff --git a/dir1/new b/dir1/new | |
13 | new file mode 100644 |
|
14 | new file mode 100644 | |
14 | --- /dev/null |
|
15 | --- /dev/null | |
15 | +++ b/new |
|
16 | +++ b/dir1/new | |
16 | @@ -0,0 +1,1 @@ |
|
17 | @@ -0,0 +1,1 @@ | |
17 | +new |
|
18 | +new | |
18 |
|
19 | |||
19 | Copy: |
|
20 | Copy: | |
20 |
|
21 | |||
21 | $ hg cp new copy |
|
22 | $ mkdir dir2 | |
|
23 | $ hg cp dir1/new dir1/copy | |||
|
24 | $ echo copy1 >> dir1/copy | |||
|
25 | $ hg cp dir1/new dir2/copy | |||
|
26 | $ echo copy2 >> dir2/copy | |||
22 | $ hg ci -mcopy |
|
27 | $ hg ci -mcopy | |
23 | $ hg diff --git -r 1:tip |
|
28 | $ hg diff --git -r 1:tip | |
|
29 | diff --git a/dir1/new b/dir1/copy | |||
|
30 | copy from dir1/new | |||
|
31 | copy to dir1/copy | |||
|
32 | --- a/dir1/new | |||
|
33 | +++ b/dir1/copy | |||
|
34 | @@ -1,1 +1,2 @@ | |||
|
35 | new | |||
|
36 | +copy1 | |||
|
37 | diff --git a/dir1/new b/dir2/copy | |||
|
38 | copy from dir1/new | |||
|
39 | copy to dir2/copy | |||
|
40 | --- a/dir1/new | |||
|
41 | +++ b/dir2/copy | |||
|
42 | @@ -1,1 +1,2 @@ | |||
|
43 | new | |||
|
44 | +copy2 | |||
|
45 | ||||
|
46 | Cross and same-directory copies with a relative root: | |||
|
47 | ||||
|
48 | $ hg diff --git --relative .. -r 1:tip | |||
|
49 | abort: .. not under root '$TESTTMP' | |||
|
50 | [255] | |||
|
51 | $ hg diff --git --relative doesnotexist -r 1:tip | |||
|
52 | $ hg diff --git --relative . -r 1:tip | |||
|
53 | diff --git a/dir1/new b/dir1/copy | |||
|
54 | copy from dir1/new | |||
|
55 | copy to dir1/copy | |||
|
56 | --- a/dir1/new | |||
|
57 | +++ b/dir1/copy | |||
|
58 | @@ -1,1 +1,2 @@ | |||
|
59 | new | |||
|
60 | +copy1 | |||
|
61 | diff --git a/dir1/new b/dir2/copy | |||
|
62 | copy from dir1/new | |||
|
63 | copy to dir2/copy | |||
|
64 | --- a/dir1/new | |||
|
65 | +++ b/dir2/copy | |||
|
66 | @@ -1,1 +1,2 @@ | |||
|
67 | new | |||
|
68 | +copy2 | |||
|
69 | $ hg diff --git --relative dir1 -r 1:tip | |||
|
70 | diff --git a/new b/copy | |||
|
71 | copy from new | |||
|
72 | copy to copy | |||
|
73 | --- a/new | |||
|
74 | +++ b/copy | |||
|
75 | @@ -1,1 +1,2 @@ | |||
|
76 | new | |||
|
77 | +copy1 | |||
|
78 | ||||
|
79 | $ hg diff --git --relative dir2/ -r 1:tip | |||
|
80 | diff --git a/copy b/copy | |||
|
81 | new file mode 100644 | |||
|
82 | --- /dev/null | |||
|
83 | +++ b/copy | |||
|
84 | @@ -0,0 +1,2 @@ | |||
|
85 | +new | |||
|
86 | +copy2 | |||
|
87 | ||||
|
88 | $ hg diff --git --relative dir1 -r 1:tip -I '**/copy' | |||
24 | diff --git a/new b/copy |
|
89 | diff --git a/new b/copy | |
25 | copy from new |
|
90 | copy from new | |
26 | copy to copy |
|
91 | copy to copy | |
|
92 | --- a/new | |||
|
93 | +++ b/copy | |||
|
94 | @@ -1,1 +1,2 @@ | |||
|
95 | new | |||
|
96 | +copy1 | |||
|
97 | ||||
|
98 | $ hg diff --git --relative dir1 -r 1:tip dir2 | |||
|
99 | warning: dir2 not inside relative root dir1 | |||
|
100 | ||||
|
101 | $ hg diff --git --relative dir1 -r 1:tip 'dir2/{copy}' | |||
|
102 | warning: dir2/{copy} not inside relative root dir1 | |||
|
103 | ||||
|
104 | $ cd dir1 | |||
|
105 | $ hg diff --git --relative .. -r 1:tip | |||
|
106 | diff --git a/dir1/new b/dir1/copy | |||
|
107 | copy from dir1/new | |||
|
108 | copy to dir1/copy | |||
|
109 | --- a/dir1/new | |||
|
110 | +++ b/dir1/copy | |||
|
111 | @@ -1,1 +1,2 @@ | |||
|
112 | new | |||
|
113 | +copy1 | |||
|
114 | diff --git a/dir1/new b/dir2/copy | |||
|
115 | copy from dir1/new | |||
|
116 | copy to dir2/copy | |||
|
117 | --- a/dir1/new | |||
|
118 | +++ b/dir2/copy | |||
|
119 | @@ -1,1 +1,2 @@ | |||
|
120 | new | |||
|
121 | +copy2 | |||
|
122 | ||||
|
123 | $ hg diff --git --relative ../.. -r 1:tip | |||
|
124 | abort: ../.. not under root '$TESTTMP' | |||
|
125 | [255] | |||
|
126 | $ hg diff --git --relative ../doesnotexist -r 1:tip | |||
|
127 | $ hg diff --git --relative .. -r 1:tip | |||
|
128 | diff --git a/dir1/new b/dir1/copy | |||
|
129 | copy from dir1/new | |||
|
130 | copy to dir1/copy | |||
|
131 | --- a/dir1/new | |||
|
132 | +++ b/dir1/copy | |||
|
133 | @@ -1,1 +1,2 @@ | |||
|
134 | new | |||
|
135 | +copy1 | |||
|
136 | diff --git a/dir1/new b/dir2/copy | |||
|
137 | copy from dir1/new | |||
|
138 | copy to dir2/copy | |||
|
139 | --- a/dir1/new | |||
|
140 | +++ b/dir2/copy | |||
|
141 | @@ -1,1 +1,2 @@ | |||
|
142 | new | |||
|
143 | +copy2 | |||
|
144 | ||||
|
145 | $ hg diff --git --relative . -r 1:tip | |||
|
146 | diff --git a/new b/copy | |||
|
147 | copy from new | |||
|
148 | copy to copy | |||
|
149 | --- a/new | |||
|
150 | +++ b/copy | |||
|
151 | @@ -1,1 +1,2 @@ | |||
|
152 | new | |||
|
153 | +copy1 | |||
|
154 | $ hg diff --git --relative . -r 1:tip copy | |||
|
155 | diff --git a/new b/copy | |||
|
156 | copy from new | |||
|
157 | copy to copy | |||
|
158 | --- a/new | |||
|
159 | +++ b/copy | |||
|
160 | @@ -1,1 +1,2 @@ | |||
|
161 | new | |||
|
162 | +copy1 | |||
|
163 | $ hg diff --git --relative . -r 1:tip ../dir2 | |||
|
164 | warning: ../dir2 not inside relative root . | |||
|
165 | $ hg diff --git --relative . -r 1:tip '../dir2/*' | |||
|
166 | warning: ../dir2/* not inside relative root . | |||
|
167 | $ cd .. | |||
27 |
|
168 | |||
28 | Rename: |
|
169 | Rename: | |
29 |
|
170 | |||
30 | $ hg mv copy rename |
|
171 | $ hg mv dir1/copy dir1/rename1 | |
|
172 | $ echo rename1 >> dir1/rename1 | |||
|
173 | $ hg mv dir2/copy dir1/rename2 | |||
|
174 | $ echo rename2 >> dir1/rename2 | |||
31 | $ hg ci -mrename |
|
175 | $ hg ci -mrename | |
32 | $ hg diff --git -r 2:tip |
|
176 | $ hg diff --git -r 2:tip | |
33 | diff --git a/copy b/rename |
|
177 | diff --git a/dir1/copy b/dir1/rename1 | |
|
178 | rename from dir1/copy | |||
|
179 | rename to dir1/rename1 | |||
|
180 | --- a/dir1/copy | |||
|
181 | +++ b/dir1/rename1 | |||
|
182 | @@ -1,2 +1,3 @@ | |||
|
183 | new | |||
|
184 | copy1 | |||
|
185 | +rename1 | |||
|
186 | diff --git a/dir2/copy b/dir1/rename2 | |||
|
187 | rename from dir2/copy | |||
|
188 | rename to dir1/rename2 | |||
|
189 | --- a/dir2/copy | |||
|
190 | +++ b/dir1/rename2 | |||
|
191 | @@ -1,2 +1,3 @@ | |||
|
192 | new | |||
|
193 | copy2 | |||
|
194 | +rename2 | |||
|
195 | ||||
|
196 | Cross and same-directory renames with a relative root: | |||
|
197 | ||||
|
198 | $ hg diff --relative dir1 --git -r 2:tip | |||
|
199 | diff --git a/copy b/rename1 | |||
34 | rename from copy |
|
200 | rename from copy | |
35 | rename to rename |
|
201 | rename to rename1 | |
|
202 | --- a/copy | |||
|
203 | +++ b/rename1 | |||
|
204 | @@ -1,2 +1,3 @@ | |||
|
205 | new | |||
|
206 | copy1 | |||
|
207 | +rename1 | |||
|
208 | diff --git a/rename2 b/rename2 | |||
|
209 | new file mode 100644 | |||
|
210 | --- /dev/null | |||
|
211 | +++ b/rename2 | |||
|
212 | @@ -0,0 +1,3 @@ | |||
|
213 | +new | |||
|
214 | +copy2 | |||
|
215 | +rename2 | |||
|
216 | ||||
|
217 | $ hg diff --relative dir2 --git -r 2:tip | |||
|
218 | diff --git a/copy b/copy | |||
|
219 | deleted file mode 100644 | |||
|
220 | --- a/copy | |||
|
221 | +++ /dev/null | |||
|
222 | @@ -1,2 +0,0 @@ | |||
|
223 | -new | |||
|
224 | -copy2 | |||
|
225 | ||||
|
226 | $ hg diff --relative dir1 --git -r 2:tip -I '**/copy' | |||
|
227 | diff --git a/copy b/copy | |||
|
228 | deleted file mode 100644 | |||
|
229 | --- a/copy | |||
|
230 | +++ /dev/null | |||
|
231 | @@ -1,2 +0,0 @@ | |||
|
232 | -new | |||
|
233 | -copy1 | |||
|
234 | ||||
|
235 | $ hg diff --relative dir1 --git -r 2:tip -I '**/rename*' | |||
|
236 | diff --git a/copy b/rename1 | |||
|
237 | copy from copy | |||
|
238 | copy to rename1 | |||
|
239 | --- a/copy | |||
|
240 | +++ b/rename1 | |||
|
241 | @@ -1,2 +1,3 @@ | |||
|
242 | new | |||
|
243 | copy1 | |||
|
244 | +rename1 | |||
|
245 | diff --git a/rename2 b/rename2 | |||
|
246 | new file mode 100644 | |||
|
247 | --- /dev/null | |||
|
248 | +++ b/rename2 | |||
|
249 | @@ -0,0 +1,3 @@ | |||
|
250 | +new | |||
|
251 | +copy2 | |||
|
252 | +rename2 | |||
36 |
|
253 | |||
37 | Delete: |
|
254 | Delete: | |
38 |
|
255 | |||
39 |
$ hg rm |
|
256 | $ hg rm dir1/* | |
40 | $ hg ci -mdelete |
|
257 | $ hg ci -mdelete | |
41 | $ hg diff --git -r 3:tip |
|
258 | $ hg diff --git -r 3:tip | |
42 |
diff --git a/ |
|
259 | diff --git a/dir1/new b/dir1/new | |
43 | deleted file mode 100644 |
|
260 | deleted file mode 100644 | |
44 |
--- a/ |
|
261 | --- a/dir1/new | |
45 | +++ /dev/null |
|
262 | +++ /dev/null | |
46 | @@ -1,1 +0,0 @@ |
|
263 | @@ -1,1 +0,0 @@ | |
47 | -new |
|
264 | -new | |
|
265 | diff --git a/dir1/rename1 b/dir1/rename1 | |||
|
266 | deleted file mode 100644 | |||
|
267 | --- a/dir1/rename1 | |||
|
268 | +++ /dev/null | |||
|
269 | @@ -1,3 +0,0 @@ | |||
|
270 | -new | |||
|
271 | -copy1 | |||
|
272 | -rename1 | |||
|
273 | diff --git a/dir1/rename2 b/dir1/rename2 | |||
|
274 | deleted file mode 100644 | |||
|
275 | --- a/dir1/rename2 | |||
|
276 | +++ /dev/null | |||
|
277 | @@ -1,3 +0,0 @@ | |||
|
278 | -new | |||
|
279 | -copy2 | |||
|
280 | -rename2 | |||
48 |
|
281 | |||
49 | $ cat > src <<EOF |
|
282 | $ cat > src <<EOF | |
50 | > 1 |
|
283 | > 1 |
@@ -509,6 +509,7 b' Test command without options' | |||||
509 | -B --ignore-blank-lines ignore changes whose lines are all blank |
|
509 | -B --ignore-blank-lines ignore changes whose lines are all blank | |
510 | -U --unified NUM number of lines of context to show |
|
510 | -U --unified NUM number of lines of context to show | |
511 | --stat output diffstat-style summary of changes |
|
511 | --stat output diffstat-style summary of changes | |
|
512 | --relative DIR produce diffs relative to subdirectory | |||
512 | -I --include PATTERN [+] include names matching the given patterns |
|
513 | -I --include PATTERN [+] include names matching the given patterns | |
513 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
514 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
514 | -S --subrepos recurse into subrepositories |
|
515 | -S --subrepos recurse into subrepositories |
General Comments 0
You need to be logged in to leave comments.
Login now