Patchwork [Bug,6384] New: largefiles breaks topics over ssh transport

mail settings
Date July 24, 2020, 7:36 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/46861/
State Not Applicable
Headers show

Comments - July 24, 2020, 7:36 a.m.

            Bug ID: 6384
           Summary: largefiles breaks topics over ssh transport
           Product: Mercurial
           Version: 5.4.2
          Hardware: PC
                OS: Linux
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: largefiles
    Python Version: ---

Originally discovered on heptapod instance with additional largefiles extension
I was successfully using largefiles and topics over ssh when ssh was introduced
in heptapod-0.8. However after upgrading heptapod to newer version 0.12 which
also brought updated versions of mercurial and hg-evolve I lost that ability.
Same stayed for most recent heptapod-0.14.2 which is using Mercurial 5.4.2 /
Python 3.8.4 / hg-evolve 10.0.0.

Had a bit of look around and found that if I apply same old hack, applied
earlier just to http proto, largefiles + topics overs ssh works.

Old hack for http transport only:
changeset:   19917:cff331cbb5ee
user:        Mads Kiilerich <>
date:        Thu Oct 10 04:28:39 2013 +0200
summary:     largefiles: make the protocol hack for replacing heads with lheads
more precise


Don't know why it was working earlier and why it got broken now. Were there
changes in hg ssh transport protocol?

As the change (if correct) is trivial, I'm happy to exercise contribution
process, prob via phab.


diff -r fb583a1efef0 -r cff331cbb5ee hgext/largefiles/
--- a/hgext/largefiles/ Mon Apr 01 20:01:16 2013 -0700
+++ b/hgext/largefiles/ Thu Oct 10 04:28:39 2013 +0200
@@ -5,6 +5,7 @@ 

 import os
 import urllib2
+import re

 from mercurial import error, httppeer, util, wireproto
 from mercurial.wireproto import batchable, future
@@ -166,9 +167,11 @@ 
         args['cmds'] = args['cmds'].replace('heads ', 'lheads ')
     return ssholdcallstream(self, cmd, **args)

+headsre = re.compile(r'(^|;)heads\b')
 def httprepocallstream(self, cmd, **args):
     if cmd == 'heads' and self.capable('largefiles'):
         cmd = 'lheads'
     if cmd == 'batch' and self.capable('largefiles'):
-        args['cmds'] = args['cmds'].replace('heads ', 'lheads ')
+        args['cmds'] = headsre.sub('lheads', args['cmds'])
     return httpoldcallstream(self, cmd, **args)