Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
15470:93273948cdce | 15472:6a7e874390b0 |
---|---|
435 expecthash = lfutil.readstandin(repo, lfile) | 435 expecthash = lfutil.readstandin(repo, lfile) |
436 if (expecthash != '' and | 436 if (expecthash != '' and |
437 (not os.path.exists(abslfile) or | 437 (not os.path.exists(abslfile) or |
438 expecthash != lfutil.hashfile(abslfile))): | 438 expecthash != lfutil.hashfile(abslfile))): |
439 if not lfutil.copyfromcache(repo, expecthash, lfile): | 439 if not lfutil.copyfromcache(repo, expecthash, lfile): |
440 return None # don't try to set the mode or update the dirstate | 440 # use normallookup() to allocate entry in largefiles dirstate, |
441 # because lack of it misleads lfiles_repo.status() into | |
442 # recognition that such cache missing files are REMOVED. | |
443 lfdirstate.normallookup(lfile) | |
444 return None # don't try to set the mode | |
441 ret = 1 | 445 ret = 1 |
442 mode = os.stat(absstandin).st_mode | 446 mode = os.stat(absstandin).st_mode |
443 if mode != os.stat(abslfile).st_mode: | 447 if mode != os.stat(abslfile).st_mode: |
444 os.chmod(abslfile, mode) | 448 os.chmod(abslfile, mode) |
445 ret = 1 | 449 ret = 1 |