comparison hgext/fastannotate/revmap.py @ 49284:d44e3c45f0e4

py3: replace `pycompat.xrange` by `range`
author Manuel Jacob <me@manueljacob.de>
date Sun, 29 May 2022 15:17:27 +0200
parents 642e31cb55f0
children f4733654f144
comparison
equal deleted inserted replaced
49283:44b26349127b 49284:d44e3c45f0e4
13 13
14 from mercurial.node import hex 14 from mercurial.node import hex
15 from mercurial.pycompat import open 15 from mercurial.pycompat import open
16 from mercurial import ( 16 from mercurial import (
17 error as hgerror, 17 error as hgerror,
18 pycompat,
19 ) 18 )
20 from . import error 19 from . import error
21 20
22 # the revmap file format is straightforward: 21 # the revmap file format is straightforward:
23 # 22 #
163 if not self.path: 162 if not self.path:
164 return 163 return
165 if self._lastmaxrev == -1: # write the entire file 164 if self._lastmaxrev == -1: # write the entire file
166 with open(self.path, b'wb') as f: 165 with open(self.path, b'wb') as f:
167 f.write(self.HEADER) 166 f.write(self.HEADER)
168 for i in pycompat.xrange(1, len(self._rev2hsh)): 167 for i in range(1, len(self._rev2hsh)):
169 self._writerev(i, f) 168 self._writerev(i, f)
170 else: # append incrementally 169 else: # append incrementally
171 with open(self.path, b'ab') as f: 170 with open(self.path, b'ab') as f:
172 for i in pycompat.xrange( 171 for i in range(self._lastmaxrev + 1, len(self._rev2hsh)):
173 self._lastmaxrev + 1, len(self._rev2hsh)
174 ):
175 self._writerev(i, f) 172 self._writerev(i, f)
176 self._lastmaxrev = self.maxrev 173 self._lastmaxrev = self.maxrev
177 174
178 def _load(self): 175 def _load(self):
179 """load state from file""" 176 """load state from file"""