hg-bfiles
changeset 264:f095584fd25b
Don't crash when regenerating bfdirstate if a big file has been removed.
Record the removal in bfdirstate instead of trying to read the now
non-existeng standin file.
Record the removal in bfdirstate instead of trying to read the now
non-existeng standin file.
| author | Greg Ward <greg@gerg.ca> |
|---|---|
| date | Thu Mar 24 10:21:24 2011 -0400 (14 months ago) |
| parents | e9f10934ed38 |
| children | 48c118d1ed2b |
| files | bfiles/bfutil.py tests/test-refresh.py tests/test-refresh.py.out |
line diff
1.1 --- a/bfiles/bfutil.py 1.2 +++ b/bfiles/bfutil.py 1.3 @@ -101,6 +101,11 @@ 1.4 matcher = _get_standin_matcher(repo) 1.5 for standin in dirstate_walk(repo.dirstate, matcher): 1.6 bigfile = _split_standin(standin) 1.7 + state = repo.dirstate[standin] 1.8 + if state == 'r': 1.9 + bfdirstate.remove(bigfile) 1.10 + continue 1.11 + 1.12 hash = _read_standin(repo, standin) 1.13 try: 1.14 curhash = _hashfile(open(bigfile, 'rb'))
2.1 --- a/tests/test-refresh.py 2.2 +++ b/tests/test-refresh.py 2.3 @@ -95,3 +95,13 @@ 2.4 hgt.hg(['bfstatus'], 2.5 stdout=('BPM sub/big3\n' 2.6 'BPC big2\n')) 2.7 + 2.8 +# Don't crash when regenerating the bfiles dirstate if a big file has been 2.9 +# removed. 2.10 +hgt.announce('regenerate dirstate when big file removed') 2.11 +os.remove('.hg/bfiles/dirstate') 2.12 +hgt.hg(['remove', '.hgbfiles/big1']) 2.13 +hgt.hg(['bfstatus'], 2.14 + stdout=('BPM sub/big3\n' 2.15 + 'B-R big1\n' 2.16 + 'BPC big2\n'))
