1253 if (self.local() |
1253 if (self.local() |
1254 and changeid in self.unfiltered().dirstate.parents()): |
1254 and changeid in self.unfiltered().dirstate.parents()): |
1255 msg = _("working directory has unknown parent '%s'!") |
1255 msg = _("working directory has unknown parent '%s'!") |
1256 raise error.Abort(msg % short(changeid)) |
1256 raise error.Abort(msg % short(changeid)) |
1257 changeid = hex(changeid) # for the error message |
1257 changeid = hex(changeid) # for the error message |
|
1258 raise |
1258 |
1259 |
1259 elif len(changeid) == 40: |
1260 elif len(changeid) == 40: |
1260 try: |
1261 node = bin(changeid) |
1261 node = bin(changeid) |
1262 rev = self.changelog.rev(node) |
1262 rev = self.changelog.rev(node) |
1263 return context.changectx(self, rev, node) |
1263 return context.changectx(self, rev, node) |
|
1264 except error.FilteredLookupError: |
|
1265 raise |
|
1266 except LookupError: |
|
1267 pass |
|
1268 else: |
1264 else: |
1269 raise error.ProgrammingError( |
1265 raise error.ProgrammingError( |
1270 "unsupported changeid '%s' of type %s" % |
1266 "unsupported changeid '%s' of type %s" % |
1271 (changeid, type(changeid))) |
1267 (changeid, type(changeid))) |
1272 |
1268 |
1273 except (error.FilteredIndexError, error.FilteredLookupError): |
1269 except (error.FilteredIndexError, error.FilteredLookupError): |
1274 raise error.FilteredRepoLookupError(_("filtered revision '%s'") |
1270 raise error.FilteredRepoLookupError(_("filtered revision '%s'") |
1275 % pycompat.bytestr(changeid)) |
1271 % pycompat.bytestr(changeid)) |
1276 except IndexError: |
1272 except (IndexError, LookupError): |
1277 pass |
1273 raise error.RepoLookupError(_("unknown revision '%s'") % changeid) |
1278 except error.WdirUnsupported: |
1274 except error.WdirUnsupported: |
1279 return context.workingctx(self) |
1275 return context.workingctx(self) |
1280 raise error.RepoLookupError( |
|
1281 _("unknown revision '%s'") % changeid) |
|
1282 |
1276 |
1283 def __contains__(self, changeid): |
1277 def __contains__(self, changeid): |
1284 """True if the given changeid exists |
1278 """True if the given changeid exists |
1285 |
1279 |
1286 error.AmbiguousPrefixLookupError is raised if an ambiguous node |
1280 error.AmbiguousPrefixLookupError is raised if an ambiguous node |