hgweb: use revsymbol() for creating context from changeid
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 04 Apr 2018 09:41:18 -0700
changeset 37335 956260cbc564
parent 37334 6407507e12b6
child 37336 5d10f41ddcc4
hgweb: use revsymbol() for creating context from changeid These seem to be for looking up a revision that can come from the user, so revsymbol() is the right method to call (0194dac7 has more information about my plans for repo[x]). Differential Revision: https://phab.mercurial-scm.org/D3075
mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py	Tue Apr 03 23:00:41 2018 -0700
+++ b/mercurial/hgweb/webutil.py	Wed Apr 04 09:41:18 2018 -0700
@@ -32,6 +32,7 @@
     patch,
     pathutil,
     pycompat,
+    scmutil,
     templatefilters,
     templatekw,
     ui as uimod,
@@ -303,7 +304,7 @@
         if ipos != -1:
             changeid = changeid[(ipos + 1):]
 
-    return repo[changeid]
+    return scmutil.revsymbol(repo, changeid)
 
 def basechangectx(repo, req):
     if 'node' in req.qsparams:
@@ -311,7 +312,7 @@
         ipos = changeid.find(':')
         if ipos != -1:
             changeid = changeid[:ipos]
-            return repo[changeid]
+            return scmutil.revsymbol(repo, changeid)
 
     return None
 
@@ -326,7 +327,7 @@
     else:
         raise ErrorResponse(HTTP_NOT_FOUND, 'node or filenode not given')
     try:
-        fctx = repo[changeid][path]
+        fctx = scmutil.revsymbol(repo, changeid)[path]
     except error.RepoError:
         fctx = repo.filectx(path, fileid=changeid)