comparison mercurial/branchmap.py @ 37084:f0b6fbea00cf

stringutil: bulk-replace call sites to point to new module This might conflict with other patches floating around, sorry.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 22 Mar 2018 21:56:20 +0900
parents 95f4f1bfb650
children 2a4bfbb52111
comparison
equal deleted inserted replaced
37083:f99d64e8a4e4 37084:f0b6fbea00cf
19 encoding, 19 encoding,
20 error, 20 error,
21 pycompat, 21 pycompat,
22 scmutil, 22 scmutil,
23 util, 23 util,
24 )
25 from .utils import (
26 stringutil,
24 ) 27 )
25 28
26 calcsize = struct.calcsize 29 calcsize = struct.calcsize
27 pack_into = struct.pack_into 30 pack_into = struct.pack_into
28 unpack_from = struct.unpack_from 31 unpack_from = struct.unpack_from
254 'wrote %s branch cache with %d labels and %d nodes\n', 257 'wrote %s branch cache with %d labels and %d nodes\n',
255 repo.filtername, len(self), nodecount) 258 repo.filtername, len(self), nodecount)
256 except (IOError, OSError, error.Abort) as inst: 259 except (IOError, OSError, error.Abort) as inst:
257 # Abort may be raised by read only opener, so log and continue 260 # Abort may be raised by read only opener, so log and continue
258 repo.ui.debug("couldn't write branch cache: %s\n" % 261 repo.ui.debug("couldn't write branch cache: %s\n" %
259 util.forcebytestr(inst)) 262 stringutil.forcebytestr(inst))
260 263
261 def update(self, repo, revgen): 264 def update(self, repo, revgen):
262 """Given a branchhead cache, self, that may have extra nodes or be 265 """Given a branchhead cache, self, that may have extra nodes or be
263 missing heads, and a generator of nodes that are strictly a superset of 266 missing heads, and a generator of nodes that are strictly a superset of
264 heads missing, this function updates self to be correct. 267 heads missing, this function updates self to be correct.
376 try: 379 try:
377 data = repo.cachevfs.read(_rbcrevs) 380 data = repo.cachevfs.read(_rbcrevs)
378 self._rbcrevs[:] = data 381 self._rbcrevs[:] = data
379 except (IOError, OSError) as inst: 382 except (IOError, OSError) as inst:
380 repo.ui.debug("couldn't read revision branch cache: %s\n" % 383 repo.ui.debug("couldn't read revision branch cache: %s\n" %
381 util.forcebytestr(inst)) 384 stringutil.forcebytestr(inst))
382 # remember number of good records on disk 385 # remember number of good records on disk
383 self._rbcrevslen = min(len(self._rbcrevs) // _rbcrecsize, 386 self._rbcrevslen = min(len(self._rbcrevs) // _rbcrecsize,
384 len(repo.changelog)) 387 len(repo.changelog))
385 if self._rbcrevslen == 0: 388 if self._rbcrevslen == 0:
386 self._names = [] 389 self._names = []
538 f.write(self._rbcrevs[start:end]) 541 f.write(self._rbcrevs[start:end])
539 f.close() 542 f.close()
540 self._rbcrevslen = revs 543 self._rbcrevslen = revs
541 except (IOError, OSError, error.Abort, error.LockError) as inst: 544 except (IOError, OSError, error.Abort, error.LockError) as inst:
542 repo.ui.debug("couldn't write revision branch cache%s: %s\n" 545 repo.ui.debug("couldn't write revision branch cache%s: %s\n"
543 % (step, util.forcebytestr(inst))) 546 % (step, stringutil.forcebytestr(inst)))
544 finally: 547 finally:
545 if wlock is not None: 548 if wlock is not None:
546 wlock.release() 549 wlock.release()