diff 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
line wrap: on
line diff
--- a/mercurial/localrepo.py	Fri Apr 05 11:22:26 2019 -0700
+++ b/mercurial/localrepo.py	Fri Apr 05 11:24:00 2019 -0700
@@ -1564,7 +1564,10 @@
                 pass
 
     def lookup(self, key):
-        return scmutil.revsymbol(self, key).node()
+        node = scmutil.revsymbol(self, key).node()
+        if node is None:
+            raise error.RepoLookupError(_("unknown revision '%s'") % key)
+        return node
 
     def lookupbranch(self, key):
         if self.branchmap().hasbranch(key):