Mercurial > hg
changeset 39243:0d97530eb535
manifest: rename dir argument and attribute to tree
dir shadows a built-in. We use it throughout the manifest code, which
is unfortunate.
This commit updates just manifestrevlog to be more well behaved.
.. api:: renamed manifest.manifestrevlog.__init__ dir argument to tree
Differential Revision: https://phab.mercurial-scm.org/D4276
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 10 Aug 2018 14:44:50 -0700 |
parents | 1347bcf52d51 |
children | 73cf21b2e8a6 |
files | mercurial/bundlerepo.py mercurial/changegroup.py mercurial/manifest.py mercurial/upgrade.py |
diffstat | 4 files changed, 16 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bundlerepo.py Fri Aug 10 14:40:02 2018 -0700 +++ b/mercurial/bundlerepo.py Fri Aug 10 14:44:50 2018 -0700 @@ -187,7 +187,7 @@ class bundlemanifest(bundlerevlog, manifest.manifestrevlog): def __init__(self, opener, cgunpacker, linkmapper, dirlogstarts=None, dir=''): - manifest.manifestrevlog.__init__(self, opener, dir=dir) + manifest.manifestrevlog.__init__(self, opener, tree=dir) bundlerevlog.__init__(self, opener, self.indexfile, cgunpacker, linkmapper) if dirlogstarts is None:
--- a/mercurial/changegroup.py Fri Aug 10 14:40:02 2018 -0700 +++ b/mercurial/changegroup.py Fri Aug 10 14:44:50 2018 -0700 @@ -1068,7 +1068,7 @@ tree, nodes = tmfnodes.popitem() store = dirlog(tree) - if not self._filematcher.visitdir(store._dir[:-1] or '.'): + if not self._filematcher.visitdir(store._tree[:-1] or '.'): prunednodes = [] else: frev, flr = store.rev, store.linkrev
--- a/mercurial/manifest.py Fri Aug 10 14:40:02 2018 -0700 +++ b/mercurial/manifest.py Fri Aug 10 14:44:50 2018 -0700 @@ -1250,7 +1250,7 @@ '''A revlog that stores manifest texts. This is responsible for caching the full-text manifest contents. ''' - def __init__(self, opener, dir='', dirlogcache=None, indexfile=None, + def __init__(self, opener, tree='', dirlogcache=None, indexfile=None, treemanifest=False): """Constructs a new manifest revlog @@ -1276,24 +1276,24 @@ self._fulltextcache = manifestfulltextcache(cachesize) - if dir: + if tree: assert self._treeondisk, 'opts is %r' % opts if indexfile is None: indexfile = '00manifest.i' - if dir: - indexfile = "meta/" + dir + indexfile + if tree: + indexfile = "meta/" + tree + indexfile - self._dir = dir + self._tree = tree # The dirlogcache is kept on the root manifest log - if dir: + if tree: self._dirlogcache = dirlogcache else: self._dirlogcache = {'': self} super(manifestrevlog, self).__init__(opener, indexfile, # only root indexfile is cached - checkambig=not bool(dir), + checkambig=not bool(tree), mmaplargeindex=True) def _setupmanifestcachehooks(self, repo): @@ -1325,7 +1325,7 @@ def clearcaches(self, clear_persisted_data=False): super(manifestrevlog, self).clearcaches() self._fulltextcache.clear(clear_persisted_data=clear_persisted_data) - self._dirlogcache = {self._dir: self} + self._dirlogcache = {self._tree: self} def dirlog(self, d): if d: @@ -1360,8 +1360,8 @@ # process. if self._treeondisk: assert readtree, "readtree must be set for treemanifest writes" - m1 = readtree(self._dir, p1) - m2 = readtree(self._dir, p2) + m1 = readtree(self._tree, p1) + m2 = readtree(self._tree, p2) n = self._addtree(m, transaction, link, m1, m2, readtree) arraytext = None else: @@ -1377,7 +1377,8 @@ def _addtree(self, m, transaction, link, m1, m2, readtree): # If the manifest is unchanged compared to one parent, # don't write a new revision - if self._dir != '' and (m.unmodifiedsince(m1) or m.unmodifiedsince(m2)): + if self._tree != '' and (m.unmodifiedsince(m1) or m.unmodifiedsince( + m2)): return m.node() def writesubtree(subm, subp1, subp2): sublog = self.dirlog(subm.dir()) @@ -1386,7 +1387,7 @@ m.writesubtrees(m1, m2, writesubtree) text = m.dirtext() n = None - if self._dir != '': + if self._tree != '': # Double-check whether contents are unchanged to one parent if text == m1.dirtext(): n = m1.node()
--- a/mercurial/upgrade.py Fri Aug 10 14:40:02 2018 -0700 +++ b/mercurial/upgrade.py Fri Aug 10 14:44:50 2018 -0700 @@ -450,7 +450,7 @@ return changelog.changelog(repo.svfs) elif path.endswith('00manifest.i'): mandir = path[:-len('00manifest.i')] - return manifest.manifestrevlog(repo.svfs, dir=mandir) + return manifest.manifestrevlog(repo.svfs, tree=mandir) else: #reverse of "/".join(("data", path + ".i")) return filelog.filelog(repo.svfs, path[5:-2])