Show More
@@ -1514,6 +1514,19 b' class localrepository(object):' | |||||
1514 | narrowspec.save(self, newincludes, newexcludes) |
|
1514 | narrowspec.save(self, newincludes, newexcludes) | |
1515 | self.invalidate(clearfilecache=True) |
|
1515 | self.invalidate(clearfilecache=True) | |
1516 |
|
1516 | |||
|
1517 | @util.propertycache | |||
|
1518 | def _quick_access_changeid(self): | |||
|
1519 | """an helper dictionnary for __getitem__ calls | |||
|
1520 | ||||
|
1521 | This contains a list of symbol we can recognise right away without | |||
|
1522 | further processing. | |||
|
1523 | """ | |||
|
1524 | return { | |||
|
1525 | b'null': (nullrev, nullid), | |||
|
1526 | nullrev: (nullrev, nullid), | |||
|
1527 | nullid: (nullrev, nullid), | |||
|
1528 | } | |||
|
1529 | ||||
1517 | def __getitem__(self, changeid): |
|
1530 | def __getitem__(self, changeid): | |
1518 | # dealing with special cases |
|
1531 | # dealing with special cases | |
1519 | if changeid is None: |
|
1532 | if changeid is None: | |
@@ -1531,8 +1544,10 b' class localrepository(object):' | |||||
1531 | ] |
|
1544 | ] | |
1532 |
|
1545 | |||
1533 | # dealing with some special values |
|
1546 | # dealing with some special values | |
1534 | if changeid == b'null' or changeid == nullrev or changeid == nullid: |
|
1547 | quick_access = self._quick_access_changeid.get(changeid) | |
1535 | return context.changectx(self, nullrev, nullid, maybe_filtered=False) |
|
1548 | if quick_access is not None: | |
|
1549 | rev, node = quick_access | |||
|
1550 | return context.changectx(self, rev, node, maybe_filtered=False) | |||
1536 | if changeid == b'tip': |
|
1551 | if changeid == b'tip': | |
1537 | node = self.changelog.tip() |
|
1552 | node = self.changelog.tip() | |
1538 | rev = self.changelog.rev(node) |
|
1553 | rev = self.changelog.rev(node) |
General Comments 0
You need to be logged in to leave comments.
Login now