# HG changeset patch # User Mads Kiilerich # Date 1381372119 -7200 # Node ID cff331cbb5ee3d60d7a1d0a23efa942e069c6453 # Parent fb583a1efef04dcb1c0326622661d9f959fec317 largefiles: make the protocol hack for replacing heads with lheads more precise Before the hack would replace 'heads' with 'lheads' no matter where it occured in a batch command string. Instead we will use a regexp to more carefully only match the 'heads' commands. 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)