Patchwork D8299: remotefilelog: add fake heads() method that allows viewing a file in hgweb

login
register
mail settings
Submitter phabricator
Date March 17, 2020, 9:44 p.m.
Message ID <differential-rev-PHID-DREV-hdfvneuoc2mcwbuauuph-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45813/
State Superseded
Headers show

Comments

phabricator - March 17, 2020, 9:44 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  As best I can discern, this is not going to hurt anything, but it'll
  cause a couple of options to exist in the UI that are
  nonsensical. That seems fine, given the nature of remotefilelog.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/remotefilelog/remotefilelog.py
  tests/test-remotefilelog-hgweb.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-remotefilelog-hgweb.t b/tests/test-remotefilelog-hgweb.t
--- a/tests/test-remotefilelog-hgweb.t
+++ b/tests/test-remotefilelog-hgweb.t
@@ -24,9 +24,15 @@ 
   $ cd wdir
   $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -E errors.log
   $ cat hg.pid >> $DAEMON_PIDS
-  $ (get-with-headers.py localhost:$HGPORT 'file/tip/x')
-  500 Internal Server Error
+  $ get-with-headers.py localhost:$HGPORT 'file/tip/x' | head -n 10
+  200 Script output follows
   
-  Internal Server Error (no-eol)
-  [1]
+  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
+  <head>
+  <link rel="icon" href="/static/hgicon.png" type="image/png" />
+  <meta name="robots" content="index, nofollow" />
+  <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
+  <script type="text/javascript" src="/static/mercurial.js"></script>
+  
 
diff --git a/hgext/remotefilelog/remotefilelog.py b/hgext/remotefilelog/remotefilelog.py
--- a/hgext/remotefilelog/remotefilelog.py
+++ b/hgext/remotefilelog/remotefilelog.py
@@ -259,6 +259,10 @@ 
 
         raise RuntimeError(b"len not supported")
 
+    def heads(self):
+        # Fake heads of the filelog to satisfy hgweb.
+        return []
+
     def empty(self):
         return False