comparison mercurial/cmdutil.py @ 25258:f37a69ec3f47

revert: make revert --interactive use git style diff This allows us to use existing code to detect files that are newly added and modified. In turn, this allows us to make revert --interactive support editing newly added and modified files.
author Laurent Charignon <lcharignon@fb.com>
date Thu, 21 May 2015 14:25:57 -0700
parents 07326d76f19d
children 5b05f10c5024
comparison
equal deleted inserted replaced
25257:07326d76f19d 25258:f37a69ec3f47
3125 3125
3126 if interactive: 3126 if interactive:
3127 # Prompt the user for changes to revert 3127 # Prompt the user for changes to revert
3128 torevert = [repo.wjoin(f) for f in actions['revert'][0]] 3128 torevert = [repo.wjoin(f) for f in actions['revert'][0]]
3129 m = scmutil.match(ctx, torevert, {}) 3129 m = scmutil.match(ctx, torevert, {})
3130 diff = patch.diff(repo, None, ctx.node(), m) 3130 diffopts = patch.difffeatureopts(repo.ui, whitespace=True)
3131 diffopts.nodates = True
3132 diffopts.git = True
3133 diff = patch.diff(repo, None, ctx.node(), m, opts=diffopts)
3131 originalchunks = patch.parsepatch(diff) 3134 originalchunks = patch.parsepatch(diff)
3132 try: 3135 try:
3133 chunks = recordfilter(repo.ui, originalchunks) 3136 chunks = recordfilter(repo.ui, originalchunks)
3134 except patch.PatchError, err: 3137 except patch.PatchError, err:
3135 raise util.Abort(_('error parsing patch: %s') % err) 3138 raise util.Abort(_('error parsing patch: %s') % err)