[PATCH 6 of 9 remotefilelog-ext getfile-http] fileserverclient: sniff for remotefilelog capability before using it
Augie Fackler
raf at durin42.com
Wed Jul 1 15:05:43 CDT 2015
# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1435613636 14400
# Mon Jun 29 17:33:56 2015 -0400
# Node ID 5e58703e43ff3ce67f212de4c4cbc4231b0cf526
# Parent 9527b11d57224af70ffa4569db04e8d93bde4555
fileserverclient: sniff for remotefilelog capability before using it
This prevents clients from causing a server problem on an http server.
diff --git a/remotefilelog/fileserverclient.py b/remotefilelog/fileserverclient.py
--- a/remotefilelog/fileserverclient.py
+++ b/remotefilelog/fileserverclient.py
@@ -173,6 +173,10 @@ class fileserverclient(object):
raise util.Abort("no remotefilelog server configured - "
"is your .hg/hgrc trusted?")
remote = hg.peer(self.ui, {}, fallbackpath)
+ # TODO: deduplicate this with the constant in shallowrepo
+ if not remote.capable("remotefilelog"):
+ raise util.Abort("configured remotefilelog server"
+ " does not support remotefilelog")
remote._callstream("getfiles")
finally:
self.ui.verbose = verbose
diff --git a/tests/test-http.t b/tests/test-http.t
--- a/tests/test-http.t
+++ b/tests/test-http.t
@@ -8,8 +8,6 @@
> EOF
$ echo x > x
$ hg commit -qAm x
-Bug: remotefilelog tries to fetch from a server which can't handle
-remotefilelog requests because it's http-based:
$ hg serve -p $HGPORT -d --pid-file=../hg1.pid -E ../error.log
$ cd ..
@@ -17,7 +15,8 @@ remotefilelog requests because it's http
$ hgcloneshallow http://localhost:$HGPORT/ shallow -q
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over 0.00s
- abort: HTTP Error 500: Internal Server Error
+ abort: configured remotefilelog server does not support remotefilelog
+
The 'remotefilelog' capability should *not* be exported over http(s),
as the getfile method it offers doesn't work with http.
More information about the Mercurial-devel
mailing list