Show More
@@ -190,13 +190,6 b' def _uisetup(ui):' | |||||
190 | ) |
|
190 | ) | |
191 | # TODO also wrap wireproto.commandsv2 once heads is implemented there. |
|
191 | # TODO also wrap wireproto.commandsv2 once heads is implemented there. | |
192 |
|
192 | |||
193 | # can't do this in reposetup because it needs to have happened before |
|
|||
194 | # wirerepo.__init__ is called |
|
|||
195 | proto.ssholdcallstream = sshpeer.sshv1peer._callstream |
|
|||
196 | proto.httpoldcallstream = httppeer.httppeer._callstream |
|
|||
197 | sshpeer.sshv1peer._callstream = proto.sshrepocallstream |
|
|||
198 | httppeer.httppeer._callstream = proto.httprepocallstream |
|
|||
199 |
|
||||
200 | # override some extensions' stuff as well |
|
193 | # override some extensions' stuff as well | |
201 | for name, module in extensions.extensions(): |
|
194 | for name, module in extensions.extensions(): | |
202 | if name == b'rebase': |
|
195 | if name == b'rebase': |
@@ -33,10 +33,6 b' LARGEFILES_REQUIRED_MSG = (' | |||||
33 |
|
33 | |||
34 | eh = exthelper.exthelper() |
|
34 | eh = exthelper.exthelper() | |
35 |
|
35 | |||
36 | # these will all be replaced by largefiles.uisetup |
|
|||
37 | ssholdcallstream = None |
|
|||
38 | httpoldcallstream = None |
|
|||
39 |
|
||||
40 |
|
36 | |||
41 | def putlfile(repo, proto, sha): |
|
37 | def putlfile(repo, proto, sha): | |
42 | """Server command for putting a largefile into a repository's local store |
|
38 | """Server command for putting a largefile into a repository's local store | |
@@ -106,7 +102,27 b' def statlfile(repo, proto, sha):' | |||||
106 |
|
102 | |||
107 |
|
103 | |||
108 | def wirereposetup(ui, repo): |
|
104 | def wirereposetup(ui, repo): | |
|
105 | orig_commandexecutor = repo.commandexecutor | |||
|
106 | ||||
109 | class lfileswirerepository(repo.__class__): |
|
107 | class lfileswirerepository(repo.__class__): | |
|
108 | def commandexecutor(self): | |||
|
109 | executor = orig_commandexecutor() | |||
|
110 | if self.capable(b'largefiles'): | |||
|
111 | orig_callcommand = executor.callcommand | |||
|
112 | ||||
|
113 | class lfscommandexecutor(executor.__class__): | |||
|
114 | def callcommand(self, command, args): | |||
|
115 | if command == b'heads': | |||
|
116 | command = b'lheads' | |||
|
117 | return orig_callcommand(command, args) | |||
|
118 | ||||
|
119 | executor.__class__ = lfscommandexecutor | |||
|
120 | return executor | |||
|
121 | ||||
|
122 | @wireprotov1peer.batchable | |||
|
123 | def lheads(self): | |||
|
124 | return self.heads.batchable(self) | |||
|
125 | ||||
110 | def putlfile(self, sha, fd): |
|
126 | def putlfile(self, sha, fd): | |
111 | # unfortunately, httprepository._callpush tries to convert its |
|
127 | # unfortunately, httprepository._callpush tries to convert its | |
112 | # input file-like into a bundle before sending it, so we can't use |
|
128 | # input file-like into a bundle before sending it, so we can't use | |
@@ -200,22 +216,3 b' def heads(orig, repo, proto):' | |||||
200 | return wireprototypes.ooberror(LARGEFILES_REQUIRED_MSG) |
|
216 | return wireprototypes.ooberror(LARGEFILES_REQUIRED_MSG) | |
201 |
|
217 | |||
202 | return orig(repo, proto) |
|
218 | return orig(repo, proto) | |
203 |
|
||||
204 |
|
||||
205 | def sshrepocallstream(self, cmd, **args): |
|
|||
206 | if cmd == b'heads' and self.capable(b'largefiles'): |
|
|||
207 | cmd = b'lheads' |
|
|||
208 | if cmd == b'batch' and self.capable(b'largefiles'): |
|
|||
209 | args['cmds'] = args[r'cmds'].replace(b'heads ', b'lheads ') |
|
|||
210 | return ssholdcallstream(self, cmd, **args) |
|
|||
211 |
|
||||
212 |
|
||||
213 | headsre = re.compile(br'(^|;)heads\b') |
|
|||
214 |
|
||||
215 |
|
||||
216 | def httprepocallstream(self, cmd, **args): |
|
|||
217 | if cmd == b'heads' and self.capable(b'largefiles'): |
|
|||
218 | cmd = b'lheads' |
|
|||
219 | if cmd == b'batch' and self.capable(b'largefiles'): |
|
|||
220 | args['cmds'] = headsre.sub(b'lheads', args['cmds']) |
|
|||
221 | return httpoldcallstream(self, cmd, **args) |
|
General Comments 0
You need to be logged in to leave comments.
Login now