comparison mercurial/commands.py @ 24432:e22248f6d257

commands.diff: add support for diffs relative to a subdirectory Previous patches added all the backend support for this. This exposes this option in the UI.
author Siddharth Agarwal <sid0@fb.com>
date Tue, 17 Mar 2015 15:46:30 -0700
parents 69bd0ec2f9be
children 16961d43dc89
comparison
equal deleted inserted replaced
24431:a0004402776b 24432:e22248f6d257
146 ('', 'reverse', None, _('produce a diff that undoes the changes')), 146 ('', 'reverse', None, _('produce a diff that undoes the changes')),
147 ] + diffwsopts + [ 147 ] + diffwsopts + [
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 = [
154 ('t', 'tool', '', _('specify merge tool')), 155 ('t', 'tool', '', _('specify merge tool')),
155 ] 156 ]
3167 node1, node2 = node2, node1 3168 node1, node2 = node2, node1
3168 3169
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', '',
3176 _('print output to file with formatted name'), _('FORMAT')), 3178 _('print output to file with formatted name'), _('FORMAT')),
3177 ('', 'switch-parent', None, _('diff against the second parent')), 3179 ('', 'switch-parent', None, _('diff against the second parent')),