Mercurial > hg-stable
changeset 23862:7aa1405528a3
branchcache: add debug output whenever cache files use truncate
The cache files are usually append only but will automatically be truncated and
recover in exceptional situations. Add a debug notice when such exceptional
situations are encountered.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Wed, 14 Jan 2015 01:15:26 +0100 |
parents | 01426cad66dc |
children | 669106fc5bb1 |
files | mercurial/branchmap.py tests/test-branches.t tests/test-rebase-conflicts.t |
diffstat | 3 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/branchmap.py Wed Jan 14 01:15:26 2015 +0100 +++ b/mercurial/branchmap.py Wed Jan 14 01:15:26 2015 +0100 @@ -414,6 +414,7 @@ f.write('\0') else: f.close() + repo.ui.debug("%s changed - rewriting it\n" % _rbcnames) self._rbcnamescount = 0 self._rbcrevslen = 0 if self._rbcnamescount == 0: @@ -438,6 +439,7 @@ # see issue3543. SEEK_END was added in 2.5 f.seek(0, 2) #os.SEEK_END if f.tell() != start: + repo.ui.debug("truncating %s to %s\n" % (_rbcrevs, start)) f.seek(start) f.truncate() end = self._rbcrevslen * _rbcrecsize
--- a/tests/test-branches.t Wed Jan 14 01:15:26 2015 +0100 +++ b/tests/test-branches.t Wed Jan 14 01:15:26 2015 +0100 @@ -550,6 +550,7 @@ recovery from invalid cache revs file with trailing data $ echo >> .hg/cache/rbc-revs-v1 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug + truncating cache/rbc-revs-v1 to 120 5 $ f --size .hg/cache/rbc-revs* .hg/cache/rbc-revs-v1: size=120 @@ -559,6 +560,7 @@ $ f --size .hg/cache/rbc-revs* .hg/cache/rbc-revs-v1: size=119 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug + truncating cache/rbc-revs-v1 to 112 5 $ f --size .hg/cache/rbc-revs* .hg/cache/rbc-revs-v1: size=120 @@ -580,6 +582,7 @@ $ hg log -r 'branch(.)' -T '{rev} ' 3 4 8 9 10 11 12 13 (no-eol) $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug + truncating cache/rbc-revs-v1 to 8 5 $ f --size --hexdump --bytes=16 .hg/cache/rbc-revs* .hg/cache/rbc-revs-v1: size=120
--- a/tests/test-rebase-conflicts.t Wed Jan 14 01:15:26 2015 +0100 +++ b/tests/test-rebase-conflicts.t Wed Jan 14 01:15:26 2015 +0100 @@ -322,5 +322,6 @@ files: 1/1 chunks (100.00%) added 2 changesets with 2 changes to 1 files invalid branchheads cache (served): tip differs + truncating cache/rbc-revs-v1 to 72 rebase completed updating the branch cache