diff -r 05ff1a155a21 -r bb47dc2f71a0 mercurial/localrepo.py --- a/mercurial/localrepo.py Thu Mar 29 22:22:51 2018 -0700 +++ b/mercurial/localrepo.py Thu Mar 29 22:51:45 2018 -0700 @@ -782,6 +782,8 @@ def __getitem__(self, changeid): if changeid is None: return context.workingctx(self) + if isinstance(changeid, context.basectx): + return changeid if isinstance(changeid, slice): # wdirrev isn't contiguous so the slice shouldn't include it return [context.changectx(self, i)