Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
# wdirrev isn't contiguous so the slice shouldn't include it | # wdirrev isn't contiguous so the slice shouldn't include it | ||||
return [self[i] | return [self[i] | ||||
for i in pycompat.xrange(*changeid.indices(len(self))) | for i in pycompat.xrange(*changeid.indices(len(self))) | ||||
if i not in self.changelog.filteredrevs] | if i not in self.changelog.filteredrevs] | ||||
try: | try: | ||||
if isinstance(changeid, int): | if isinstance(changeid, int): | ||||
node = self.changelog.node(changeid) | node = self.changelog.node(changeid) | ||||
rev = changeid | rev = changeid | ||||
return context.changectx(self, rev, node) | |||||
elif changeid == 'null': | elif changeid == 'null': | ||||
node = nullid | node = nullid | ||||
rev = nullrev | rev = nullrev | ||||
return context.changectx(self, rev, node) | |||||
elif changeid == 'tip': | elif changeid == 'tip': | ||||
node = self.changelog.tip() | node = self.changelog.tip() | ||||
rev = self.changelog.rev(node) | rev = self.changelog.rev(node) | ||||
return context.changectx(self, rev, node) | |||||
elif changeid == '.': | elif changeid == '.': | ||||
# this is a hack to delay/avoid loading obsmarkers | # this is a hack to delay/avoid loading obsmarkers | ||||
# when we know that '.' won't be hidden | # when we know that '.' won't be hidden | ||||
node = self.dirstate.p1() | node = self.dirstate.p1() | ||||
rev = self.unfiltered().changelog.rev(node) | rev = self.unfiltered().changelog.rev(node) | ||||
return context.changectx(self, rev, node) | |||||
elif len(changeid) == 20: | elif len(changeid) == 20: | ||||
try: | try: | ||||
node = changeid | node = changeid | ||||
rev = self.changelog.rev(changeid) | rev = self.changelog.rev(changeid) | ||||
return context.changectx(self, rev, node) | |||||
except error.FilteredLookupError: | except error.FilteredLookupError: | ||||
changeid = hex(changeid) # for the error message | changeid = hex(changeid) # for the error message | ||||
raise | raise | ||||
except LookupError: | except LookupError: | ||||
# check if it might have come from damaged dirstate | # check if it might have come from damaged dirstate | ||||
# | # | ||||
# XXX we could avoid the unfiltered if we had a recognizable | # XXX we could avoid the unfiltered if we had a recognizable | ||||
# exception for filtered changeset access | # exception for filtered changeset access | ||||
if (self.local() | if (self.local() | ||||
and changeid in self.unfiltered().dirstate.parents()): | and changeid in self.unfiltered().dirstate.parents()): | ||||
msg = _("working directory has unknown parent '%s'!") | msg = _("working directory has unknown parent '%s'!") | ||||
raise error.Abort(msg % short(changeid)) | raise error.Abort(msg % short(changeid)) | ||||
changeid = hex(changeid) # for the error message | changeid = hex(changeid) # for the error message | ||||
raise | raise | ||||
elif len(changeid) == 40: | elif len(changeid) == 40: | ||||
node = bin(changeid) | node = bin(changeid) | ||||
rev = self.changelog.rev(node) | rev = self.changelog.rev(node) | ||||
return context.changectx(self, rev, node) | |||||
else: | else: | ||||
raise error.ProgrammingError( | raise error.ProgrammingError( | ||||
"unsupported changeid '%s' of type %s" % | "unsupported changeid '%s' of type %s" % | ||||
(changeid, type(changeid))) | (changeid, type(changeid))) | ||||
return context.changectx(self, rev, node) | |||||
except (error.FilteredIndexError, error.FilteredLookupError): | except (error.FilteredIndexError, error.FilteredLookupError): | ||||
raise error.FilteredRepoLookupError(_("filtered revision '%s'") | raise error.FilteredRepoLookupError(_("filtered revision '%s'") | ||||
% pycompat.bytestr(changeid)) | % pycompat.bytestr(changeid)) | ||||
except (IndexError, LookupError): | except (IndexError, LookupError): | ||||
raise error.RepoLookupError(_("unknown revision '%s'") % changeid) | raise error.RepoLookupError(_("unknown revision '%s'") % changeid) | ||||
except error.WdirUnsupported: | except error.WdirUnsupported: | ||||
return context.workingctx(self) | return context.workingctx(self) | ||||