##// END OF EJS Templates
revlog: handle hidden revs in _partialmatch (issue3979)...
Matt Mackall -
r19471:fd1bb7c1 stable
parent child Browse files
Show More
@@ -751,10 +751,14 b' class revlog(object):'
751
751
752 def _partialmatch(self, id):
752 def _partialmatch(self, id):
753 try:
753 try:
754 return self.index.partialmatch(id)
754 n = self.index.partialmatch(id)
755 if n and self.hasnode(n):
756 return n
757 return None
755 except RevlogError:
758 except RevlogError:
756 # parsers.c radix tree lookup gave multiple matches
759 # parsers.c radix tree lookup gave multiple matches
757 raise LookupError(id, self.indexfile, _("ambiguous identifier"))
760 # fall through to slow path that filters hidden revisions
761 pass
758 except (AttributeError, ValueError):
762 except (AttributeError, ValueError):
759 # we are pure python, or key was too short to search radix tree
763 # we are pure python, or key was too short to search radix tree
760 pass
764 pass
@@ -768,7 +772,8 b' class revlog(object):'
768 l = len(id) // 2 # grab an even number of digits
772 l = len(id) // 2 # grab an even number of digits
769 prefix = bin(id[:l * 2])
773 prefix = bin(id[:l * 2])
770 nl = [e[7] for e in self.index if e[7].startswith(prefix)]
774 nl = [e[7] for e in self.index if e[7].startswith(prefix)]
771 nl = [n for n in nl if hex(n).startswith(id)]
775 nl = [n for n in nl if hex(n).startswith(id) and
776 self.hasnode(n)]
772 if len(nl) > 0:
777 if len(nl) > 0:
773 if len(nl) == 1:
778 if len(nl) == 1:
774 self._pcache[id] = nl[0]
779 self._pcache[id] = nl[0]
@@ -1223,6 +1223,9 b' enable obsolete to test hidden feature'
1223 $ hg log --template='{rev}:{node}\n' --hidden
1223 $ hg log --template='{rev}:{node}\n' --hidden
1224 1:a765632148dc55d38c35c4f247c618701886cb2f
1224 1:a765632148dc55d38c35c4f247c618701886cb2f
1225 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1225 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1226 $ hg log -r a
1227 abort: unknown revision 'a'!
1228 [255]
1226
1229
1227 test that parent prevent a changeset to be hidden
1230 test that parent prevent a changeset to be hidden
1228
1231
General Comments 0
You need to be logged in to leave comments. Login now