[PATCH 7 of 9 remotefilelog-ext getfile-http] fileserverclient: refuse to operate on a non-sshpeer

Augie Fackler raf at durin42.com
Wed Jul 1 15:05:44 CDT 2015


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1435609544 14400
#      Mon Jun 29 16:25:44 2015 -0400
# Node ID d95d09694be01c8423372350ac9bffa876383e0e
# Parent  5e58703e43ff3ce67f212de4c4cbc4231b0cf526
fileserverclient: refuse to operate on a non-sshpeer

The way the protocol is defined for getfiles interleaves reading
filenames and sending file contents, which works fine over ssh but is
incompatible with http.

This change is probably not neccessary now that remotefilelog
correctly checks for its own capability first, but it helped me debug
so I left it in for completeness.

diff --git a/remotefilelog/fileserverclient.py b/remotefilelog/fileserverclient.py
--- a/remotefilelog/fileserverclient.py
+++ b/remotefilelog/fileserverclient.py
@@ -177,6 +177,8 @@ class fileserverclient(object):
                     if not remote.capable("remotefilelog"):
                         raise util.Abort("configured remotefilelog server"
                                          " does not support remotefilelog")
+                    if not isinstance(remote, sshpeer.sshpeer):
+                        raise util.Abort('remotefilelog requires ssh servers')
                     remote._callstream("getfiles")
                 finally:
                     self.ui.verbose = verbose


More information about the Mercurial-devel mailing list