Patchwork D3075: hgweb: use revsymbol() for creating context from changeid

login
register
mail settings
Submitter phabricator
Date April 4, 2018, 4:41 p.m.
Message ID <differential-rev-PHID-DREV-lkgjgo6esqp3bvrbhntq-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30266/
State Superseded
Headers show

Comments

phabricator - April 4, 2018, 4:41 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  These seem to be for looking up a revision that can come from the
  user, so revsymbol() is the right method to call (https://phab.mercurial-scm.org/rHG0194dac77c93912e3073466c440f4f175fc93bc0 has more
  information about my plans for repo[x]).

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3075

AFFECTED FILES
  mercurial/hgweb/webutil.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -32,6 +32,7 @@ 
     patch,
     pathutil,
     pycompat,
+    scmutil,
     templatefilters,
     templatekw,
     ui as uimod,
@@ -303,15 +304,15 @@ 
         if ipos != -1:
             changeid = changeid[(ipos + 1):]
 
-    return repo[changeid]
+    return scmutil.revsymbol(repo, changeid)
 
 def basechangectx(repo, req):
     if 'node' in req.qsparams:
         changeid = req.qsparams['node']
         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)