changeset 26817:b68797f244e4 stable

largefiles: fix explicit commit of normal/largefile switch Commit of corresponding normal/largefiles pairs would only commit the standin. That is usually fine, except if either the normal file or the standin is a remove while the other is an add. In that case it would either give duplicate colliding entries or lose the file. Instead, commit both filenames if one of them is a remove.
author Mads Kiilerich <madski@unity3d.com>
date Wed, 21 Oct 2015 00:18:11 +0200
parents e82bce7ec843
children c7d30fdb13b2
files hgext/largefiles/lfutil.py tests/test-largefiles.t
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py	Wed Oct 21 00:10:46 2015 +0200
+++ b/hgext/largefiles/lfutil.py	Wed Oct 21 00:18:11 2015 +0200
@@ -562,8 +562,11 @@
     for f in match._files:
         fstandin = standin(f)
 
-        # ignore known largefiles and standins
-        if f in lfiles or fstandin in standins:
+        # For largefiles, only one of the normal and standin should be
+        # committed (except if one of them is a remove).
+        # Thus, skip plain largefile names but keep the standin.
+        if (f in lfiles or fstandin in standins) and \
+            repo.dirstate[f] != 'r' and repo.dirstate[fstandin] != 'r':
             continue
 
         actualfiles.append(f)
--- a/tests/test-largefiles.t	Wed Oct 21 00:10:46 2015 +0200
+++ b/tests/test-largefiles.t	Wed Oct 21 00:18:11 2015 +0200
@@ -1850,7 +1850,7 @@
   .hglf/normal3
   .hglf/sub2/large6
   .hglf/sub2/large7
-  normal3
+  large4-renamed
   sub/normal4
 
   $ cd ..