Mercurial > public > mercurial-scm > hg
diff hgext/largefiles/lfcommands.py @ 15472:6a7e874390b0 stable
largefiles: treat status of cache missed largefiles as "missing" correctly
"hg status" may treat cache missed largefiles as "removed" incorrectly.
assumptions for problem case:
- there is no cache for largefile "L"
- at first, update working directory to the revision in which "L" is
not yet added,
- then, update working directory to the revision in which "L" is
already added
and now, "hg status" treats "L" as "removed".
current implementation does not allocate entry for cache missed
largefile in ".hg/largefiles/dirstate", but files without
".hg/largefiles/dirstate" entry are treated as "removed" by largefiles
extension.
"hg revert" can not recover from this situation, but "rm -rf
.hg/largefiles", because it causes dirstate rebuilding.
this patch invokes normallookup() for cache missed largefiles to
allocate entry in ".hg/largefiles/dirstate", so "hg status" can treat
it as "missing" correctly.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 11 Nov 2011 02:33:01 +0900 |
parents | a53888685a6c |
children | 6c5e6ebe0812 |
line wrap: on
line diff
--- a/hgext/largefiles/lfcommands.py Thu Nov 10 11:00:02 2011 -0600 +++ b/hgext/largefiles/lfcommands.py Fri Nov 11 02:33:01 2011 +0900 @@ -437,7 +437,11 @@ (not os.path.exists(abslfile) or expecthash != lfutil.hashfile(abslfile))): if not lfutil.copyfromcache(repo, expecthash, lfile): - return None # don't try to set the mode or update the dirstate + # use normallookup() to allocate entry in largefiles dirstate, + # because lack of it misleads lfiles_repo.status() into + # recognition that such cache missing files are REMOVED. + lfdirstate.normallookup(lfile) + return None # don't try to set the mode ret = 1 mode = os.stat(absstandin).st_mode if mode != os.stat(abslfile).st_mode: