comparison mercurial/localrepo.py @ 42079:fcd7a91dec23

localrepo: don't allow lookup of working directory revision It seems that repo.lookup(), which is what supports the "lookup" wire protocol command, should not allow the working copy revision input. This fixes both the pull test and the convert test I just added. Differential Revision: https://phab.mercurial-scm.org/D6215
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 05 Apr 2019 11:24:00 -0700
parents 8de1b5a009ee
children e0357a46c39d
comparison
equal deleted inserted replaced
42078:50b69c08651b 42079:fcd7a91dec23
1562 raise error.RepoLookupError(_("unknown branch '%s'") % branch) 1562 raise error.RepoLookupError(_("unknown branch '%s'") % branch)
1563 else: 1563 else:
1564 pass 1564 pass
1565 1565
1566 def lookup(self, key): 1566 def lookup(self, key):
1567 return scmutil.revsymbol(self, key).node() 1567 node = scmutil.revsymbol(self, key).node()
1568 if node is None:
1569 raise error.RepoLookupError(_("unknown revision '%s'") % key)
1570 return node
1568 1571
1569 def lookupbranch(self, key): 1572 def lookupbranch(self, key):
1570 if self.branchmap().hasbranch(key): 1573 if self.branchmap().hasbranch(key):
1571 return key 1574 return key
1572 1575