largefiles: mark lfile as added in lfdirstate when the standin is added stable
authorMads Kiilerich <madski@unity3d.com>
Wed, 31 Dec 2014 14:46:02 +0100
branchstable
changeset 23695 997a96cf6344
parent 23694 97eb62b0f4a9
child 23696 1265a3a71d75
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.
hgext/largefiles/overrides.py
--- 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)