Mercurial > public > mercurial-scm > hg
comparison mercurial/sshserver.py @ 11594:67863f9d805f
protocol: unify server-side capabilities functions
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 15 Jul 2010 13:56:52 -0500 |
parents | d054cc5c7737 |
children | 47ca289a3a08 |
comparison
equal
deleted
inserted
replaced
11593:d054cc5c7737 | 11594:67863f9d805f |
---|---|
10 from node import bin, hex | 10 from node import bin, hex |
11 import streamclone, util, hook, pushkey, wireproto | 11 import streamclone, util, hook, pushkey, wireproto |
12 import os, sys, tempfile, urllib, copy | 12 import os, sys, tempfile, urllib, copy |
13 | 13 |
14 class sshserver(object): | 14 class sshserver(object): |
15 | |
16 caps = 'unbundle lookup changegroupsubset branchmap pushkey'.split() | |
17 | |
18 def __init__(self, ui, repo): | 15 def __init__(self, ui, repo): |
19 self.ui = ui | 16 self.ui = ui |
20 self.repo = repo | 17 self.repo = repo |
21 self.lock = None | 18 self.lock = None |
22 self.fin = sys.stdin | 19 self.fin = sys.stdin |
104 if r is not None: | 101 if r is not None: |
105 self.respond(r) | 102 self.respond(r) |
106 else: self.respond("") | 103 else: self.respond("") |
107 return cmd != '' | 104 return cmd != '' |
108 | 105 |
109 def do_hello(self): | |
110 '''the hello command returns a set of lines describing various | |
111 interesting things about the server, in an RFC822-like format. | |
112 Currently the only one defined is "capabilities", which | |
113 consists of a line in the form: | |
114 | |
115 capabilities: space separated list of tokens | |
116 ''' | |
117 caps = copy.copy(self.caps) | |
118 if streamclone.allowed(self.repo.ui): | |
119 caps.append('stream=%d' % self.repo.changelog.version) | |
120 return "capabilities: %s\n" % (' '.join(caps),) | |
121 | |
122 def do_lock(self): | 106 def do_lock(self): |
123 '''DEPRECATED - allowing remote client to lock repo is not safe''' | 107 '''DEPRECATED - allowing remote client to lock repo is not safe''' |
124 | 108 |
125 self.lock = self.repo.lock() | 109 self.lock = self.repo.lock() |
126 return "" | 110 return "" |