comparison mercurial/commands.py @ 7628:9c6ae2e09e11

diff: add --change option to display single changeset diff (issue1420)
author Stepan Koltsov <yozh@mx1.ru>
date Tue, 13 Jan 2009 10:44:16 +0100
parents 4dd7b28003d2
children 9626819b2e3d
comparison
equal deleted inserted replaced
7627:fb32ae9c76e7 7628:9c6ae2e09e11
1013 probably with undesirable results. 1013 probably with undesirable results.
1014 1014
1015 Use the --git option to generate diffs in the git extended diff 1015 Use the --git option to generate diffs in the git extended diff
1016 format. Read the diffs help topic for more information. 1016 format. Read the diffs help topic for more information.
1017 """ 1017 """
1018 node1, node2 = cmdutil.revpair(repo, opts.get('rev')) 1018
1019 revs = opts.get('rev')
1020 change = opts.get('change')
1021
1022 if revs and change:
1023 msg = _('cannot specify --rev and --change at the same time')
1024 raise util.Abort(msg)
1025 elif change:
1026 node2 = repo.lookup(change)
1027 node1 = repo[node2].parents()[0].node()
1028 else:
1029 node1, node2 = cmdutil.revpair(repo, revs)
1019 1030
1020 m = cmdutil.match(repo, pats, opts) 1031 m = cmdutil.match(repo, pats, opts)
1021 it = patch.diff(repo, node1, node2, match=m, opts=patch.diffopts(ui, opts)) 1032 it = patch.diff(repo, node1, node2, match=m, opts=patch.diffopts(ui, opts))
1022 for chunk in it: 1033 for chunk in it:
1023 repo.ui.write(chunk) 1034 repo.ui.write(chunk)
3170 [('', 'nodates', None, _('do not display the saved mtime'))], 3181 [('', 'nodates', None, _('do not display the saved mtime'))],
3171 _('[OPTION]...')), 3182 _('[OPTION]...')),
3172 "debugwalk": (debugwalk, walkopts, _('[OPTION]... [FILE]...')), 3183 "debugwalk": (debugwalk, walkopts, _('[OPTION]... [FILE]...')),
3173 "^diff": 3184 "^diff":
3174 (diff, 3185 (diff,
3175 [('r', 'rev', [], _('revision')) 3186 [('r', 'rev', [], _('revision')),
3187 ('c', 'change', '', _('change made by revision'))
3176 ] + diffopts + diffopts2 + walkopts, 3188 ] + diffopts + diffopts2 + walkopts,
3177 _('[OPTION]... [-r REV1 [-r REV2]] [FILE]...')), 3189 _('[OPTION]... [-r REV1 [-r REV2]] [FILE]...')),
3178 "^export": 3190 "^export":
3179 (export, 3191 (export,
3180 [('o', 'output', '', _('print output to file with formatted name')), 3192 [('o', 'output', '', _('print output to file with formatted name')),