Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
22096:61e526585b20 | 22097:7d1eac06ab2b |
---|---|
1145 result = orig(ui, repo, **opts) | 1145 result = orig(ui, repo, **opts) |
1146 merge.update(repo, node=None, branchmerge=False, force=True, | 1146 merge.update(repo, node=None, branchmerge=False, force=True, |
1147 partial=lfutil.isstandin) | 1147 partial=lfutil.isstandin) |
1148 | 1148 |
1149 lfdirstate = lfutil.openlfdirstate(ui, repo) | 1149 lfdirstate = lfutil.openlfdirstate(ui, repo) |
1150 orphans = set(lfdirstate) | |
1150 lfiles = lfutil.listlfiles(repo) | 1151 lfiles = lfutil.listlfiles(repo) |
1151 for file in lfiles: | 1152 for file in lfiles: |
1152 lfutil.synclfdirstate(repo, lfdirstate, file, True) | 1153 lfutil.synclfdirstate(repo, lfdirstate, file, True) |
1154 orphans.discard(file) | |
1155 for lfile in orphans: | |
1156 lfdirstate.drop(lfile) | |
1153 lfdirstate.write() | 1157 lfdirstate.write() |
1154 finally: | 1158 finally: |
1155 wlock.release() | 1159 wlock.release() |
1156 return result | 1160 return result |
1157 | 1161 |