##// END OF EJS Templates
revlog: introduce a cache for partial lookups...
Matt Mackall -
r13258:c2661863 default
parent child Browse files
Show More
@@ -221,6 +221,7 b' class revlog(object):'
221 221 self.index = []
222 222 self._shallowroot = shallowroot
223 223 self._parentdelta = 0
224 self._pcache = {}
224 225
225 226 v = REVLOG_DEFAULT_VERSION
226 227 if hasattr(opener, 'options') and 'defversion' in opener.options:
@@ -703,6 +704,9 b' class revlog(object):'
703 704 pass
704 705
705 706 def _partialmatch(self, id):
707 if id in self._pcache:
708 return self._pcache[id]
709
706 710 if len(id) < 40:
707 711 try:
708 712 # hex(node)[:...]
@@ -712,6 +716,7 b' class revlog(object):'
712 716 nl = [n for n in nl if hex(n).startswith(id)]
713 717 if len(nl) > 0:
714 718 if len(nl) == 1:
719 self._pcache[id] = nl[0]
715 720 return nl[0]
716 721 raise LookupError(id, self.indexfile,
717 722 _('ambiguous identifier'))
General Comments 0
You need to be logged in to leave comments. Login now