diff hgext/largefiles/overrides.py @ 22097:7d1eac06ab2b

largefiles: drop orphan entries from lfdristat at "hg rollback" Before this patch, newly added (but not yet committed) largefiles aren't treated as unknown ("?") after "hg rollback". After "hg rollback", lfdirstate still contains "A" status entries for such largefiles, even though corresponding entries for standins are already dropped from dirstate. Such "orphan" entries in lfdirstate prevent unknown (large)files in the working directory from being listed up in "unknown" list. The code path in "if working" route of "lfilesrepo.status" below drops largefiles tracked in lfdirstate from "unknown" list: lfiles = set(lfdirstate._map) # Unknown files result[4] = set(result[4]).difference(lfiles) This patch drops orphan entries from lfdristate at "hg rollback". This is a temporary way to fix with less changes. For fundamental resolution of this kind of problems in the future, lfdirstate should be rollback-ed as a part of transaction, as same as dirstate.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 11 Aug 2014 22:29:43 +0900
parents 61e526585b20
children d3702a822241
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Mon Aug 11 22:29:43 2014 +0900
+++ b/hgext/largefiles/overrides.py	Mon Aug 11 22:29:43 2014 +0900
@@ -1147,9 +1147,13 @@
                      partial=lfutil.isstandin)
 
         lfdirstate = lfutil.openlfdirstate(ui, repo)
+        orphans = set(lfdirstate)
         lfiles = lfutil.listlfiles(repo)
         for file in lfiles:
             lfutil.synclfdirstate(repo, lfdirstate, file, True)
+            orphans.discard(file)
+        for lfile in orphans:
+            lfdirstate.drop(lfile)
         lfdirstate.write()
     finally:
         wlock.release()