Mercurial > hg-stable
changeset 29758:3dbc95f3eb31
branchmap: remove extra indent
This clean up the rest of the previous changeset.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Fri, 05 Aug 2016 15:01:16 +0200 |
parents | 3b184adfb5be |
children | aba2bb2a6d0f |
files | mercurial/branchmap.py |
diffstat | 1 files changed, 26 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/branchmap.py Fri Aug 05 15:00:53 2016 +0200 +++ b/mercurial/branchmap.py Fri Aug 05 15:01:16 2016 +0200 @@ -476,27 +476,23 @@ if self._rbcnamescount < len(self._names): step = ' names' wlock = repo.wlock(wait=False) - if True: - if self._rbcnamescount != 0: - f = repo.vfs.open(_rbcnames, 'ab') - if f.tell() == self._rbcsnameslen: - 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: - # before rewriting names, make sure references are - # removed - repo.vfs.unlinkpath(_rbcrevs, ignoremissing=True) - f = repo.vfs.open(_rbcnames, 'wb') - f.write('\0'.join(encoding.fromlocal(b) - for b in self._names[self._rbcnamescount:] - )) - self._rbcsnameslen = f.tell() - f.close() + if self._rbcnamescount != 0: + f = repo.vfs.open(_rbcnames, 'ab') + if f.tell() == self._rbcsnameslen: + 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: + # before rewriting names, make sure references are removed + repo.vfs.unlinkpath(_rbcrevs, ignoremissing=True) + f = repo.vfs.open(_rbcnames, 'wb') + f.write('\0'.join(encoding.fromlocal(b) + for b in self._names[self._rbcnamescount:])) + self._rbcsnameslen = f.tell() + f.close() self._rbcnamescount = len(self._names) start = self._rbcrevslen * _rbcrecsize @@ -506,19 +502,17 @@ wlock = repo.wlock(wait=False) revs = min(len(repo.changelog), len(self._rbcrevs) // _rbcrecsize) - if True: - f = repo.vfs.open(_rbcrevs, 'ab') + f = repo.vfs.open(_rbcrevs, 'ab') + if f.tell() != start: + repo.ui.debug("truncating %s to %s\n" % (_rbcrevs, start)) + f.seek(start) if f.tell() != start: - repo.ui.debug("truncating %s to %s\n" - % (_rbcrevs, start)) + start = 0 f.seek(start) - if f.tell() != start: - start = 0 - f.seek(start) - f.truncate() - end = revs * _rbcrecsize - f.write(self._rbcrevs[start:end]) - f.close() + f.truncate() + end = revs * _rbcrecsize + f.write(self._rbcrevs[start:end]) + f.close() self._rbcrevslen = revs except (IOError, OSError, error.Abort, error.LockError) as inst: repo.ui.debug("couldn't write revision branch cache%s: %s\n"