##// END OF EJS Templates
extdiff: add --change option to display single changeset diff...
Gilles Moris -
r7758:e81e6c99 default
parent child Browse files
Show More
@@ -117,7 +117,19 b' def dodiff(ui, repo, diffcmd, diffopts, '
117 another one and more than 1 file is changed
117 another one and more than 1 file is changed
118 - just invoke the diff for a single file in the working dir
118 - just invoke the diff for a single file in the working dir
119 '''
119 '''
120 node1, node2 = cmdutil.revpair(repo, opts['rev'])
120
121 revs = opts.get('rev')
122 change = opts.get('change')
123
124 if revs and change:
125 msg = _('cannot specify --rev and --change at the same time')
126 raise util.Abort(msg)
127 elif change:
128 node2 = repo.lookup(change)
129 node1 = repo[node2].parents()[0].node()
130 else:
131 node1, node2 = cmdutil.revpair(repo, revs)
132
121 matcher = cmdutil.match(repo, pats, opts)
133 matcher = cmdutil.match(repo, pats, opts)
122 modified, added, removed = repo.status(node1, node2, matcher)[:3]
134 modified, added, removed = repo.status(node1, node2, matcher)[:3]
123 if not (modified or added or removed):
135 if not (modified or added or removed):
@@ -205,6 +217,7 b' cmdtable = {'
205 [('p', 'program', '', _('comparison program to run')),
217 [('p', 'program', '', _('comparison program to run')),
206 ('o', 'option', [], _('pass option to comparison program')),
218 ('o', 'option', [], _('pass option to comparison program')),
207 ('r', 'rev', [], _('revision')),
219 ('r', 'rev', [], _('revision')),
220 ('c', 'change', '', _('change made by revision')),
208 ] + commands.walkopts,
221 ] + commands.walkopts,
209 _('hg extdiff [OPT]... [FILE]...')),
222 _('hg extdiff [OPT]... [FILE]...')),
210 }
223 }
@@ -32,9 +32,14 b' hg update 0'
32 echo c >> c
32 echo c >> c
33 hg add c
33 hg add c
34 hg ci -m "new branch" -d '1 0'
34 hg ci -m "new branch" -d '1 0'
35 hg update -C 1
35 hg merge 1
36 hg merge tip
37 # should diff cloned file against wc file
36 # should diff cloned file against wc file
38 hg falabala > out || echo "diff-like tools yield a non-zero exit code"
37 hg falabala > out
39 # cleanup the output since the wc is a tmp directory
38 # cleanup the output since the wc is a tmp directory
40 sed 's:\(.* \).*\(\/test-extdiff\):\1[tmp]\2:' out
39 sed 's:\(.* \).*\(\/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
@@ -20,6 +20,7 b' options:'
20
20
21 -o --option pass option to comparison program
21 -o --option pass option to comparison program
22 -r --rev revision
22 -r --rev revision
23 -c --change change made by revision
23 -I --include include names matching the given patterns
24 -I --include include names matching the given patterns
24 -X --exclude exclude names matching the given patterns
25 -X --exclude exclude names matching the given patterns
25
26
@@ -27,8 +28,9 b' use "hg -v help falabala" to show global'
27 diffing a.8a5febb7f867/a a.34eed99112ab/a
28 diffing a.8a5febb7f867/a a.34eed99112ab/a
28 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 created new head
30 created new head
30 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
31 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
31 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
32 (branch merge, don't forget to commit)
32 (branch merge, don't forget to commit)
33 diffing a.2a13a4d2da36/a [tmp]/test-extdiff/a/a
34 diffing a.8a5febb7f867/a a.34eed99112ab/a
35 diffing a.2a13a4d2da36/a a.46c0e4daeb72/a
33 diff-like tools yield a non-zero exit code
36 diff-like tools yield a non-zero exit code
34 diffing a.34eed99112ab/c [tmp]/test-extdiff/a/c
General Comments 0
You need to be logged in to leave comments. Login now