Mercurial > hg
comparison mercurial/sshserver.py @ 2956:6dddcba7596a
merge.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Fri, 18 Aug 2006 21:17:28 -0700 |
parents | 345bac2bc4ec |
children | 53e843840349 |
comparison
equal
deleted
inserted
replaced
2955:9d1c3529ebbc | 2956:6dddcba7596a |
---|---|
1 # sshserver.py - ssh protocol server support for mercurial | 1 # sshserver.py - ssh protocol server support for mercurial |
2 # | 2 # |
3 # Copyright 2005 Matt Mackall <mpm@selenic.com> | 3 # Copyright 2005 Matt Mackall <mpm@selenic.com> |
4 # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> | |
4 # | 5 # |
5 # This software may be used and distributed according to the terms | 6 # This software may be used and distributed according to the terms |
6 # of the GNU General Public License, incorporated herein by reference. | 7 # of the GNU General Public License, incorporated herein by reference. |
7 | 8 |
8 from demandload import demandload | 9 from demandload import demandload |
115 if not self.lock: | 116 if not self.lock: |
116 self.respond("not locked") | 117 self.respond("not locked") |
117 return | 118 return |
118 | 119 |
119 self.respond("") | 120 self.respond("") |
120 r = self.repo.addchangegroup(self.fin, 'serve') | 121 r = self.repo.addchangegroup(self.fin, 'serve', self.client_url()) |
121 self.respond(str(r)) | 122 self.respond(str(r)) |
122 | 123 |
124 def client_url(self): | |
125 client = os.environ.get('SSH_CLIENT', '').split(' ', 1)[0] | |
126 return 'remote:ssh:' + client | |
127 | |
123 def do_unbundle(self): | 128 def do_unbundle(self): |
124 their_heads = self.getarg()[1].split() | 129 their_heads = self.getarg()[1].split() |
125 | 130 |
126 def check_heads(): | 131 def check_heads(): |
127 heads = map(hex, self.repo.heads()) | 132 heads = map(hex, self.repo.heads()) |
157 self.respond('') | 162 self.respond('') |
158 | 163 |
159 # push can proceed | 164 # push can proceed |
160 | 165 |
161 fp.seek(0) | 166 fp.seek(0) |
162 r = self.repo.addchangegroup(fp, 'serve') | 167 r = self.repo.addchangegroup(fp, 'serve', self.client_url()) |
163 self.respond(str(r)) | 168 self.respond(str(r)) |
164 finally: | 169 finally: |
165 if not was_locked: | 170 if not was_locked: |
166 self.lock.release() | 171 self.lock.release() |
167 self.lock = None | 172 self.lock = None |