diff hgext/largefiles/overrides.py @ 23721:1b3df5ef5949 stable

largefiles: properly sync lfdirstate after removing largefiles The more aggressive synchronization of lfdirstate that was backed out in 1265a3a71d75 masked the problem where lfdirstate would hold an 'R' for a largefile that was added and then removed without a commit between. We could just conditionally call lfdirstate.drop() or lfdirstate.remove() here, but this also properly updates lfdirstate if the standin doesn't exist for the file somehow (i.e. call drop instead of remove). Without this change, the precommit status in the commit command immediately after the test change lists the removed (and never committed) largefile as 'R'. It can also lead to situations where the status command reports the same, long after the commit [1]. [1] http://www.selenic.com/pipermail/mercurial-devel/2015-January/065153.html
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 04 Jan 2015 15:26:26 -0500
parents 997a96cf6344
children d944492445fa
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Thu Jan 01 16:30:11 2015 -0600
+++ b/hgext/largefiles/overrides.py	Sun Jan 04 15:26:26 2015 -0500
@@ -206,12 +206,10 @@
             if not opts.get('dry_run'):
                 if not after:
                     util.unlinkpath(repo.wjoin(f), ignoremissing=True)
-                lfdirstate.remove(f)
 
         if opts.get('dry_run'):
             return result
 
-        lfdirstate.write()
         remove = [lfutil.standin(f) for f in remove]
         # If this is being called by addremove, let the original addremove
         # function handle this.
@@ -219,6 +217,12 @@
             for f in remove:
                 util.unlinkpath(repo.wjoin(f), ignoremissing=True)
         repo[None].forget(remove)
+
+        for f in remove:
+            lfutil.synclfdirstate(repo, lfdirstate, lfutil.splitstandin(f),
+                                  False)
+
+        lfdirstate.write()
     finally:
         wlock.release()