##// END OF EJS Templates
manifest: remove _repo from manifestctx objects...
Durham Goode -
r31153:5cab44fd default
parent child Browse files
Show More
@@ -1261,8 +1261,6 b' class manifestlog(object):'
1261 1261 class do not care about the implementation details of the actual manifests
1262 1262 they receive (i.e. tree or flat or lazily loaded, etc)."""
1263 1263 def __init__(self, opener, repo):
1264 self._repo = repo
1265
1266 1264 usetreemanifest = False
1267 1265 cachesize = 4
1268 1266
@@ -1309,7 +1307,7 b' class manifestlog(object):'
1309 1307 if node not in dirlog.nodemap:
1310 1308 raise LookupError(node, dirlog.indexfile,
1311 1309 _('no node'))
1312 m = treemanifestctx(self._repo, dir, node)
1310 m = treemanifestctx(self, dir, node)
1313 1311 else:
1314 1312 raise error.Abort(
1315 1313 _("cannot ask for manifest directory '%s' in a flat "
@@ -1320,9 +1318,9 b' class manifestlog(object):'
1320 1318 raise LookupError(node, self._revlog.indexfile,
1321 1319 _('no node'))
1322 1320 if self._treeinmem:
1323 m = treemanifestctx(self._repo, '', node)
1321 m = treemanifestctx(self, '', node)
1324 1322 else:
1325 m = manifestctx(self._repo, node)
1323 m = manifestctx(self, node)
1326 1324
1327 1325 if node != revlog.nullid:
1328 1326 mancache = self._dirmancache.get(dir)
@@ -1337,18 +1335,18 b' class manifestlog(object):'
1337 1335 self._revlog.clearcaches()
1338 1336
1339 1337 class memmanifestctx(object):
1340 def __init__(self, repo):
1341 self._repo = repo
1338 def __init__(self, manifestlog):
1339 self._manifestlog = manifestlog
1342 1340 self._manifestdict = manifestdict()
1343 1341
1344 1342 def _revlog(self):
1345 return self._repo.manifestlog._revlog
1343 return self._manifestlog._revlog
1346 1344
1347 1345 def new(self):
1348 return memmanifestctx(self._repo)
1346 return memmanifestctx(self._manifestlog)
1349 1347
1350 1348 def copy(self):
1351 memmf = memmanifestctx(self._repo)
1349 memmf = memmanifestctx(self._manifestlog)
1352 1350 memmf._manifestdict = self.read().copy()
1353 1351 return memmf
1354 1352
@@ -1363,8 +1361,8 b' class manifestctx(object):'
1363 1361 """A class representing a single revision of a manifest, including its
1364 1362 contents, its parent revs, and its linkrev.
1365 1363 """
1366 def __init__(self, repo, node):
1367 self._repo = repo
1364 def __init__(self, manifestlog, node):
1365 self._manifestlog = manifestlog
1368 1366 self._data = None
1369 1367
1370 1368 self._node = node
@@ -1377,16 +1375,16 b' class manifestctx(object):'
1377 1375 #self.linkrev = revlog.linkrev(rev)
1378 1376
1379 1377 def _revlog(self):
1380 return self._repo.manifestlog._revlog
1378 return self._manifestlog._revlog
1381 1379
1382 1380 def node(self):
1383 1381 return self._node
1384 1382
1385 1383 def new(self):
1386 return memmanifestctx(self._repo)
1384 return memmanifestctx(self._manifestlog)
1387 1385
1388 1386 def copy(self):
1389 memmf = memmanifestctx(self._repo)
1387 memmf = memmanifestctx(self._manifestlog)
1390 1388 memmf._manifestdict = self.read().copy()
1391 1389 return memmf
1392 1390
@@ -1431,7 +1429,7 b' class manifestctx(object):'
1431 1429 if revlog._usemanifestv2:
1432 1430 # Need to perform a slow delta
1433 1431 r0 = revlog.deltaparent(revlog.rev(self._node))
1434 m0 = self._repo.manifestlog[revlog.node(r0)].read()
1432 m0 = self._manifestlog[revlog.node(r0)].read()
1435 1433 m1 = self.read()
1436 1434 md = manifestdict()
1437 1435 for f, ((n0, fl0), (n1, fl1)) in m0.diff(m1).iteritems():
@@ -1449,19 +1447,19 b' class manifestctx(object):'
1449 1447 return self.read().find(key)
1450 1448
1451 1449 class memtreemanifestctx(object):
1452 def __init__(self, repo, dir=''):
1453 self._repo = repo
1450 def __init__(self, manifestlog, dir=''):
1451 self._manifestlog = manifestlog
1454 1452 self._dir = dir
1455 1453 self._treemanifest = treemanifest()
1456 1454
1457 1455 def _revlog(self):
1458 return self._repo.manifestlog._revlog
1456 return self._manifestlog._revlog
1459 1457
1460 1458 def new(self, dir=''):
1461 return memtreemanifestctx(self._repo, dir=dir)
1459 return memtreemanifestctx(self._manifestlog, dir=dir)
1462 1460
1463 1461 def copy(self):
1464 memmf = memtreemanifestctx(self._repo, dir=self._dir)
1462 memmf = memtreemanifestctx(self._manifestlog, dir=self._dir)
1465 1463 memmf._treemanifest = self._treemanifest.copy()
1466 1464 return memmf
1467 1465
@@ -1470,13 +1468,13 b' class memtreemanifestctx(object):'
1470 1468
1471 1469 def write(self, transaction, link, p1, p2, added, removed):
1472 1470 def readtree(dir, node):
1473 return self._repo.manifestlog.get(dir, node).read()
1471 return self._manifestlog.get(dir, node).read()
1474 1472 return self._revlog().add(self._treemanifest, transaction, link, p1, p2,
1475 1473 added, removed, readtree=readtree)
1476 1474
1477 1475 class treemanifestctx(object):
1478 def __init__(self, repo, dir, node):
1479 self._repo = repo
1476 def __init__(self, manifestlog, dir, node):
1477 self._manifestlog = manifestlog
1480 1478 self._dir = dir
1481 1479 self._data = None
1482 1480
@@ -1490,7 +1488,7 b' class treemanifestctx(object):'
1490 1488 #self.linkrev = revlog.linkrev(rev)
1491 1489
1492 1490 def _revlog(self):
1493 return self._repo.manifestlog._revlog.dirlog(self._dir)
1491 return self._manifestlog._revlog.dirlog(self._dir)
1494 1492
1495 1493 def read(self):
1496 1494 if self._data is None:
@@ -1504,8 +1502,7 b' class treemanifestctx(object):'
1504 1502 def readsubtree(dir, subm):
1505 1503 # Set verify to False since we need to be able to create
1506 1504 # subtrees for trees that don't exist on disk.
1507 return self._repo.manifestlog.get(dir, subm,
1508 verify=False).read()
1505 return self._manifestlog.get(dir, subm, verify=False).read()
1509 1506 m.read(gettext, readsubtree)
1510 1507 m.setnode(self._node)
1511 1508 self._data = m
@@ -1521,10 +1518,10 b' class treemanifestctx(object):'
1521 1518 return self._node
1522 1519
1523 1520 def new(self, dir=''):
1524 return memtreemanifestctx(self._repo, dir=dir)
1521 return memtreemanifestctx(self._manifestlog, dir=dir)
1525 1522
1526 1523 def copy(self):
1527 memmf = memtreemanifestctx(self._repo, dir=self._dir)
1524 memmf = memtreemanifestctx(self._manifestlog, dir=self._dir)
1528 1525 memmf._treemanifest = self.read().copy()
1529 1526 return memmf
1530 1527
@@ -1551,7 +1548,7 b' class treemanifestctx(object):'
1551 1548 else:
1552 1549 # Need to perform a slow delta
1553 1550 r0 = revlog.deltaparent(revlog.rev(self._node))
1554 m0 = self._repo.manifestlog.get(self._dir, revlog.node(r0)).read()
1551 m0 = self._manifestlog.get(self._dir, revlog.node(r0)).read()
1555 1552 m1 = self.read()
1556 1553 md = treemanifest(dir=self._dir)
1557 1554 for f, ((n0, fl0), (n1, fl1)) in m0.diff(m1).iteritems():
General Comments 0
You need to be logged in to leave comments. Login now