Show More
@@ -2566,11 +2566,14 b' def cat(ui, repo, ctx, matcher, prefix, ' | |||||
2566 | # for performance to avoid the cost of parsing the manifest. |
|
2566 | # for performance to avoid the cost of parsing the manifest. | |
2567 | if len(matcher.files()) == 1 and not matcher.anypats(): |
|
2567 | if len(matcher.files()) == 1 and not matcher.anypats(): | |
2568 | file = matcher.files()[0] |
|
2568 | file = matcher.files()[0] | |
2569 | mf = repo.manifest |
|
2569 | mfl = repo.manifestlog | |
2570 | mfnode = ctx.manifestnode() |
|
2570 | mfnode = ctx.manifestnode() | |
2571 | if mfnode and mf.find(mfnode, file)[0]: |
|
2571 | try: | |
2572 | write(file) |
|
2572 | if mfnode and mfl[mfnode].find(file)[0]: | |
2573 | return 0 |
|
2573 | write(file) | |
|
2574 | return 0 | |||
|
2575 | except KeyError: | |||
|
2576 | pass | |||
2574 |
|
2577 | |||
2575 | for abs in ctx.walk(matcher): |
|
2578 | for abs in ctx.walk(matcher): | |
2576 | write(abs) |
|
2579 | write(abs) |
@@ -259,8 +259,10 b' class basectx(object):' | |||||
259 | if path in self._manifestdelta: |
|
259 | if path in self._manifestdelta: | |
260 | return (self._manifestdelta[path], |
|
260 | return (self._manifestdelta[path], | |
261 | self._manifestdelta.flags(path)) |
|
261 | self._manifestdelta.flags(path)) | |
262 |
|
|
262 | mfl = self._repo.manifestlog | |
263 |
|
|
263 | try: | |
|
264 | node, flag = mfl[self._changeset.manifest].find(path) | |||
|
265 | except KeyError: | |||
264 | raise error.ManifestLookupError(self._node, path, |
|
266 | raise error.ManifestLookupError(self._node, path, | |
265 | _('not found in manifest')) |
|
267 | _('not found in manifest')) | |
266 |
|
268 |
@@ -1394,6 +1394,9 b' class manifestctx(object):' | |||||
1394 | d = mdiff.patchtext(revlog.revdiff(revlog.deltaparent(r), r)) |
|
1394 | d = mdiff.patchtext(revlog.revdiff(revlog.deltaparent(r), r)) | |
1395 | return manifestdict(d) |
|
1395 | return manifestdict(d) | |
1396 |
|
1396 | |||
|
1397 | def find(self, key): | |||
|
1398 | return self.read().find(key) | |||
|
1399 | ||||
1397 | class treemanifestctx(object): |
|
1400 | class treemanifestctx(object): | |
1398 | def __init__(self, repo, dir, node): |
|
1401 | def __init__(self, repo, dir, node): | |
1399 | self._repo = repo |
|
1402 | self._repo = repo | |
@@ -1486,6 +1489,9 b' class treemanifestctx(object):' | |||||
1486 | else: |
|
1489 | else: | |
1487 | return self.read() |
|
1490 | return self.read() | |
1488 |
|
1491 | |||
|
1492 | def find(self, key): | |||
|
1493 | return self.read().find(key) | |||
|
1494 | ||||
1489 | class manifest(manifestrevlog): |
|
1495 | class manifest(manifestrevlog): | |
1490 | def __init__(self, opener, dir='', dirlogcache=None): |
|
1496 | def __init__(self, opener, dir='', dirlogcache=None): | |
1491 | '''The 'dir' and 'dirlogcache' arguments are for internal use by |
|
1497 | '''The 'dir' and 'dirlogcache' arguments are for internal use by | |
@@ -1548,15 +1554,6 b' class manifest(manifestrevlog):' | |||||
1548 | self.fulltextcache[node] = arraytext |
|
1554 | self.fulltextcache[node] = arraytext | |
1549 | return m |
|
1555 | return m | |
1550 |
|
1556 | |||
1551 | def find(self, node, f): |
|
|||
1552 | '''look up entry for a single file efficiently. |
|
|||
1553 | return (node, flags) pair if found, (None, None) if not.''' |
|
|||
1554 | m = self.read(node) |
|
|||
1555 | try: |
|
|||
1556 | return m.find(f) |
|
|||
1557 | except KeyError: |
|
|||
1558 | return None, None |
|
|||
1559 |
|
||||
1560 | def clearcaches(self): |
|
1557 | def clearcaches(self): | |
1561 | super(manifest, self).clearcaches() |
|
1558 | super(manifest, self).clearcaches() | |
1562 | self._mancache.clear() |
|
1559 | self._mancache.clear() |
General Comments 0
You need to be logged in to leave comments.
Login now