merge with stable
authorMatt Mackall <mpm@selenic.com>
Wed, 12 Aug 2015 17:01:50 -0500
changeset 26014 a5f62af29517
parent 26013 38f92d12357c (current diff)
parent 26012 d815a5997576 (diff)
child 26015 ed60d2ae1935
merge with stable
mercurial/match.py
mercurial/repair.py
--- a/mercurial/match.py	Tue Jan 27 11:26:27 2015 -0800
+++ b/mercurial/match.py	Wed Aug 12 17:01:50 2015 -0500
@@ -394,7 +394,8 @@
     def __init__(self, root, cwd, patterns, include, exclude, default, auditor,
                  ctx, listsubrepos=False, badfn=None):
         init = super(icasefsmatcher, self).__init__
-        self._dsnormalize = ctx.repo().dirstate.normalize
+        self._dirstate = ctx.repo().dirstate
+        self._dsnormalize = self._dirstate.normalize
 
         init(root, cwd, patterns, include, exclude, default, auditor=auditor,
              ctx=ctx, listsubrepos=listsubrepos, badfn=badfn)
@@ -410,7 +411,13 @@
         kindpats = []
         for kind, pats, source in self._kp:
             if kind not in ('re', 'relre'):  # regex can't be normalized
+                p = pats
                 pats = self._dsnormalize(pats)
+
+                # Preserve the original to handle a case only rename.
+                if p != pats and p in self._dirstate:
+                    kindpats.append((kind, p, source))
+
             kindpats.append((kind, pats, source))
         return kindpats
 
--- a/mercurial/repair.py	Tue Jan 27 11:26:27 2015 -0800
+++ b/mercurial/repair.py	Wed Aug 12 17:01:50 2015 -0500
@@ -181,9 +181,8 @@
                 if troffset == 0:
                     repo.store.markremoved(file)
             tr.close()
-        except: # re-raises
-            tr.abort()
-            raise
+        finally:
+            tr.release()
 
         if saveheads or savebases:
             ui.note(_("adding branch\n"))
--- a/tests/test-add.t	Tue Jan 27 11:26:27 2015 -0800
+++ b/tests/test-add.t	Wed Aug 12 17:01:50 2015 -0500
@@ -232,9 +232,17 @@
   -xyz
   +def
 
+  $ hg mv CapsDir1/CapsDir/abc.txt CapsDir1/CapsDir/ABC.txt
+  moving CapsDir1/CapsDir/AbC.txt to CapsDir1/CapsDir/ABC.txt (glob)
+  $ hg ci -m "case changing rename" CapsDir1/CapsDir/AbC.txt CapsDir1/CapsDir/ABC.txt
+
+  $ hg status -A capsdir1/capsdir
+  M CapsDir1/CapsDir/SubDir/Def.txt
+  C CapsDir1/CapsDir/ABC.txt
+
   $ hg remove -f 'glob:**.txt' -X capsdir1/capsdir
   $ hg remove -f 'glob:**.txt' -I capsdir1/capsdir
-  removing CapsDir1/CapsDir/AbC.txt (glob)
+  removing CapsDir1/CapsDir/ABC.txt (glob)
   removing CapsDir1/CapsDir/SubDir/Def.txt (glob)
 #endif
 
--- a/tests/test-strip.t	Tue Jan 27 11:26:27 2015 -0800
+++ b/tests/test-strip.t	Wed Aug 12 17:01:50 2015 -0500
@@ -826,3 +826,26 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     mergeCD
   
+
+Error during post-close callback of the strip transaction
+(They should be gracefully handled and reported)
+
+  $ cat > ../crashstrip.py << EOF
+  > from mercurial import error
+  > def reposetup(ui, repo):
+  >     class crashstriprepo(repo.__class__):
+  >         def transaction(self, desc, *args, **kwargs):
+  >             tr = super(crashstriprepo, self).transaction(self, desc, *args, **kwargs)
+  >             if desc == 'strip':
+  >                 def crash(tra): raise error.Abort('boom')
+  >                 tr.addpostclose('crash', crash)
+  >             return tr
+  >     repo.__class__ = crashstriprepo
+  > EOF
+  $ hg strip tip --config extensions.crash=$TESTTMP/crashstrip.py
+  saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg (glob)
+  strip failed, full bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg'
+  abort: boom
+  [255]
+
+