comparison mercurial/patch.py @ 41982:f8c5225b9054

patch: include flag-only file changes in "special" when filtering (issue5864) This patch fix the issue5864 (or maybe issue5865 too) which occurs during split (or I should say at the time of filtering the hunks in interactive mode) where user hits a not ending loop of "no changes to record". And it's not only the case for split it will happen in every interactive case for e.g. `hg commit -i` or `hg uncommit -i` After looking into code I found that when filtering we have some notation called "special" for the file headers which doesn't contain any hunk and just contain the header (for e.g. newly added empty file or deleted file) where the user cannot change the content of operation. And I think we can put this "flag-only" file change in that same bucket of "special". But I doubt a bit about the case when a file have flag change and atleast one hunk then user won't be able to separate the flag change from hunks. Changed test file reflect the fixed behaviour. Differential Revision: https://phab.mercurial-scm.org/D6058
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Sun, 03 Mar 2019 20:16:22 +0530
parents 251332dbf33d
children 95e4ae86329f
comparison
equal deleted inserted replaced
41981:a920a9e1795a 41982:f8c5225b9054
861 """ 861 """
862 diffgit_re = re.compile('diff --git a/(.*) b/(.*)$') 862 diffgit_re = re.compile('diff --git a/(.*) b/(.*)$')
863 diff_re = re.compile('diff -r .* (.*)$') 863 diff_re = re.compile('diff -r .* (.*)$')
864 allhunks_re = re.compile('(?:index|deleted file) ') 864 allhunks_re = re.compile('(?:index|deleted file) ')
865 pretty_re = re.compile('(?:new file|deleted file) ') 865 pretty_re = re.compile('(?:new file|deleted file) ')
866 special_re = re.compile('(?:index|deleted|copy|rename) ') 866 special_re = re.compile('(?:index|deleted|copy|rename|new mode) ')
867 newfile_re = re.compile('(?:new file)') 867 newfile_re = re.compile('(?:new file)')
868 868
869 def __init__(self, header): 869 def __init__(self, header):
870 self.header = header 870 self.header = header
871 self.hunks = [] 871 self.hunks = []