Patchwork [stable] largefiles: don't crash on 'local renamed directory' actions

login
register
mail settings
Submitter Mads Kiilerich
Date Nov. 26, 2013, 2:51 p.m.
Message ID <d465dbe4a542f1f486a3.1385477490@mk-desktop>
Download mbox | patch
Permalink /patch/3154/
State Accepted
Commit 7ac03bfa136940370da4848993620c24352a5a27
Headers show

Comments

Mads Kiilerich - Nov. 26, 2013, 2:51 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1385476713 -3600
#      Tue Nov 26 15:38:33 2013 +0100
# Branch stable
# Node ID d465dbe4a542f1f486a3fb4cfa3915ee72f6d805
# Parent  2ca325ea57fa13909e28cc2caeae3c73e60693f8
largefiles: don't crash on 'local renamed directory' actions

a12798938721 introduced splitstandin on all action filenames. It would however
crash on 'd' actions where the filename is None.

Fix that and add test coverage for that case.
Matt Mackall - Dec. 1, 2013, 7:05 p.m.
On Tue, 2013-11-26 at 15:51 +0100, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1385476713 -3600
> #      Tue Nov 26 15:38:33 2013 +0100
> # Branch stable
> # Node ID d465dbe4a542f1f486a3fb4cfa3915ee72f6d805
> # Parent  2ca325ea57fa13909e28cc2caeae3c73e60693f8
> largefiles: don't crash on 'local renamed directory' actions

Queued for stable, thanks.

Patch

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -380,7 +380,7 @@ 
     for action in actions:
         f, m, args, msg = action
 
-        splitstandin = lfutil.splitstandin(f)
+        splitstandin = f and lfutil.splitstandin(f)
         if (m == "g" and splitstandin is not None and
             splitstandin in p1 and splitstandin not in removes):
             # Case 1: normal file in the working copy, largefile in
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -2192,6 +2192,39 @@ 
 
   $ cd ..
 
+merge action 'd' for 'local renamed directory to d2/g' which has no filename
+
+  $ hg init merge-action
+  $ cd merge-action
+  $ touch l
+  $ hg add --large l
+  $ mkdir d1
+  $ touch d1/f
+  $ hg ci -Aqm0
+  Invoking status precommit hook
+  A d1/f
+  A l
+  $ echo > d1/f
+  $ touch d1/g
+  $ hg ci -Aqm1
+  Invoking status precommit hook
+  M d1/f
+  A d1/g
+  $ hg up -qr0
+  $ hg mv d1 d2
+  moving d1/f to d2/f (glob)
+  $ hg ci -qm2
+  Invoking status precommit hook
+  A d2/f
+  R d1/f
+  $ hg merge
+  merging d2/f and d1/f to d2/f
+  1 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  getting changed largefiles
+  0 largefiles updated, 0 removed
+  $ cd ..
+
 Check whether "largefiles" feature is supported only in repositories
 enabling largefiles extension.