##// END OF EJS Templates
extdiff: add a --patch argument for diffing changeset deltas...
Matt Harbison -
r26228:0fd20a71 default
parent child Browse files
Show More
@@ -147,7 +147,12 b' def dodiff(ui, repo, cmdline, pats, opts'
147
147
148 matcher = scmutil.match(repo[node2], pats, opts)
148 matcher = scmutil.match(repo[node2], pats, opts)
149
149
150 if True:
150 if opts.get('patch'):
151 if subrepos:
152 raise util.Abort(_('--patch cannot be used with --subrepos'))
153 if node2 is None:
154 raise util.Abort(_('--patch requires two revisions'))
155 else:
151 mod_a, add_a, rem_a = map(set, repo.status(node1a, node2, matcher,
156 mod_a, add_a, rem_a = map(set, repo.status(node1a, node2, matcher,
152 listsubrepos=subrepos)[:3])
157 listsubrepos=subrepos)[:3])
153 if do3way:
158 if do3way:
@@ -163,7 +168,7 b' def dodiff(ui, repo, cmdline, pats, opts'
163
168
164 tmproot = tempfile.mkdtemp(prefix='extdiff.')
169 tmproot = tempfile.mkdtemp(prefix='extdiff.')
165 try:
170 try:
166 if True:
171 if not opts.get('patch'):
167 # Always make a copy of node1a (and node1b, if applicable)
172 # Always make a copy of node1a (and node1b, if applicable)
168 dir1a_files = mod_a | rem_a | ((mod_b | add_b) - add_a)
173 dir1a_files = mod_a | rem_a | ((mod_b | add_b) - add_a)
169 dir1a = snapshot(ui, repo, dir1a_files, node1a, tmproot,
174 dir1a = snapshot(ui, repo, dir1a_files, node1a, tmproot,
@@ -217,6 +222,18 b' def dodiff(ui, repo, cmdline, pats, opts'
217 dir1b = os.devnull
222 dir1b = os.devnull
218 dir2 = os.path.join(dir2root, dir2, common_file)
223 dir2 = os.path.join(dir2root, dir2, common_file)
219 label2 = common_file + rev2
224 label2 = common_file + rev2
225 else:
226 # XXX: export doesn't support -I/-X like extdiff does
227 template = 'hg-%h.patch'
228 cmdutil.export(repo, [repo[node1a].rev(), repo[node2].rev()],
229 template=repo.vfs.reljoin(tmproot, template))
230 label1a = cmdutil.makefilename(repo, template, node1a)
231 label2 = cmdutil.makefilename(repo, template, node2)
232 dir1a = repo.vfs.reljoin(tmproot, label1a)
233 dir2 = repo.vfs.reljoin(tmproot, label2)
234 dir1b = None
235 label1b = None
236 fns_and_mtime = []
220
237
221 # Function to quote file/dir names in the argument string.
238 # Function to quote file/dir names in the argument string.
222 # When not operating in 3-way mode, an empty string is
239 # When not operating in 3-way mode, an empty string is
@@ -260,6 +277,7 b' def dodiff(ui, repo, cmdline, pats, opts'
260 _('pass option to comparison program'), _('OPT')),
277 _('pass option to comparison program'), _('OPT')),
261 ('r', 'rev', [], _('revision'), _('REV')),
278 ('r', 'rev', [], _('revision'), _('REV')),
262 ('c', 'change', '', _('change made by revision'), _('REV')),
279 ('c', 'change', '', _('change made by revision'), _('REV')),
280 ('', 'patch', None, _('compare patches for two revisions'))
263 ] + commands.walkopts + commands.subrepoopts,
281 ] + commands.walkopts + commands.subrepoopts,
264 _('hg extdiff [OPT]... [FILE]...'),
282 _('hg extdiff [OPT]... [FILE]...'),
265 inferrepo=True)
283 inferrepo=True)
@@ -46,6 +46,7 b' Should diff cloned directories:'
46 -o --option OPT [+] pass option to comparison program
46 -o --option OPT [+] pass option to comparison program
47 -r --rev REV [+] revision
47 -r --rev REV [+] revision
48 -c --change REV change made by revision
48 -c --change REV change made by revision
49 --patch compare patches for two revisions
49 -I --include PATTERN [+] include names matching the given patterns
50 -I --include PATTERN [+] include names matching the given patterns
50 -X --exclude PATTERN [+] exclude names matching the given patterns
51 -X --exclude PATTERN [+] exclude names matching the given patterns
51 -S --subrepos recurse into subrepositories
52 -S --subrepos recurse into subrepositories
@@ -390,6 +390,7 b' Extension module help vs command help:'
390 -o --option OPT [+] pass option to comparison program
390 -o --option OPT [+] pass option to comparison program
391 -r --rev REV [+] revision
391 -r --rev REV [+] revision
392 -c --change REV change made by revision
392 -c --change REV change made by revision
393 --patch compare patches for two revisions
393 -I --include PATTERN [+] include names matching the given patterns
394 -I --include PATTERN [+] include names matching the given patterns
394 -X --exclude PATTERN [+] exclude names matching the given patterns
395 -X --exclude PATTERN [+] exclude names matching the given patterns
395 -S --subrepos recurse into subrepositories
396 -S --subrepos recurse into subrepositories
@@ -332,6 +332,38 b' Disallow grafting an already grafted cse'
332 skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f)
332 skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f)
333 [255]
333 [255]
334
334
335 $ hg extdiff --config extensions.extdiff= --patch -r 2 -r 13
336 --- */hg-5c095ad7e90f.patch * +0000 (glob)
337 +++ */hg-7a4785234d87.patch * +0000 (glob)
338 @@ -1,18 +1,18 @@
339 # HG changeset patch
340 -# User test
341 +# User foo
342 # Date 0 0
343 # Thu Jan 01 00:00:00 1970 +0000
344 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
345 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
346 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
347 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
348 2
349
350 -diff -r 5d205f8b35b6 -r 5c095ad7e90f a
351 +diff -r b592ea63bb0c -r 7a4785234d87 a
352 --- a/a Thu Jan 01 00:00:00 1970 +0000
353 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
354 @@ -1,1 +0,0 @@
355 --b
356 -diff -r 5d205f8b35b6 -r 5c095ad7e90f b
357 +-a
358 +diff -r b592ea63bb0c -r 7a4785234d87 b
359 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
360 +++ b/b Thu Jan 01 00:00:00 1970 +0000
361 @@ -0,0 +1,1 @@
362 -+b
363 ++a
364 [1]
365
366
335 Disallow grafting already grafted csets with the same origin onto each other
367 Disallow grafting already grafted csets with the same origin onto each other
336 $ hg up -q 13
368 $ hg up -q 13
337 $ hg graft 2
369 $ hg graft 2
General Comments 0
You need to be logged in to leave comments. Login now