mercurial/localrepo.py
changeset 40065 5c3585a58845
parent 40064 f84d7ed3bb35
child 40083 4fd0fac48922
equal deleted inserted replaced
40064:f84d7ed3bb35 40065:5c3585a58845
  1220                     if i not in self.changelog.filteredrevs]
  1220                     if i not in self.changelog.filteredrevs]
  1221         try:
  1221         try:
  1222             if isinstance(changeid, int):
  1222             if isinstance(changeid, int):
  1223                 node = self.changelog.node(changeid)
  1223                 node = self.changelog.node(changeid)
  1224                 rev = changeid
  1224                 rev = changeid
  1225                 return context.changectx(self, rev, node)
       
  1226             elif changeid == 'null':
  1225             elif changeid == 'null':
  1227                 node = nullid
  1226                 node = nullid
  1228                 rev = nullrev
  1227                 rev = nullrev
  1229                 return context.changectx(self, rev, node)
       
  1230             elif changeid == 'tip':
  1228             elif changeid == 'tip':
  1231                 node = self.changelog.tip()
  1229                 node = self.changelog.tip()
  1232                 rev = self.changelog.rev(node)
  1230                 rev = self.changelog.rev(node)
  1233                 return context.changectx(self, rev, node)
       
  1234             elif changeid == '.':
  1231             elif changeid == '.':
  1235                 # this is a hack to delay/avoid loading obsmarkers
  1232                 # this is a hack to delay/avoid loading obsmarkers
  1236                 # when we know that '.' won't be hidden
  1233                 # when we know that '.' won't be hidden
  1237                 node = self.dirstate.p1()
  1234                 node = self.dirstate.p1()
  1238                 rev = self.unfiltered().changelog.rev(node)
  1235                 rev = self.unfiltered().changelog.rev(node)
  1239                 return context.changectx(self, rev, node)
       
  1240             elif len(changeid) == 20:
  1236             elif len(changeid) == 20:
  1241                 try:
  1237                 try:
  1242                     node = changeid
  1238                     node = changeid
  1243                     rev = self.changelog.rev(changeid)
  1239                     rev = self.changelog.rev(changeid)
  1244                     return context.changectx(self, rev, node)
       
  1245                 except error.FilteredLookupError:
  1240                 except error.FilteredLookupError:
  1246                     changeid = hex(changeid) # for the error message
  1241                     changeid = hex(changeid) # for the error message
  1247                     raise
  1242                     raise
  1248                 except LookupError:
  1243                 except LookupError:
  1249                     # check if it might have come from damaged dirstate
  1244                     # check if it might have come from damaged dirstate
  1258                     raise
  1253                     raise
  1259 
  1254 
  1260             elif len(changeid) == 40:
  1255             elif len(changeid) == 40:
  1261                 node = bin(changeid)
  1256                 node = bin(changeid)
  1262                 rev = self.changelog.rev(node)
  1257                 rev = self.changelog.rev(node)
  1263                 return context.changectx(self, rev, node)
       
  1264             else:
  1258             else:
  1265                 raise error.ProgrammingError(
  1259                 raise error.ProgrammingError(
  1266                         "unsupported changeid '%s' of type %s" %
  1260                         "unsupported changeid '%s' of type %s" %
  1267                         (changeid, type(changeid)))
  1261                         (changeid, type(changeid)))
       
  1262 
       
  1263             return context.changectx(self, rev, node)
  1268 
  1264 
  1269         except (error.FilteredIndexError, error.FilteredLookupError):
  1265         except (error.FilteredIndexError, error.FilteredLookupError):
  1270             raise error.FilteredRepoLookupError(_("filtered revision '%s'")
  1266             raise error.FilteredRepoLookupError(_("filtered revision '%s'")
  1271                                                 % pycompat.bytestr(changeid))
  1267                                                 % pycompat.bytestr(changeid))
  1272         except (IndexError, LookupError):
  1268         except (IndexError, LookupError):