Mercurial > public > mercurial-scm > hg
comparison mercurial/manifest.py @ 39315:57c3864f3aad
manifest: make tree a public attribute
changegroup generation accesses this attribute. We should make it
public and expose it on the interface.
Differential Revision: https://phab.mercurial-scm.org/D4387
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 15 Aug 2018 16:50:44 +0000 |
parents | 7f5e6d3e9032 |
children | 53363a8eff57 |
comparison
equal
deleted
inserted
replaced
39314:7f5e6d3e9032 | 39315:57c3864f3aad |
---|---|
1283 if indexfile is None: | 1283 if indexfile is None: |
1284 indexfile = '00manifest.i' | 1284 indexfile = '00manifest.i' |
1285 if tree: | 1285 if tree: |
1286 indexfile = "meta/" + tree + indexfile | 1286 indexfile = "meta/" + tree + indexfile |
1287 | 1287 |
1288 self._tree = tree | 1288 self.tree = tree |
1289 | |
1289 # The dirlogcache is kept on the root manifest log | 1290 # The dirlogcache is kept on the root manifest log |
1290 if tree: | 1291 if tree: |
1291 self._dirlogcache = dirlogcache | 1292 self._dirlogcache = dirlogcache |
1292 else: | 1293 else: |
1293 self._dirlogcache = {'': self} | 1294 self._dirlogcache = {'': self} |
1328 return self._fulltextcache | 1329 return self._fulltextcache |
1329 | 1330 |
1330 def clearcaches(self, clear_persisted_data=False): | 1331 def clearcaches(self, clear_persisted_data=False): |
1331 self._revlog.clearcaches() | 1332 self._revlog.clearcaches() |
1332 self._fulltextcache.clear(clear_persisted_data=clear_persisted_data) | 1333 self._fulltextcache.clear(clear_persisted_data=clear_persisted_data) |
1333 self._dirlogcache = {self._tree: self} | 1334 self._dirlogcache = {self.tree: self} |
1334 | 1335 |
1335 def dirlog(self, d): | 1336 def dirlog(self, d): |
1336 if d: | 1337 if d: |
1337 assert self._treeondisk | 1338 assert self._treeondisk |
1338 if d not in self._dirlogcache: | 1339 if d not in self._dirlogcache: |
1364 # just encode a fulltext of the manifest and pass that | 1365 # just encode a fulltext of the manifest and pass that |
1365 # through to the revlog layer, and let it handle the delta | 1366 # through to the revlog layer, and let it handle the delta |
1366 # process. | 1367 # process. |
1367 if self._treeondisk: | 1368 if self._treeondisk: |
1368 assert readtree, "readtree must be set for treemanifest writes" | 1369 assert readtree, "readtree must be set for treemanifest writes" |
1369 m1 = readtree(self._tree, p1) | 1370 m1 = readtree(self.tree, p1) |
1370 m2 = readtree(self._tree, p2) | 1371 m2 = readtree(self.tree, p2) |
1371 n = self._addtree(m, transaction, link, m1, m2, readtree) | 1372 n = self._addtree(m, transaction, link, m1, m2, readtree) |
1372 arraytext = None | 1373 arraytext = None |
1373 else: | 1374 else: |
1374 text = m.text() | 1375 text = m.text() |
1375 n = self._revlog.addrevision(text, transaction, link, p1, p2) | 1376 n = self._revlog.addrevision(text, transaction, link, p1, p2) |
1381 return n | 1382 return n |
1382 | 1383 |
1383 def _addtree(self, m, transaction, link, m1, m2, readtree): | 1384 def _addtree(self, m, transaction, link, m1, m2, readtree): |
1384 # If the manifest is unchanged compared to one parent, | 1385 # If the manifest is unchanged compared to one parent, |
1385 # don't write a new revision | 1386 # don't write a new revision |
1386 if self._tree != '' and (m.unmodifiedsince(m1) or m.unmodifiedsince( | 1387 if self.tree != '' and (m.unmodifiedsince(m1) or m.unmodifiedsince( |
1387 m2)): | 1388 m2)): |
1388 return m.node() | 1389 return m.node() |
1389 def writesubtree(subm, subp1, subp2): | 1390 def writesubtree(subm, subp1, subp2): |
1390 sublog = self.dirlog(subm.dir()) | 1391 sublog = self.dirlog(subm.dir()) |
1391 sublog.add(subm, transaction, link, subp1, subp2, None, None, | 1392 sublog.add(subm, transaction, link, subp1, subp2, None, None, |
1392 readtree=readtree) | 1393 readtree=readtree) |
1393 m.writesubtrees(m1, m2, writesubtree) | 1394 m.writesubtrees(m1, m2, writesubtree) |
1394 text = m.dirtext() | 1395 text = m.dirtext() |
1395 n = None | 1396 n = None |
1396 if self._tree != '': | 1397 if self.tree != '': |
1397 # Double-check whether contents are unchanged to one parent | 1398 # Double-check whether contents are unchanged to one parent |
1398 if text == m1.dirtext(): | 1399 if text == m1.dirtext(): |
1399 n = m1.node() | 1400 n = m1.node() |
1400 elif text == m2.dirtext(): | 1401 elif text == m2.dirtext(): |
1401 n = m2.node() | 1402 n = m2.node() |