##// END OF EJS Templates
revlog: rename `datafile` to `datafile`...
marmoute -
r47920:396442cd default
parent child Browse files
Show More
@@ -3040,7 +3040,9 b' def _temprevlog(ui, orig, truncaterev):'
3040 # compatibility with <= hg-5.8
3040 # compatibility with <= hg-5.8
3041 indexfile = getattr(orig, 'indexfile')
3041 indexfile = getattr(orig, 'indexfile')
3042 origindexpath = orig.opener.join(indexfile)
3042 origindexpath = orig.opener.join(indexfile)
3043 origdatapath = orig.opener.join(orig.datafile)
3043
3044 datafile = getattr(orig, '_datafile', getattr(orig, 'datafile'))
3045 origdatapath = orig.opener.join(datafile)
3044 indexname = 'revlog.i'
3046 indexname = 'revlog.i'
3045 dataname = 'revlog.d'
3047 dataname = 'revlog.d'
3046
3048
@@ -3141,7 +3143,8 b' def perfrevlogchunks(ui, repo, file_=Non'
3141 indexfile = getattr(rl, 'indexfile')
3143 indexfile = getattr(rl, 'indexfile')
3142 return getsvfs(repo)(indexfile)
3144 return getsvfs(repo)(indexfile)
3143 else:
3145 else:
3144 return getsvfs(repo)(rl.datafile)
3146 datafile = getattr(rl, 'datafile', getattr(rl, 'datafile'))
3147 return getsvfs(repo)(datafile)
3145
3148
3146 def doread():
3149 def doread():
3147 rl.clearcaches()
3150 rl.clearcaches()
@@ -324,7 +324,7 b' class revlog(object):'
324 if postfix is not None:
324 if postfix is not None:
325 indexfile = b'%s.%s' % (indexfile, postfix)
325 indexfile = b'%s.%s' % (indexfile, postfix)
326 self._indexfile = indexfile
326 self._indexfile = indexfile
327 self.datafile = datafile
327 self._datafile = datafile
328 self.nodemap_file = None
328 self.nodemap_file = None
329 self.postfix = postfix
329 self.postfix = postfix
330 if persistentnodemap:
330 if persistentnodemap:
@@ -608,7 +608,7 b' class revlog(object):'
608
608
609 def _datafp(self, mode=b'r'):
609 def _datafp(self, mode=b'r'):
610 """file object for the revlog's data file"""
610 """file object for the revlog's data file"""
611 return self.opener(self.datafile, mode=mode)
611 return self.opener(self._datafile, mode=mode)
612
612
613 @contextlib.contextmanager
613 @contextlib.contextmanager
614 def _datareadfp(self, existingfp=None):
614 def _datareadfp(self, existingfp=None):
@@ -1547,7 +1547,7 b' class revlog(object):'
1547 b'offset %d, got %d'
1547 b'offset %d, got %d'
1548 )
1548 )
1549 % (
1549 % (
1550 self._indexfile if self._inline else self.datafile,
1550 self._indexfile if self._inline else self._datafile,
1551 length,
1551 length,
1552 realoffset,
1552 realoffset,
1553 len(d) - startoffset,
1553 len(d) - startoffset,
@@ -1563,7 +1563,7 b' class revlog(object):'
1563 b'%d, got %d'
1563 b'%d, got %d'
1564 )
1564 )
1565 % (
1565 % (
1566 self._indexfile if self._inline else self.datafile,
1566 self._indexfile if self._inline else self._datafile,
1567 length,
1567 length,
1568 offset,
1568 offset,
1569 len(d),
1569 len(d),
@@ -1961,7 +1961,7 b' class revlog(object):'
1961 _(b"%s not found in the transaction") % self._indexfile
1961 _(b"%s not found in the transaction") % self._indexfile
1962 )
1962 )
1963 trindex = 0
1963 trindex = 0
1964 tr.add(self.datafile, 0)
1964 tr.add(self._datafile, 0)
1965
1965
1966 if fp:
1966 if fp:
1967 fp.flush()
1967 fp.flush()
@@ -2256,7 +2256,7 b' class revlog(object):'
2256 self._concurrencychecker(
2256 self._concurrencychecker(
2257 ifh, self._indexfile, curr * self.index.entry_size
2257 ifh, self._indexfile, curr * self.index.entry_size
2258 )
2258 )
2259 self._concurrencychecker(dfh, self.datafile, offset)
2259 self._concurrencychecker(dfh, self._datafile, offset)
2260
2260
2261 p1r, p2r = self.rev(p1), self.rev(p2)
2261 p1r, p2r = self.rev(p1), self.rev(p2)
2262
2262
@@ -2370,7 +2370,7 b' class revlog(object):'
2370
2370
2371 curr = len(self) - 1
2371 curr = len(self) - 1
2372 if not self._inline:
2372 if not self._inline:
2373 transaction.add(self.datafile, offset)
2373 transaction.add(self._datafile, offset)
2374 transaction.add(self._indexfile, curr * len(entry))
2374 transaction.add(self._indexfile, curr * len(entry))
2375 if data[0]:
2375 if data[0]:
2376 dfh.write(data[0])
2376 dfh.write(data[0])
@@ -2423,7 +2423,7 b' class revlog(object):'
2423 dfh = None
2423 dfh = None
2424 else:
2424 else:
2425 transaction.add(self._indexfile, isize)
2425 transaction.add(self._indexfile, isize)
2426 transaction.add(self.datafile, end)
2426 transaction.add(self._datafile, end)
2427 dfh = self._datafp(b"a+")
2427 dfh = self._datafp(b"a+")
2428
2428
2429 def flush():
2429 def flush():
@@ -2572,7 +2572,7 b' class revlog(object):'
2572 # first truncate the files on disk
2572 # first truncate the files on disk
2573 end = self.start(rev)
2573 end = self.start(rev)
2574 if not self._inline:
2574 if not self._inline:
2575 transaction.add(self.datafile, end)
2575 transaction.add(self._datafile, end)
2576 end = rev * self.index.entry_size
2576 end = rev * self.index.entry_size
2577 else:
2577 else:
2578 end += rev * self.index.entry_size
2578 end += rev * self.index.entry_size
@@ -2633,7 +2633,7 b' class revlog(object):'
2633 def files(self):
2633 def files(self):
2634 res = [self._indexfile]
2634 res = [self._indexfile]
2635 if not self._inline:
2635 if not self._inline:
2636 res.append(self.datafile)
2636 res.append(self._datafile)
2637 return res
2637 return res
2638
2638
2639 def emitrevisions(
2639 def emitrevisions(
@@ -2853,7 +2853,7 b' class revlog(object):'
2853 )
2853 )
2854 dfh = None
2854 dfh = None
2855 if not destrevlog._inline:
2855 if not destrevlog._inline:
2856 dfh = destrevlog.opener(destrevlog.datafile, b'a+')
2856 dfh = destrevlog.opener(destrevlog._datafile, b'a+')
2857 try:
2857 try:
2858 destrevlog._addrevision(
2858 destrevlog._addrevision(
2859 node,
2859 node,
@@ -2956,11 +2956,11 b' class revlog(object):'
2956
2956
2957 tr.addbackup(self._indexfile, location=b'store')
2957 tr.addbackup(self._indexfile, location=b'store')
2958 if not self._inline:
2958 if not self._inline:
2959 tr.addbackup(self.datafile, location=b'store')
2959 tr.addbackup(self._datafile, location=b'store')
2960
2960
2961 self.opener.rename(newrl._indexfile, self._indexfile)
2961 self.opener.rename(newrl._indexfile, self._indexfile)
2962 if not self._inline:
2962 if not self._inline:
2963 self.opener.rename(newrl.datafile, self.datafile)
2963 self.opener.rename(newrl._datafile, self._datafile)
2964
2964
2965 self.clearcaches()
2965 self.clearcaches()
2966 self._loadindex()
2966 self._loadindex()
@@ -3083,7 +3083,7 b' class revlog(object):'
3083 if exclusivefiles:
3083 if exclusivefiles:
3084 d[b'exclusivefiles'] = [(self.opener, self._indexfile)]
3084 d[b'exclusivefiles'] = [(self.opener, self._indexfile)]
3085 if not self._inline:
3085 if not self._inline:
3086 d[b'exclusivefiles'].append((self.opener, self.datafile))
3086 d[b'exclusivefiles'].append((self.opener, self._datafile))
3087
3087
3088 if sharedfiles:
3088 if sharedfiles:
3089 d[b'sharedfiles'] = []
3089 d[b'sharedfiles'] = []
@@ -82,14 +82,14 b' def _copyrevlog(tr, destrepo, oldrl, rl_'
82 newvfs = newrl.opener
82 newvfs = newrl.opener
83 oldindex = oldvfs.join(oldrl._indexfile)
83 oldindex = oldvfs.join(oldrl._indexfile)
84 newindex = newvfs.join(newrl._indexfile)
84 newindex = newvfs.join(newrl._indexfile)
85 olddata = oldvfs.join(oldrl.datafile)
85 olddata = oldvfs.join(oldrl._datafile)
86 newdata = newvfs.join(newrl.datafile)
86 newdata = newvfs.join(newrl._datafile)
87
87
88 with newvfs(newrl._indexfile, b'w'):
88 with newvfs(newrl._indexfile, b'w'):
89 pass # create all the directories
89 pass # create all the directories
90
90
91 util.copyfile(oldindex, newindex)
91 util.copyfile(oldindex, newindex)
92 copydata = oldrl.opener.exists(oldrl.datafile)
92 copydata = oldrl.opener.exists(oldrl._datafile)
93 if copydata:
93 if copydata:
94 util.copyfile(olddata, newdata)
94 util.copyfile(olddata, newdata)
95
95
@@ -414,7 +414,7 b' Check perf.py for historical portability'
414 > origindexpath = orig.opener.join(indexfile)
414 > origindexpath = orig.opener.join(indexfile)
415 use getvfs()/getsvfs() for early Mercurial
415 use getvfs()/getsvfs() for early Mercurial
416 contrib/perf.py:\d+: (re)
416 contrib/perf.py:\d+: (re)
417 > origdatapath = orig.opener.join(orig.datafile)
417 > origdatapath = orig.opener.join(datafile)
418 use getvfs()/getsvfs() for early Mercurial
418 use getvfs()/getsvfs() for early Mercurial
419 contrib/perf.py:\d+: (re)
419 contrib/perf.py:\d+: (re)
420 > vfs = vfsmod.vfs(tmpdir)
420 > vfs = vfsmod.vfs(tmpdir)
@@ -206,7 +206,7 b" def lowlevelcopy(rlog, tr, destname=b'_d"
206 try:
206 try:
207 ifh = dlog.opener(dlog._indexfile, b'a+')
207 ifh = dlog.opener(dlog._indexfile, b'a+')
208 if not dlog._inline:
208 if not dlog._inline:
209 dfh = dlog.opener(dlog.datafile, b'a+')
209 dfh = dlog.opener(dlog._datafile, b'a+')
210 dlog._addrevision(
210 dlog._addrevision(
211 rlog.node(r), text, tr, r, p1, p2, flags, cachedelta, ifh, dfh
211 rlog.node(r), text, tr, r, p1, p2, flags, cachedelta, ifh, dfh
212 )
212 )
General Comments 0
You need to be logged in to leave comments. Login now