diff 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
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Thu May 21 14:32:14 2015 -0700
+++ b/mercurial/cmdutil.py	Thu May 21 14:25:57 2015 -0700
@@ -3127,7 +3127,10 @@
         # Prompt the user for changes to revert
         torevert = [repo.wjoin(f) for f in actions['revert'][0]]
         m = scmutil.match(ctx, torevert, {})
-        diff = patch.diff(repo, None, ctx.node(), m)
+        diffopts = patch.difffeatureopts(repo.ui, whitespace=True)
+        diffopts.nodates = True
+        diffopts.git = True
+        diff = patch.diff(repo, None, ctx.node(), m, opts=diffopts)
         originalchunks = patch.parsepatch(diff)
         try:
             chunks = recordfilter(repo.ui, originalchunks)