Patchwork [STABLE] revert: restore the ability to revert across case only renames (issue4481)

login
register
mail settings
Submitter Matt Harbison
Date April 26, 2015, 4:25 a.m.
Message ID <8e43965a82153d2327e3.1430022328@Envy>
Download mbox | patch
Permalink /patch/8792/
State Accepted
Headers show

Comments

Matt Harbison - April 26, 2015, 4:25 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1430020471 14400
#      Sat Apr 25 23:54:31 2015 -0400
# Branch stable
# Node ID 8e43965a82153d2327e345d5694aa3465ed7057a
# Parent  37cadf30f0f901b4ae4ca20f83c1a53c029c3245
revert: restore the ability to revert across case only renames (issue4481)

This regressed in 5e16fe6fdd32, in what looks like an unrelated change.

It seems sufficient to pass 'ignoremissing=True', but the restored try/except
has been there for six years since 41bb88cb913e, so this seems safer for now.
Note that renaming directories in the filename doesn't appear to work- not sure
if this would end up throwing a different type of error when that is fixed.
Matt Mackall - April 27, 2015, 4:31 p.m.
On Sun, 2015-04-26 at 00:25 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1430020471 14400
> #      Sat Apr 25 23:54:31 2015 -0400
> # Branch stable
> # Node ID 8e43965a82153d2327e345d5694aa3465ed7057a
> # Parent  37cadf30f0f901b4ae4ca20f83c1a53c029c3245
> revert: restore the ability to revert across case only renames (issue4481)

Queued for stable, thanks.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -3084,7 +3084,10 @@ 
         repo.dirstate.drop(f)
     for f in actions['remove'][0]:
         audit_path(f)
-        util.unlinkpath(repo.wjoin(f))
+        try:
+            util.unlinkpath(repo.wjoin(f))
+        except OSError:
+            pass
         repo.dirstate.remove(f)
     for f in actions['drop'][0]:
         audit_path(f)
diff --git a/tests/test-casefolding.t b/tests/test-casefolding.t
--- a/tests/test-casefolding.t
+++ b/tests/test-casefolding.t
@@ -153,6 +153,23 @@ 
   $ mkdir -p a/B/c/D
   $ echo e > a/B/c/D/e
   $ hg add a/B/c/D/e
+  $ hg ci -m 'add e'
+
+issue 4481: revert across case only renames
+  $ hg mv a/B/c/D/e a/B/c/d/E
+  $ hg ci -m "uppercase E"
+  $ echo 'foo' > a/B/c/D/E
+  $ hg ci -m 'e content change'
+  $ hg revert --all -r 0
+  removing a\B\c\D\E
+  adding a\B\c\D\e
+  $ find * | sort
+  a
+  a/B
+  a/B/c
+  a/B/c/D
+  a/B/c/D/e
+  a/B/c/D/e.orig
 
   $ cd ..