D6058: patch: include flag-only file changes in "special" while filtering patch (issue5864)

khanchi97 (Sushil khanchi) phabricator at mercurial-scm.org
Wed Mar 13 15:22:04 EDT 2019


khanchi97 updated this revision to Diff 14485.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6058?vs=14323&id=14485

REVISION DETAIL
  https://phab.mercurial-scm.org/D6058

AFFECTED FILES
  mercurial/patch.py
  tests/test-split.t

CHANGE DETAILS

diff --git a/tests/test-split.t b/tests/test-split.t
--- a/tests/test-split.t
+++ b/tests/test-split.t
@@ -731,36 +731,64 @@
   o  0:51f273a58d82 initial
   
 
-#if no-windows
+#if windows
+TODO: Fix this on Windows. See issue 2020 and 5883
+
   $ 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
+  abort: cannot split an empty revision
+  [255]
+#else
+  $ cat > $TESTTMP/messages <<EOF
+  > split 1
+  > EOF
+  !!! nested #if
+#if obsstore-on
+  $ 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
+  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
+
+  $ hg glog
+  @  2:b154670c87da split 1
+  |
+  o  0:51f273a58d82 initial
+  
+#else
+  $ 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?] abort: response expected
-  [255]
-#else
+  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
 
-TODO: Fix this on Windows. See issue 2020 and 5883
-
-  $ printf 'y\ny\ny\n' | hg split
-  abort: cannot split an empty revision
-  [255]
+  $ hg glog
+  @  1:b154670c87da split 1
+  |
+  o  0:51f273a58d82 initial
+  
 #endif
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -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):



To: khanchi97, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list