comparison hgext/largefiles/proto.py @ 35507:95a9be56c3bb

largefiles: modernize how capabilities are added to the wire protocol See 982f13bef503, which came well after this code was originally written.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 26 Dec 2017 23:40:49 -0500
parents 576ba8194fa8
children a39a9df7ecca
comparison
equal deleted inserted replaced
35506:fa865878a849 35507:95a9be56c3bb
26 LARGEFILES_REQUIRED_MSG = ('\nThis repository uses the largefiles extension.' 26 LARGEFILES_REQUIRED_MSG = ('\nThis repository uses the largefiles extension.'
27 '\n\nPlease enable it in your Mercurial config ' 27 '\n\nPlease enable it in your Mercurial config '
28 'file.\n') 28 'file.\n')
29 29
30 # these will all be replaced by largefiles.uisetup 30 # these will all be replaced by largefiles.uisetup
31 capabilitiesorig = None
32 ssholdcallstream = None 31 ssholdcallstream = None
33 httpoldcallstream = None 32 httpoldcallstream = None
34 33
35 def putlfile(repo, proto, sha): 34 def putlfile(repo, proto, sha):
36 '''Server command for putting a largefile into a repository's local store 35 '''Server command for putting a largefile into a repository's local store
159 yield 2 158 yield 2
160 159
161 repo.__class__ = lfileswirerepository 160 repo.__class__ = lfileswirerepository
162 161
163 # advertise the largefiles=serve capability 162 # advertise the largefiles=serve capability
164 def capabilities(repo, proto): 163 def _capabilities(orig, repo, proto):
165 '''Wrap server command to announce largefile server capability''' 164 '''announce largefile server capability'''
166 return capabilitiesorig(repo, proto) + ' largefiles=serve' 165 caps = orig(repo, proto)
166 caps.append('largefiles=serve')
167 return caps
167 168
168 def heads(repo, proto): 169 def heads(repo, proto):
169 '''Wrap server command - largefile capable clients will know to call 170 '''Wrap server command - largefile capable clients will know to call
170 lheads instead''' 171 lheads instead'''
171 if lfutil.islfilesrepo(repo): 172 if lfutil.islfilesrepo(repo):