##// END OF EJS Templates
make LookupError more detailed
Bryan O'Sullivan -
r5558:7c1a9a21 default
parent child Browse files
Show More
@@ -48,7 +48,7 b' class bundlerevlog(revlog.revlog):'
48 continue
48 continue
49 for p in (p1, p2):
49 for p in (p1, p2):
50 if not p in self.nodemap:
50 if not p in self.nodemap:
51 raise revlog.LookupError(_("unknown parent %s") % short(p1))
51 raise revlog.LookupError(hex(p1), _("unknown parent %s") % short(p1))
52 if linkmapper is None:
52 if linkmapper is None:
53 link = n
53 link = n
54 else:
54 else:
@@ -100,13 +100,13 b' class changectx(object):'
100 try:
100 try:
101 return self._manifest[path], self._manifest.flags(path)
101 return self._manifest[path], self._manifest.flags(path)
102 except KeyError:
102 except KeyError:
103 raise revlog.LookupError(_("'%s' not found in manifest") % path)
103 raise revlog.LookupError(path, _("'%s' not found in manifest") % path)
104 if '_manifestdelta' in self.__dict__ or path in self.files():
104 if '_manifestdelta' in self.__dict__ or path in self.files():
105 if path in self._manifestdelta:
105 if path in self._manifestdelta:
106 return self._manifestdelta[path], self._manifestdelta.flags(path)
106 return self._manifestdelta[path], self._manifestdelta.flags(path)
107 node, flag = self._repo.manifest.find(self._changeset[0], path)
107 node, flag = self._repo.manifest.find(self._changeset[0], path)
108 if not node:
108 if not node:
109 raise revlog.LookupError(_("'%s' not found in manifest") % path)
109 raise revlog.LookupError(path, _("'%s' not found in manifest") % path)
110
110
111 return node, flag
111 return node, flag
112
112
@@ -31,8 +31,13 b' REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_'
31
31
32 class RevlogError(Exception):
32 class RevlogError(Exception):
33 pass
33 pass
34
34 class LookupError(RevlogError):
35 class LookupError(RevlogError):
35 pass
36 def __init__(self, name, message=None):
37 if message is None:
38 message = _('not found: %s') % name
39 RevlogError.__init__(self, message)
40 self.name = name
36
41
37 def getoffset(q):
42 def getoffset(q):
38 return int(q >> 16)
43 return int(q >> 16)
@@ -516,7 +521,7 b' class revlog(object):'
516 try:
521 try:
517 return self.nodemap[node]
522 return self.nodemap[node]
518 except KeyError:
523 except KeyError:
519 raise LookupError(_('%s: no node %s') % (self.indexfile, hex(node)))
524 raise LookupError(hex(node), _('%s: no node %s') % (self.indexfile, hex(node)))
520 def node(self, rev):
525 def node(self, rev):
521 return self.index[rev][7]
526 return self.index[rev][7]
522 def linkrev(self, node):
527 def linkrev(self, node):
@@ -836,7 +841,8 b' class revlog(object):'
836 for n in self.nodemap:
841 for n in self.nodemap:
837 if n.startswith(bin_id) and hex(n).startswith(id):
842 if n.startswith(bin_id) and hex(n).startswith(id):
838 if node is not None:
843 if node is not None:
839 raise LookupError(_("Ambiguous identifier"))
844 raise LookupError(hex(node),
845 _("Ambiguous identifier"))
840 node = n
846 node = n
841 if node is not None:
847 if node is not None:
842 return node
848 return node
@@ -855,7 +861,7 b' class revlog(object):'
855 if n:
861 if n:
856 return n
862 return n
857
863
858 raise LookupError(_("No match found"))
864 raise LookupError(id, _("No match found"))
859
865
860 def cmp(self, node, text):
866 def cmp(self, node, text):
861 """compare text with a given file revision"""
867 """compare text with a given file revision"""
@@ -1166,13 +1172,13 b' class revlog(object):'
1166
1172
1167 for p in (p1, p2):
1173 for p in (p1, p2):
1168 if not p in self.nodemap:
1174 if not p in self.nodemap:
1169 raise LookupError(_("unknown parent %s") % short(p))
1175 raise LookupError(hex(p), _("unknown parent %s") % short(p))
1170
1176
1171 if not chain:
1177 if not chain:
1172 # retrieve the parent revision of the delta chain
1178 # retrieve the parent revision of the delta chain
1173 chain = p1
1179 chain = p1
1174 if not chain in self.nodemap:
1180 if not chain in self.nodemap:
1175 raise LookupError(_("unknown base %s") % short(chain[:4]))
1181 raise LookupError(hex(chain), _("unknown base %s") % short(chain[:4]))
1176
1182
1177 # full versions are inserted when the needed deltas become
1183 # full versions are inserted when the needed deltas become
1178 # comparable to the uncompressed text or when the previous
1184 # comparable to the uncompressed text or when the previous
General Comments 0
You need to be logged in to leave comments. Login now