diff hgext/largefiles/overrides.py @ 23695:997a96cf6344 stable

largefiles: mark lfile as added in lfdirstate when the standin is added This is an alternative solution to the problem addressed by f72d73937853. This implementation has the advantage that it doesn't mark clean largefiles as normallookup. We can thus avoid repeated rehashing of all largefiles when f72d73937853 is backed out. This implementation use the existing 'lfmr' actions that 23fe278bde43 introduced for handling another part of the same cases.
author Mads Kiilerich <madski@unity3d.com>
date Wed, 31 Dec 2014 14:46:02 +0100
parents 70afc58c32d3
children 3314664606e6 1b3df5ef5949
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Wed Dec 31 14:45:02 2014 +0100
+++ b/hgext/largefiles/overrides.py	Wed Dec 31 14:46:02 2014 +0100
@@ -445,7 +445,7 @@
     removes = set(a[0] for a in actions['r'])
 
     newglist = []
-    lfmr = [] # LargeFiles: Mark as Removed
+    lfmr = [] # LargeFiles: Mark as Removed ... and mark largefile as added
     for action in actions['g']:
         f, args, msg = action
         splitstandin = f and lfutil.splitstandin(f)
@@ -514,10 +514,14 @@
 
 def mergerecordupdates(orig, repo, actions, branchmerge):
     if 'lfmr' in actions:
-        # this should be executed before 'orig', to execute 'remove'
-        # before all other actions
+        lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
         for lfile, args, msg in actions['lfmr']:
+            # this should be executed before 'orig', to execute 'remove'
+            # before all other actions
             repo.dirstate.remove(lfile)
+            # make sure lfile doesn't get synclfdirstate'd as normal
+            lfdirstate.add(lfile)
+        lfdirstate.write()
 
     return orig(repo, actions, branchmerge)