# HG changeset patch # User Sushil khanchi # Date 1551624382 -19800 # Node ID f8c5225b905442269b93489b83429a8fd9238940 # Parent a920a9e1795ab07fa8ff512924a2857d8a767dc1 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 diff -r a920a9e1795a -r f8c5225b9054 mercurial/patch.py --- a/mercurial/patch.py Mon Mar 18 16:56:24 2019 +0300 +++ b/mercurial/patch.py Sun Mar 03 20:16:22 2019 +0530 @@ -863,7 +863,7 @@ diff_re = re.compile('diff -r .* (.*)$') allhunks_re = re.compile('(?:index|deleted file) ') pretty_re = re.compile('(?:new file|deleted file) ') - special_re = re.compile('(?:index|deleted|copy|rename) ') + special_re = re.compile('(?:index|deleted|copy|rename|new mode) ') newfile_re = re.compile('(?:new file)') def __init__(self, header): diff -r a920a9e1795a -r f8c5225b9054 tests/test-split.t --- a/tests/test-split.t Mon Mar 18 16:56:24 2019 +0300 +++ b/tests/test-split.t Sun Mar 03 20:16:22 2019 +0530 @@ -732,30 +732,33 @@ #if no-windows - $ printf 'y\ny\ny\n' | hg split - diff --git a/foo b/foo - old mode 100644 - new mode 100755 - examine changes to 'foo'? [Ynesfdaq?] y - - no changes to record + $ cat > $TESTTMP/messages < split 1 + > EOF + $ printf 'y\n' | hg split diff --git a/foo b/foo old mode 100644 new mode 100755 examine changes to 'foo'? [Ynesfdaq?] y - no changes to record - diff --git a/foo b/foo - old mode 100644 - new mode 100755 - examine changes to 'foo'? [Ynesfdaq?] y + EDITOR: HG: Splitting 3a2125f0f4cb. Write commit message for the first split changeset. + EDITOR: make executable + EDITOR: + EDITOR: + EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. + EDITOR: HG: Leave message empty to abort commit. + EDITOR: HG: -- + EDITOR: HG: user: test + EDITOR: HG: branch 'default' + EDITOR: HG: changed foo + created new head + saved backup bundle to $TESTTMP/issue5864/.hg/strip-backup/3a2125f0f4cb-629e4432-split.hg (obsstore-off !) + + $ hg log -G -T "{node|short} {desc}\n" + @ b154670c87da split 1 + | + o 51f273a58d82 initial - no changes to record - diff --git a/foo b/foo - old mode 100644 - new mode 100755 - examine changes to 'foo'? [Ynesfdaq?] abort: response expected - [255] #else TODO: Fix this on Windows. See issue 2020 and 5883