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

login
register
mail settings
Submitter mercurial-bugs@mercurial-scm.org
Date July 24, 2020, 7:36 a.m.
Message ID <bug-6384-285@https.bz.mercurial-scm.org/>
Download mbox | patch
Permalink /patch/46861/
State Not Applicable
Headers show

Comments

mercurial-bugs@mercurial-scm.org - July 24, 2020, 7:36 a.m.
https://bz.mercurial-scm.org/show_bug.cgi?id=6384

            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
          Assignee: bugzilla@mercurial-scm.org
          Reporter: blazej.cegielka@gmail.com
                CC: mercurial-devel@mercurial-scm.org, natosha@gmail.com
    Python Version: ---

Originally discovered on heptapod instance with additional largefiles extension
enabled.
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 <madski@unity3d.com>
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.

Patch

diff -r fb583a1efef0 -r cff331cbb5ee hgext/largefiles/proto.py
--- a/hgext/largefiles/proto.py Mon Apr 01 20:01:16 2013 -0700
+++ b/hgext/largefiles/proto.py 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)