Mercurial > hg
comparison hgext/extdiff.py @ 7758:e81e6c996e99
extdiff: add --change option to display single changeset diff
This is the counterpart for extdiff of 9c6ae2e09e11.
author | Gilles Moris <gilles.moris@free.fr> |
---|---|
date | Sat, 07 Feb 2009 19:41:05 +0100 |
parents | 7bf7c073375e |
children | 7b813bdbd5d0 5c7bc1aece9e |
comparison
equal
deleted
inserted
replaced
7757:af6a63438a8a | 7758:e81e6c996e99 |
---|---|
115 - copy to a temp structure if diffing 2 internal revisions | 115 - copy to a temp structure if diffing 2 internal revisions |
116 - copy to a temp structure if diffing working revision with | 116 - copy to a temp structure if diffing working revision with |
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): |
124 return 0 | 136 return 0 |
125 | 137 |
203 "extdiff": | 215 "extdiff": |
204 (extdiff, | 216 (extdiff, |
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 } |
211 | 224 |
212 def uisetup(ui): | 225 def uisetup(ui): |