equal
deleted
inserted
replaced
48 tmpfp.close() |
48 tmpfp.close() |
49 lfutil.linktousercache(repo, sha) |
49 lfutil.linktousercache(repo, sha) |
50 except IOError as e: |
50 except IOError as e: |
51 repo.ui.warn(_('largefiles: failed to put %s into store: %s\n') % |
51 repo.ui.warn(_('largefiles: failed to put %s into store: %s\n') % |
52 (sha, e.strerror)) |
52 (sha, e.strerror)) |
53 return wireproto.pushres(1, output.getvalue() if output else '') |
53 return wireprototypes.pushres( |
|
54 1, output.getvalue() if output else '') |
54 finally: |
55 finally: |
55 tmpfp.discard() |
56 tmpfp.discard() |
56 |
57 |
57 return wireproto.pushres(0, output.getvalue() if output else '') |
58 return wireprototypes.pushres(0, output.getvalue() if output else '') |
58 |
59 |
59 def getlfile(repo, proto, sha): |
60 def getlfile(repo, proto, sha): |
60 '''Server command for retrieving a largefile from the repository-local |
61 '''Server command for retrieving a largefile from the repository-local |
61 cache or user cache.''' |
62 cache or user cache.''' |
62 filename = lfutil.findfile(repo, sha) |
63 filename = lfutil.findfile(repo, sha) |
73 # ssh proto does for string responses. |
74 # ssh proto does for string responses. |
74 def generator(): |
75 def generator(): |
75 yield '%d\n' % length |
76 yield '%d\n' % length |
76 for chunk in util.filechunkiter(f): |
77 for chunk in util.filechunkiter(f): |
77 yield chunk |
78 yield chunk |
78 return wireproto.streamres_legacy(gen=generator()) |
79 return wireprototypes.streamreslegacy(gen=generator()) |
79 |
80 |
80 def statlfile(repo, proto, sha): |
81 def statlfile(repo, proto, sha): |
81 '''Server command for checking if a largefile is present - returns '2\n' if |
82 '''Server command for checking if a largefile is present - returns '2\n' if |
82 the largefile is missing, '0\n' if it seems to be in good condition. |
83 the largefile is missing, '0\n' if it seems to be in good condition. |
83 |
84 |
168 |
169 |
169 def heads(repo, proto): |
170 def heads(repo, proto): |
170 '''Wrap server command - largefile capable clients will know to call |
171 '''Wrap server command - largefile capable clients will know to call |
171 lheads instead''' |
172 lheads instead''' |
172 if lfutil.islfilesrepo(repo): |
173 if lfutil.islfilesrepo(repo): |
173 return wireproto.ooberror(LARGEFILES_REQUIRED_MSG) |
174 return wireprototypes.ooberror(LARGEFILES_REQUIRED_MSG) |
174 return wireproto.heads(repo, proto) |
175 return wireproto.heads(repo, proto) |
175 |
176 |
176 def sshrepocallstream(self, cmd, **args): |
177 def sshrepocallstream(self, cmd, **args): |
177 if cmd == 'heads' and self.capable('largefiles'): |
178 if cmd == 'heads' and self.capable('largefiles'): |
178 cmd = 'lheads' |
179 cmd = 'lheads' |