##// END OF EJS Templates
revlog: rename `indexfile` to `_indexfile`...
marmoute -
r47919:a07d5cb0 default
parent child Browse files
Show More
@@ -2609,7 +2609,11 b' def perfrevlogindex(ui, repo, file_=None'
2609 rl = cmdutil.openrevlog(repo, b'perfrevlogindex', file_, opts)
2609 rl = cmdutil.openrevlog(repo, b'perfrevlogindex', file_, opts)
2610
2610
2611 opener = getattr(rl, 'opener') # trick linter
2611 opener = getattr(rl, 'opener') # trick linter
2612 indexfile = rl.indexfile
2612 # compat with hg <= 5.8
2613 indexfile = getattr(rl, '_indexfile', None)
2614 if indexfile is None:
2615 # compatibility with <= hg-5.8
2616 indexfile = getattr(rl, 'indexfile')
2613 data = opener.read(indexfile)
2617 data = opener.read(indexfile)
2614
2618
2615 header = struct.unpack(b'>I', data[0:4])[0]
2619 header = struct.unpack(b'>I', data[0:4])[0]
@@ -3031,7 +3035,11 b' def _temprevlog(ui, orig, truncaterev):'
3031 if util.safehasattr(orig, k):
3035 if util.safehasattr(orig, k):
3032 revlogkwargs[k] = getattr(orig, k)
3036 revlogkwargs[k] = getattr(orig, k)
3033
3037
3034 origindexpath = orig.opener.join(orig.indexfile)
3038 indexfile = getattr(orig, '_indexfile', None)
3039 if indexfile is None:
3040 # compatibility with <= hg-5.8
3041 indexfile = getattr(orig, 'indexfile')
3042 origindexpath = orig.opener.join(indexfile)
3035 origdatapath = orig.opener.join(orig.datafile)
3043 origdatapath = orig.opener.join(orig.datafile)
3036 indexname = 'revlog.i'
3044 indexname = 'revlog.i'
3037 dataname = 'revlog.d'
3045 dataname = 'revlog.d'
@@ -3127,7 +3135,11 b' def perfrevlogchunks(ui, repo, file_=Non'
3127
3135
3128 def rlfh(rl):
3136 def rlfh(rl):
3129 if rl._inline:
3137 if rl._inline:
3130 return getsvfs(repo)(rl.indexfile)
3138 indexfile = getattr(rl, '_indexfile', None)
3139 if indexfile is None:
3140 # compatibility with <= hg-5.8
3141 indexfile = getattr(rl, 'indexfile')
3142 return getsvfs(repo)(indexfile)
3131 else:
3143 else:
3132 return getsvfs(repo)(rl.datafile)
3144 return getsvfs(repo)(rl.datafile)
3133
3145
@@ -84,12 +84,12 b' class bundlerevlog(revlog.revlog):'
84 for p in (p1, p2):
84 for p in (p1, p2):
85 if not self.index.has_node(p):
85 if not self.index.has_node(p):
86 raise error.LookupError(
86 raise error.LookupError(
87 p, self.indexfile, _(b"unknown parent")
87 p, self._indexfile, _(b"unknown parent")
88 )
88 )
89
89
90 if not self.index.has_node(deltabase):
90 if not self.index.has_node(deltabase):
91 raise LookupError(
91 raise LookupError(
92 deltabase, self.indexfile, _(b'unknown delta base')
92 deltabase, self._indexfile, _(b'unknown delta base')
93 )
93 )
94
94
95 baserev = self.rev(deltabase)
95 baserev = self.rev(deltabase)
@@ -180,7 +180,7 b' class bundlechangelog(bundlerevlog, chan'
180 self,
180 self,
181 opener,
181 opener,
182 (revlog_constants.KIND_CHANGELOG, None),
182 (revlog_constants.KIND_CHANGELOG, None),
183 self.indexfile,
183 self._indexfile,
184 cgunpacker,
184 cgunpacker,
185 linkmapper,
185 linkmapper,
186 )
186 )
@@ -201,7 +201,7 b' class bundlemanifest(bundlerevlog, manif'
201 self,
201 self,
202 opener,
202 opener,
203 (revlog_constants.KIND_MANIFESTLOG, dir),
203 (revlog_constants.KIND_MANIFESTLOG, dir),
204 self._revlog.indexfile,
204 self._revlog._indexfile,
205 cgunpacker,
205 cgunpacker,
206 linkmapper,
206 linkmapper,
207 )
207 )
@@ -233,7 +233,7 b' class bundlefilelog(filelog.filelog):'
233 opener,
233 opener,
234 # XXX should use the unencoded path
234 # XXX should use the unencoded path
235 target=(revlog_constants.KIND_FILELOG, path),
235 target=(revlog_constants.KIND_FILELOG, path),
236 indexfile=self._revlog.indexfile,
236 indexfile=self._revlog._indexfile,
237 cgunpacker=cgunpacker,
237 cgunpacker=cgunpacker,
238 linkmapper=linkmapper,
238 linkmapper=linkmapper,
239 )
239 )
@@ -804,10 +804,10 b' def _resolvenarrowrevisioninfo('
804 # We failed to resolve a parent for this node, so
804 # We failed to resolve a parent for this node, so
805 # we crash the changegroup construction.
805 # we crash the changegroup construction.
806 if util.safehasattr(store, 'target'):
806 if util.safehasattr(store, 'target'):
807 target = store.indexfile
807 target = store._indexfile
808 else:
808 else:
809 # some revlog not actually a revlog
809 # some revlog not actually a revlog
810 target = store._revlog.indexfile
810 target = store._revlog._indexfile
811
811
812 raise error.Abort(
812 raise error.Abort(
813 b"unable to resolve parent while packing '%s' %r"
813 b"unable to resolve parent while packing '%s' %r"
@@ -452,13 +452,13 b' class changelog(revlog.revlog):'
452 if not self._delayed:
452 if not self._delayed:
453 if len(self) == 0:
453 if len(self) == 0:
454 self._divert = True
454 self._divert = True
455 if self._realopener.exists(self.indexfile + b'.a'):
455 if self._realopener.exists(self._indexfile + b'.a'):
456 self._realopener.unlink(self.indexfile + b'.a')
456 self._realopener.unlink(self._indexfile + b'.a')
457 self.opener = _divertopener(self._realopener, self.indexfile)
457 self.opener = _divertopener(self._realopener, self._indexfile)
458 else:
458 else:
459 self._delaybuf = []
459 self._delaybuf = []
460 self.opener = _delayopener(
460 self.opener = _delayopener(
461 self._realopener, self.indexfile, self._delaybuf
461 self._realopener, self._indexfile, self._delaybuf
462 )
462 )
463 self._delayed = True
463 self._delayed = True
464 tr.addpending(b'cl-%i' % id(self), self._writepending)
464 tr.addpending(b'cl-%i' % id(self), self._writepending)
@@ -471,12 +471,12 b' class changelog(revlog.revlog):'
471 # move redirected index data back into place
471 # move redirected index data back into place
472 if self._divert:
472 if self._divert:
473 assert not self._delaybuf
473 assert not self._delaybuf
474 tmpname = self.indexfile + b".a"
474 tmpname = self._indexfile + b".a"
475 nfile = self.opener.open(tmpname)
475 nfile = self.opener.open(tmpname)
476 nfile.close()
476 nfile.close()
477 self.opener.rename(tmpname, self.indexfile, checkambig=True)
477 self.opener.rename(tmpname, self._indexfile, checkambig=True)
478 elif self._delaybuf:
478 elif self._delaybuf:
479 fp = self.opener(self.indexfile, b'a', checkambig=True)
479 fp = self.opener(self._indexfile, b'a', checkambig=True)
480 fp.write(b"".join(self._delaybuf))
480 fp.write(b"".join(self._delaybuf))
481 fp.close()
481 fp.close()
482 self._delaybuf = None
482 self._delaybuf = None
@@ -489,8 +489,8 b' class changelog(revlog.revlog):'
489 pretxnchangegroup"""
489 pretxnchangegroup"""
490 if self._delaybuf:
490 if self._delaybuf:
491 # make a temporary copy of the index
491 # make a temporary copy of the index
492 fp1 = self._realopener(self.indexfile)
492 fp1 = self._realopener(self._indexfile)
493 pendingfilename = self.indexfile + b".a"
493 pendingfilename = self._indexfile + b".a"
494 # register as a temp file to ensure cleanup on failure
494 # register as a temp file to ensure cleanup on failure
495 tr.registertmp(pendingfilename)
495 tr.registertmp(pendingfilename)
496 # write existing data
496 # write existing data
@@ -502,7 +502,7 b' class changelog(revlog.revlog):'
502 # switch modes so finalize can simply rename
502 # switch modes so finalize can simply rename
503 self._delaybuf = None
503 self._delaybuf = None
504 self._divert = True
504 self._divert = True
505 self.opener = _divertopener(self._realopener, self.indexfile)
505 self.opener = _divertopener(self._realopener, self._indexfile)
506
506
507 if self._divert:
507 if self._divert:
508 return True
508 return True
@@ -71,7 +71,7 b' class filelog(object):'
71
71
72 def lookup(self, node):
72 def lookup(self, node):
73 return storageutil.fileidlookup(
73 return storageutil.fileidlookup(
74 self._revlog, node, self._revlog.indexfile
74 self._revlog, node, self._revlog._indexfile
75 )
75 )
76
76
77 def linkrev(self, rev):
77 def linkrev(self, rev):
@@ -333,7 +333,7 b' class filteredchangelogmixin(object):'
333 r = super(filteredchangelogmixin, self).rev(node)
333 r = super(filteredchangelogmixin, self).rev(node)
334 if r in self.filteredrevs:
334 if r in self.filteredrevs:
335 raise error.FilteredLookupError(
335 raise error.FilteredLookupError(
336 hex(node), self.indexfile, _(b'filtered node')
336 hex(node), self._indexfile, _(b'filtered node')
337 )
337 )
338 return r
338 return r
339
339
@@ -323,13 +323,13 b' class revlog(object):'
323 datafile = b'%s.%s' % (datafile, postfix)
323 datafile = b'%s.%s' % (datafile, postfix)
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:
331 self.nodemap_file = nodemaputil.get_nodemap_file(
331 self.nodemap_file = nodemaputil.get_nodemap_file(
332 opener, self.indexfile
332 opener, self._indexfile
333 )
333 )
334
334
335 self.opener = opener
335 self.opener = opener
@@ -490,7 +490,7 b' class revlog(object):'
490 if flags:
490 if flags:
491 raise error.RevlogError(
491 raise error.RevlogError(
492 _(b'unknown flags (%#04x) in version %d revlog %s')
492 _(b'unknown flags (%#04x) in version %d revlog %s')
493 % (flags >> 16, fmt, self.indexfile)
493 % (flags >> 16, fmt, self._indexfile)
494 )
494 )
495
495
496 self._inline = False
496 self._inline = False
@@ -500,7 +500,7 b' class revlog(object):'
500 if flags & ~REVLOGV1_FLAGS:
500 if flags & ~REVLOGV1_FLAGS:
501 raise error.RevlogError(
501 raise error.RevlogError(
502 _(b'unknown flags (%#04x) in version %d revlog %s')
502 _(b'unknown flags (%#04x) in version %d revlog %s')
503 % (flags >> 16, fmt, self.indexfile)
503 % (flags >> 16, fmt, self._indexfile)
504 )
504 )
505
505
506 self._inline = versionflags & FLAG_INLINE_DATA
506 self._inline = versionflags & FLAG_INLINE_DATA
@@ -510,7 +510,7 b' class revlog(object):'
510 if flags & ~REVLOGV2_FLAGS:
510 if flags & ~REVLOGV2_FLAGS:
511 raise error.RevlogError(
511 raise error.RevlogError(
512 _(b'unknown flags (%#04x) in version %d revlog %s')
512 _(b'unknown flags (%#04x) in version %d revlog %s')
513 % (flags >> 16, fmt, self.indexfile)
513 % (flags >> 16, fmt, self._indexfile)
514 )
514 )
515
515
516 # There is a bug in the transaction handling when going from an
516 # There is a bug in the transaction handling when going from an
@@ -523,7 +523,7 b' class revlog(object):'
523
523
524 else:
524 else:
525 raise error.RevlogError(
525 raise error.RevlogError(
526 _(b'unknown version (%d) in revlog %s') % (fmt, self.indexfile)
526 _(b'unknown version (%d) in revlog %s') % (fmt, self._indexfile)
527 )
527 )
528
528
529 self.nodeconstants = sha1nodeconstants
529 self.nodeconstants = sha1nodeconstants
@@ -578,7 +578,7 b' class revlog(object):'
578 index.update_nodemap_data(*nodemap_data)
578 index.update_nodemap_data(*nodemap_data)
579 except (ValueError, IndexError):
579 except (ValueError, IndexError):
580 raise error.RevlogError(
580 raise error.RevlogError(
581 _(b"index %s is corrupted") % self.indexfile
581 _(b"index %s is corrupted") % self._indexfile
582 )
582 )
583 self.index, self._chunkcache = d
583 self.index, self._chunkcache = d
584 if not self._chunkcache:
584 if not self._chunkcache:
@@ -604,7 +604,7 b' class revlog(object):'
604 args['checkambig'] = self._checkambig
604 args['checkambig'] = self._checkambig
605 if mode == b'w':
605 if mode == b'w':
606 args['atomictemp'] = True
606 args['atomictemp'] = True
607 return self.opener(self.indexfile, **args)
607 return self.opener(self._indexfile, **args)
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"""
@@ -729,7 +729,7 b' class revlog(object):'
729 or node in self.nodeconstants.wdirfilenodeids
729 or node in self.nodeconstants.wdirfilenodeids
730 ):
730 ):
731 raise error.WdirUnsupported
731 raise error.WdirUnsupported
732 raise error.LookupError(node, self.indexfile, _(b'no node'))
732 raise error.LookupError(node, self._indexfile, _(b'no node'))
733
733
734 # Accessors for index entries.
734 # Accessors for index entries.
735
735
@@ -1393,7 +1393,7 b' class revlog(object):'
1393 # fast path: for unfiltered changelog, radix tree is accurate
1393 # fast path: for unfiltered changelog, radix tree is accurate
1394 if not getattr(self, 'filteredrevs', None):
1394 if not getattr(self, 'filteredrevs', None):
1395 raise error.AmbiguousPrefixLookupError(
1395 raise error.AmbiguousPrefixLookupError(
1396 id, self.indexfile, _(b'ambiguous identifier')
1396 id, self._indexfile, _(b'ambiguous identifier')
1397 )
1397 )
1398 # fall through to slow path that filters hidden revisions
1398 # fall through to slow path that filters hidden revisions
1399 except (AttributeError, ValueError):
1399 except (AttributeError, ValueError):
@@ -1419,7 +1419,7 b' class revlog(object):'
1419 self._pcache[id] = nl[0]
1419 self._pcache[id] = nl[0]
1420 return nl[0]
1420 return nl[0]
1421 raise error.AmbiguousPrefixLookupError(
1421 raise error.AmbiguousPrefixLookupError(
1422 id, self.indexfile, _(b'ambiguous identifier')
1422 id, self._indexfile, _(b'ambiguous identifier')
1423 )
1423 )
1424 if maybewdir:
1424 if maybewdir:
1425 raise error.WdirUnsupported
1425 raise error.WdirUnsupported
@@ -1439,7 +1439,7 b' class revlog(object):'
1439 if n:
1439 if n:
1440 return n
1440 return n
1441
1441
1442 raise error.LookupError(id, self.indexfile, _(b'no match found'))
1442 raise error.LookupError(id, self._indexfile, _(b'no match found'))
1443
1443
1444 def shortest(self, node, minlength=1):
1444 def shortest(self, node, minlength=1):
1445 """Find the shortest unambiguous prefix that matches node."""
1445 """Find the shortest unambiguous prefix that matches node."""
@@ -1453,7 +1453,7 b' class revlog(object):'
1453 # single 'ff...' match
1453 # single 'ff...' match
1454 return True
1454 return True
1455 if matchednode is None:
1455 if matchednode is None:
1456 raise error.LookupError(node, self.indexfile, _(b'no node'))
1456 raise error.LookupError(node, self._indexfile, _(b'no node'))
1457 return True
1457 return True
1458
1458
1459 def maybewdir(prefix):
1459 def maybewdir(prefix):
@@ -1474,7 +1474,9 b' class revlog(object):'
1474 return disambiguate(hexnode, length)
1474 return disambiguate(hexnode, length)
1475 except error.RevlogError:
1475 except error.RevlogError:
1476 if node != self.nodeconstants.wdirid:
1476 if node != self.nodeconstants.wdirid:
1477 raise error.LookupError(node, self.indexfile, _(b'no node'))
1477 raise error.LookupError(
1478 node, self._indexfile, _(b'no node')
1479 )
1478 except AttributeError:
1480 except AttributeError:
1479 # Fall through to pure code
1481 # Fall through to pure code
1480 pass
1482 pass
@@ -1545,7 +1547,7 b' class revlog(object):'
1545 b'offset %d, got %d'
1547 b'offset %d, got %d'
1546 )
1548 )
1547 % (
1549 % (
1548 self.indexfile if self._inline else self.datafile,
1550 self._indexfile if self._inline else self.datafile,
1549 length,
1551 length,
1550 realoffset,
1552 realoffset,
1551 len(d) - startoffset,
1553 len(d) - startoffset,
@@ -1561,7 +1563,7 b' class revlog(object):'
1561 b'%d, got %d'
1563 b'%d, got %d'
1562 )
1564 )
1563 % (
1565 % (
1564 self.indexfile if self._inline else self.datafile,
1566 self._indexfile if self._inline else self.datafile,
1565 length,
1567 length,
1566 offset,
1568 offset,
1567 len(d),
1569 len(d),
@@ -1932,11 +1934,11 b' class revlog(object):'
1932 revornode = templatefilters.short(hex(node))
1934 revornode = templatefilters.short(hex(node))
1933 raise error.RevlogError(
1935 raise error.RevlogError(
1934 _(b"integrity check failed on %s:%s")
1936 _(b"integrity check failed on %s:%s")
1935 % (self.indexfile, pycompat.bytestr(revornode))
1937 % (self._indexfile, pycompat.bytestr(revornode))
1936 )
1938 )
1937 except error.RevlogError:
1939 except error.RevlogError:
1938 if self._censorable and storageutil.iscensoredtext(text):
1940 if self._censorable and storageutil.iscensoredtext(text):
1939 raise error.CensoredNodeError(self.indexfile, node, text)
1941 raise error.CensoredNodeError(self._indexfile, node, text)
1940 raise
1942 raise
1941
1943
1942 def _enforceinlinesize(self, tr, fp=None):
1944 def _enforceinlinesize(self, tr, fp=None):
@@ -1953,10 +1955,10 b' class revlog(object):'
1953 ):
1955 ):
1954 return
1956 return
1955
1957
1956 troffset = tr.findoffset(self.indexfile)
1958 troffset = tr.findoffset(self._indexfile)
1957 if troffset is None:
1959 if troffset is None:
1958 raise error.RevlogError(
1960 raise error.RevlogError(
1959 _(b"%s not found in the transaction") % self.indexfile
1961 _(b"%s not found in the transaction") % self._indexfile
1960 )
1962 )
1961 trindex = 0
1963 trindex = 0
1962 tr.add(self.datafile, 0)
1964 tr.add(self.datafile, 0)
@@ -1988,7 +1990,7 b' class revlog(object):'
1988 # the temp file replace the real index when we exit the context
1990 # the temp file replace the real index when we exit the context
1989 # manager
1991 # manager
1990
1992
1991 tr.replace(self.indexfile, trindex * self.index.entry_size)
1993 tr.replace(self._indexfile, trindex * self.index.entry_size)
1992 nodemaputil.setup_persistent_nodemap(tr, self)
1994 nodemaputil.setup_persistent_nodemap(tr, self)
1993 self._chunkclear()
1995 self._chunkclear()
1994
1996
@@ -2024,7 +2026,7 b' class revlog(object):'
2024 """
2026 """
2025 if link == nullrev:
2027 if link == nullrev:
2026 raise error.RevlogError(
2028 raise error.RevlogError(
2027 _(b"attempted to add linkrev -1 to %s") % self.indexfile
2029 _(b"attempted to add linkrev -1 to %s") % self._indexfile
2028 )
2030 )
2029
2031
2030 if sidedata is None:
2032 if sidedata is None:
@@ -2049,7 +2051,7 b' class revlog(object):'
2049 _(
2051 _(
2050 b"%s: size of %d bytes exceeds maximum revlog storage of 2GiB"
2052 b"%s: size of %d bytes exceeds maximum revlog storage of 2GiB"
2051 )
2053 )
2052 % (self.indexfile, len(rawtext))
2054 % (self._indexfile, len(rawtext))
2053 )
2055 )
2054
2056
2055 node = node or self.hash(rawtext, p1, p2)
2057 node = node or self.hash(rawtext, p1, p2)
@@ -2220,14 +2222,14 b' class revlog(object):'
2220 """
2222 """
2221 if node == self.nullid:
2223 if node == self.nullid:
2222 raise error.RevlogError(
2224 raise error.RevlogError(
2223 _(b"%s: attempt to add null revision") % self.indexfile
2225 _(b"%s: attempt to add null revision") % self._indexfile
2224 )
2226 )
2225 if (
2227 if (
2226 node == self.nodeconstants.wdirid
2228 node == self.nodeconstants.wdirid
2227 or node in self.nodeconstants.wdirfilenodeids
2229 or node in self.nodeconstants.wdirfilenodeids
2228 ):
2230 ):
2229 raise error.RevlogError(
2231 raise error.RevlogError(
2230 _(b"%s: attempt to add wdir revision") % self.indexfile
2232 _(b"%s: attempt to add wdir revision") % self._indexfile
2231 )
2233 )
2232
2234
2233 if self._inline:
2235 if self._inline:
@@ -2247,12 +2249,12 b' class revlog(object):'
2247 # offset is "as if" it were in the .d file, so we need to add on
2249 # offset is "as if" it were in the .d file, so we need to add on
2248 # the size of the entry metadata.
2250 # the size of the entry metadata.
2249 self._concurrencychecker(
2251 self._concurrencychecker(
2250 ifh, self.indexfile, offset + curr * self.index.entry_size
2252 ifh, self._indexfile, offset + curr * self.index.entry_size
2251 )
2253 )
2252 else:
2254 else:
2253 # Entries in the .i are a consistent size.
2255 # Entries in the .i are a consistent size.
2254 self._concurrencychecker(
2256 self._concurrencychecker(
2255 ifh, self.indexfile, curr * self.index.entry_size
2257 ifh, self._indexfile, curr * self.index.entry_size
2256 )
2258 )
2257 self._concurrencychecker(dfh, self.datafile, offset)
2259 self._concurrencychecker(dfh, self.datafile, offset)
2258
2260
@@ -2369,7 +2371,7 b' class revlog(object):'
2369 curr = len(self) - 1
2371 curr = len(self) - 1
2370 if not self._inline:
2372 if not self._inline:
2371 transaction.add(self.datafile, offset)
2373 transaction.add(self.datafile, offset)
2372 transaction.add(self.indexfile, curr * len(entry))
2374 transaction.add(self._indexfile, curr * len(entry))
2373 if data[0]:
2375 if data[0]:
2374 dfh.write(data[0])
2376 dfh.write(data[0])
2375 dfh.write(data[1])
2377 dfh.write(data[1])
@@ -2378,7 +2380,7 b' class revlog(object):'
2378 ifh.write(entry)
2380 ifh.write(entry)
2379 else:
2381 else:
2380 offset += curr * self.index.entry_size
2382 offset += curr * self.index.entry_size
2381 transaction.add(self.indexfile, offset)
2383 transaction.add(self._indexfile, offset)
2382 ifh.write(entry)
2384 ifh.write(entry)
2383 ifh.write(data[0])
2385 ifh.write(data[0])
2384 ifh.write(data[1])
2386 ifh.write(data[1])
@@ -2417,10 +2419,10 b' class revlog(object):'
2417 ifh = self._indexfp(b"a+")
2419 ifh = self._indexfp(b"a+")
2418 isize = r * self.index.entry_size
2420 isize = r * self.index.entry_size
2419 if self._inline:
2421 if self._inline:
2420 transaction.add(self.indexfile, end + isize)
2422 transaction.add(self._indexfile, end + isize)
2421 dfh = None
2423 dfh = None
2422 else:
2424 else:
2423 transaction.add(self.indexfile, isize)
2425 transaction.add(self._indexfile, isize)
2424 transaction.add(self.datafile, end)
2426 transaction.add(self.datafile, end)
2425 dfh = self._datafp(b"a+")
2427 dfh = self._datafp(b"a+")
2426
2428
@@ -2452,12 +2454,12 b' class revlog(object):'
2452 for p in (p1, p2):
2454 for p in (p1, p2):
2453 if not self.index.has_node(p):
2455 if not self.index.has_node(p):
2454 raise error.LookupError(
2456 raise error.LookupError(
2455 p, self.indexfile, _(b'unknown parent')
2457 p, self._indexfile, _(b'unknown parent')
2456 )
2458 )
2457
2459
2458 if not self.index.has_node(deltabase):
2460 if not self.index.has_node(deltabase):
2459 raise error.LookupError(
2461 raise error.LookupError(
2460 deltabase, self.indexfile, _(b'unknown delta base')
2462 deltabase, self._indexfile, _(b'unknown delta base')
2461 )
2463 )
2462
2464
2463 baserev = self.rev(deltabase)
2465 baserev = self.rev(deltabase)
@@ -2470,7 +2472,7 b' class revlog(object):'
2470 newlen = len(delta) - hlen
2472 newlen = len(delta) - hlen
2471 if delta[:hlen] != mdiff.replacediffheader(oldlen, newlen):
2473 if delta[:hlen] != mdiff.replacediffheader(oldlen, newlen):
2472 raise error.CensoredBaseError(
2474 raise error.CensoredBaseError(
2473 self.indexfile, self.node(baserev)
2475 self._indexfile, self.node(baserev)
2474 )
2476 )
2475
2477
2476 if not flags and self._peek_iscensored(baserev, delta, flush):
2478 if not flags and self._peek_iscensored(baserev, delta, flush):
@@ -2575,7 +2577,7 b' class revlog(object):'
2575 else:
2577 else:
2576 end += rev * self.index.entry_size
2578 end += rev * self.index.entry_size
2577
2579
2578 transaction.add(self.indexfile, end)
2580 transaction.add(self._indexfile, end)
2579
2581
2580 # then reset internal state in memory to forget those revisions
2582 # then reset internal state in memory to forget those revisions
2581 self._revisioncache = None
2583 self._revisioncache = None
@@ -2608,7 +2610,7 b' class revlog(object):'
2608 dd = 0
2610 dd = 0
2609
2611
2610 try:
2612 try:
2611 f = self.opener(self.indexfile)
2613 f = self.opener(self._indexfile)
2612 f.seek(0, io.SEEK_END)
2614 f.seek(0, io.SEEK_END)
2613 actual = f.tell()
2615 actual = f.tell()
2614 f.close()
2616 f.close()
@@ -2629,7 +2631,7 b' class revlog(object):'
2629 return (dd, di)
2631 return (dd, di)
2630
2632
2631 def files(self):
2633 def files(self):
2632 res = [self.indexfile]
2634 res = [self._indexfile]
2633 if not self._inline:
2635 if not self._inline:
2634 res.append(self.datafile)
2636 res.append(self.datafile)
2635 return res
2637 return res
@@ -2847,7 +2849,7 b' class revlog(object):'
2847 flags = flags | new_flags[0] & ~new_flags[1]
2849 flags = flags | new_flags[0] & ~new_flags[1]
2848
2850
2849 ifh = destrevlog.opener(
2851 ifh = destrevlog.opener(
2850 destrevlog.indexfile, b'a+', checkambig=False
2852 destrevlog._indexfile, b'a+', checkambig=False
2851 )
2853 )
2852 dfh = None
2854 dfh = None
2853 if not destrevlog._inline:
2855 if not destrevlog._inline:
@@ -2899,7 +2901,7 b' class revlog(object):'
2899 self.opener,
2901 self.opener,
2900 target=self.target,
2902 target=self.target,
2901 postfix=b'tmpcensored',
2903 postfix=b'tmpcensored',
2902 indexfile=self.indexfile,
2904 indexfile=self._indexfile,
2903 censorable=True,
2905 censorable=True,
2904 )
2906 )
2905 newrl._format_version = self._format_version
2907 newrl._format_version = self._format_version
@@ -2952,11 +2954,11 b' class revlog(object):'
2952 rawtext, tr, self.linkrev(rev), p1, p2, node, self.flags(rev)
2954 rawtext, tr, self.linkrev(rev), p1, p2, node, self.flags(rev)
2953 )
2955 )
2954
2956
2955 tr.addbackup(self.indexfile, location=b'store')
2957 tr.addbackup(self._indexfile, location=b'store')
2956 if not self._inline:
2958 if not self._inline:
2957 tr.addbackup(self.datafile, location=b'store')
2959 tr.addbackup(self.datafile, location=b'store')
2958
2960
2959 self.opener.rename(newrl.indexfile, self.indexfile)
2961 self.opener.rename(newrl._indexfile, self._indexfile)
2960 if not self._inline:
2962 if not self._inline:
2961 self.opener.rename(newrl.datafile, self.datafile)
2963 self.opener.rename(newrl.datafile, self.datafile)
2962
2964
@@ -2981,7 +2983,7 b' class revlog(object):'
2981 if version != state[b'expectedversion']:
2983 if version != state[b'expectedversion']:
2982 yield revlogproblem(
2984 yield revlogproblem(
2983 warning=_(b"warning: '%s' uses revlog format %d; expected %d")
2985 warning=_(b"warning: '%s' uses revlog format %d; expected %d")
2984 % (self.indexfile, version, state[b'expectedversion'])
2986 % (self._indexfile, version, state[b'expectedversion'])
2985 )
2987 )
2986
2988
2987 state[b'skipread'] = set()
2989 state[b'skipread'] = set()
@@ -3079,7 +3081,7 b' class revlog(object):'
3079 d = {}
3081 d = {}
3080
3082
3081 if exclusivefiles:
3083 if exclusivefiles:
3082 d[b'exclusivefiles'] = [(self.opener, self.indexfile)]
3084 d[b'exclusivefiles'] = [(self.opener, self._indexfile)]
3083 if not self._inline:
3085 if not self._inline:
3084 d[b'exclusivefiles'].append((self.opener, self.datafile))
3086 d[b'exclusivefiles'].append((self.opener, self.datafile))
3085
3087
@@ -149,7 +149,7 b' def persist_nodemap(tr, revlog, pending='
149 if revlog.nodemap_file is None:
149 if revlog.nodemap_file is None:
150 if force:
150 if force:
151 revlog.nodemap_file = get_nodemap_file(
151 revlog.nodemap_file = get_nodemap_file(
152 revlog.opener, revlog.indexfile
152 revlog.opener, revlog._indexfile
153 )
153 )
154 else:
154 else:
155 msg = "calling persist nodemap on a revlog without the feature enabled"
155 msg = "calling persist nodemap on a revlog without the feature enabled"
@@ -165,7 +165,7 b' class unionchangelog(unionrevlog, change'
165 linkmapper = None
165 linkmapper = None
166 changelog2 = changelog.changelog(opener2)
166 changelog2 = changelog.changelog(opener2)
167 unionrevlog.__init__(
167 unionrevlog.__init__(
168 self, opener, self.indexfile, changelog2, linkmapper
168 self, opener, self._indexfile, changelog2, linkmapper
169 )
169 )
170
170
171
171
@@ -174,7 +174,7 b' class unionmanifest(unionrevlog, manifes'
174 manifest.manifestrevlog.__init__(self, nodeconstants, opener)
174 manifest.manifestrevlog.__init__(self, nodeconstants, opener)
175 manifest2 = manifest.manifestrevlog(nodeconstants, opener2)
175 manifest2 = manifest.manifestrevlog(nodeconstants, opener2)
176 unionrevlog.__init__(
176 unionrevlog.__init__(
177 self, opener, self._revlog.indexfile, manifest2, linkmapper
177 self, opener, self._revlog._indexfile, manifest2, linkmapper
178 )
178 )
179
179
180
180
@@ -183,7 +183,7 b' class unionfilelog(filelog.filelog):'
183 filelog.filelog.__init__(self, opener, path)
183 filelog.filelog.__init__(self, opener, path)
184 filelog2 = filelog.filelog(opener2, path)
184 filelog2 = filelog.filelog(opener2, path)
185 self._revlog = unionrevlog(
185 self._revlog = unionrevlog(
186 opener, self._revlog.indexfile, filelog2._revlog, linkmapper
186 opener, self._revlog._indexfile, filelog2._revlog, linkmapper
187 )
187 )
188 self._repo = repo
188 self._repo = repo
189 self.repotiprev = self._revlog.repotiprev
189 self.repotiprev = self._revlog.repotiprev
@@ -80,12 +80,12 b' def _copyrevlog(tr, destrepo, oldrl, rl_'
80
80
81 oldvfs = oldrl.opener
81 oldvfs = oldrl.opener
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)
@@ -411,7 +411,7 b' Check perf.py for historical portability'
411 > from mercurial import (
411 > from mercurial import (
412 import newer module separately in try clause for early Mercurial
412 import newer module separately in try clause for early Mercurial
413 contrib/perf.py:\d+: (re)
413 contrib/perf.py:\d+: (re)
414 > origindexpath = orig.opener.join(orig.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(orig.datafile)
@@ -204,7 +204,7 b" def lowlevelcopy(rlog, tr, destname=b'_d"
204 flags = rlog.flags(r)
204 flags = rlog.flags(r)
205 ifh = dfh = None
205 ifh = dfh = None
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(
General Comments 0
You need to be logged in to leave comments. Login now