mercurial/manifest.py
changeset 30345 fa54f7ade491
parent 30343 952e1916ae56
child 30368 ed45283a0ca7
equal deleted inserted replaced
30344:362f6f651b2e 30345:fa54f7ade491
  1318                 mancache = util.lrucachedict(self.cachesize)
  1318                 mancache = util.lrucachedict(self.cachesize)
  1319                 self._dirmancache[dir] = mancache
  1319                 self._dirmancache[dir] = mancache
  1320             mancache[node] = m
  1320             mancache[node] = m
  1321         return m
  1321         return m
  1322 
  1322 
  1323     def add(self, m, transaction, link, p1, p2, added, removed):
       
  1324         return self._revlog.add(m, transaction, link, p1, p2, added, removed)
       
  1325 
       
  1326 class memmanifestctx(object):
  1323 class memmanifestctx(object):
  1327     def __init__(self, repo):
  1324     def __init__(self, repo):
  1328         self._repo = repo
  1325         self._repo = repo
  1329         self._manifestdict = manifestdict()
  1326         self._manifestdict = manifestdict()
  1330 
  1327 
       
  1328     def _revlog(self):
       
  1329         return self._repo.manifestlog._revlog
       
  1330 
  1331     def new(self):
  1331     def new(self):
  1332         return memmanifestctx(self._repo)
  1332         return memmanifestctx(self._repo)
  1333 
  1333 
  1334     def copy(self):
  1334     def copy(self):
  1335         memmf = memmanifestctx(self._repo)
  1335         memmf = memmanifestctx(self._repo)
  1336         memmf._manifestdict = self.read().copy()
  1336         memmf._manifestdict = self.read().copy()
  1337         return memmf
  1337         return memmf
  1338 
  1338 
  1339     def read(self):
  1339     def read(self):
  1340         return self._manifestdict
  1340         return self._manifestdict
       
  1341 
       
  1342     def write(self, transaction, link, p1, p2, added, removed):
       
  1343         return self._revlog().add(self._manifestdict, transaction, link, p1, p2,
       
  1344                                   added, removed)
  1341 
  1345 
  1342 class manifestctx(object):
  1346 class manifestctx(object):
  1343     """A class representing a single revision of a manifest, including its
  1347     """A class representing a single revision of a manifest, including its
  1344     contents, its parent revs, and its linkrev.
  1348     contents, its parent revs, and its linkrev.
  1345     """
  1349     """
  1428     def __init__(self, repo, dir=''):
  1432     def __init__(self, repo, dir=''):
  1429         self._repo = repo
  1433         self._repo = repo
  1430         self._dir = dir
  1434         self._dir = dir
  1431         self._treemanifest = treemanifest()
  1435         self._treemanifest = treemanifest()
  1432 
  1436 
       
  1437     def _revlog(self):
       
  1438         return self._repo.manifestlog._revlog
       
  1439 
  1433     def new(self, dir=''):
  1440     def new(self, dir=''):
  1434         return memtreemanifestctx(self._repo, dir=dir)
  1441         return memtreemanifestctx(self._repo, dir=dir)
  1435 
  1442 
  1436     def copy(self):
  1443     def copy(self):
  1437         memmf = memtreemanifestctx(self._repo, dir=self._dir)
  1444         memmf = memtreemanifestctx(self._repo, dir=self._dir)
  1438         memmf._treemanifest = self._treemanifest.copy()
  1445         memmf._treemanifest = self._treemanifest.copy()
  1439         return memmf
  1446         return memmf
  1440 
  1447 
  1441     def read(self):
  1448     def read(self):
  1442         return self._treemanifest
  1449         return self._treemanifest
       
  1450 
       
  1451     def write(self, transaction, link, p1, p2, added, removed):
       
  1452         return self._revlog().add(self._treemanifest, transaction, link, p1, p2,
       
  1453                                   added, removed)
  1443 
  1454 
  1444 class treemanifestctx(object):
  1455 class treemanifestctx(object):
  1445     def __init__(self, repo, dir, node):
  1456     def __init__(self, repo, dir, node):
  1446         self._repo = repo
  1457         self._repo = repo
  1447         self._dir = dir
  1458         self._dir = dir