diff hgext/largefiles/lfcommands.py @ 35186:aef2b98d9352

merge with stable
author Kevin Bullock <kbullock+mercurial@ringworld.org>
date Fri, 01 Dec 2017 15:21:05 -0600
parents 4abfe4169259 b175e54c1103
children 576ba8194fa8
line wrap: on
line diff
--- a/hgext/largefiles/lfcommands.py	Thu Nov 16 03:52:42 2017 +0100
+++ b/hgext/largefiles/lfcommands.py	Fri Dec 01 15:21:05 2017 -0600
@@ -455,6 +455,7 @@
             lfiles = [f for f in lfiles if f in filelist]
 
         update = {}
+        dropped = set()
         updated, removed = 0, 0
         wvfs = repo.wvfs
         wctx = repo[None]
@@ -476,7 +477,11 @@
                 expecthash = lfutil.readasstandin(wctx[relstandin])
                 if expecthash != '':
                     if lfile not in wctx: # not switched to normal file
-                        wvfs.unlinkpath(rellfile, ignoremissing=True)
+                        if repo.dirstate[relstandin] != '?':
+                            wvfs.unlinkpath(rellfile, ignoremissing=True)
+                        else:
+                            dropped.add(rellfile)
+
                     # use normallookup() to allocate an entry in largefiles
                     # dirstate to prevent lfilesrepo.status() from reporting
                     # missing files as removed.
@@ -496,6 +501,15 @@
         lfdirstate.write()
 
         if lfiles:
+            lfiles = [f for f in lfiles if f not in dropped]
+
+            for f in dropped:
+                repo.wvfs.unlinkpath(lfutil.standin(f))
+
+                # This needs to happen for dropped files, otherwise they stay in
+                # the M state.
+                lfutil.synclfdirstate(repo, lfdirstate, f, normallookup)
+
             statuswriter(_('getting changed largefiles\n'))
             cachelfiles(ui, repo, None, lfiles)