[PATCH 2 of 3 stable] largefiles: mark lfile as added in lfdirstate when the standin is added

Mads Kiilerich mads at kiilerich.com
Wed Dec 31 08:05:59 CST 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1420033562 -3600
#      Wed Dec 31 14:46:02 2014 +0100
# Branch stable
# Node ID 997a96cf63443db2f8d4682d25d367e9344b2cdb
# Parent  97eb62b0f4a91cea78909e7098c6b069c3899f89
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.

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -445,7 +445,7 @@ def overridecalculateupdates(origfn, rep
     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 overridecalculateupdates(origfn, rep
 
 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)
 


More information about the Mercurial-devel mailing list