diff mercurial/patch.py @ 42856:3cf091843b4f

split: handle partial commit of renames when doing split or record (issue5723) When using split or record, using either interface (text or curses), selecting portions of the file to be committed/recorded did not work; the entire file was treated as having been selected. This was because the logic for handling partial application of the patches relies on knowing what files are "new with modifications" and it doesn't treat "rename destination" as "new". There was a complicating issue, however. We're relying on the patch header specifying the copy from/to information, which works as long as the 'copy from' file is there. In the case of renames, however, the 'rename from' file is *not* there, so we need to add it back. Differential Revision: https://phab.mercurial-scm.org/D6768
author Kyle Lippincott <spectral@google.com>
date Tue, 27 Aug 2019 11:56:19 -0700
parents 1fd530b1e1cf
children db33e4f25729
line wrap: on
line diff
--- a/mercurial/patch.py	Tue Aug 27 11:56:15 2019 -0700
+++ b/mercurial/patch.py	Tue Aug 27 11:56:19 2019 -0700
@@ -864,7 +864,7 @@
     allhunks_re = re.compile('(?:index|deleted file) ')
     pretty_re = re.compile('(?:new file|deleted file) ')
     special_re = re.compile('(?:index|deleted|copy|rename|new mode) ')
-    newfile_re = re.compile('(?:new file|copy to)')
+    newfile_re = re.compile('(?:new file|copy to|rename to)')
 
     def __init__(self, header):
         self.header = header