##// END OF EJS Templates
cmdserver: allow to start server without repository...
Yuya Nishihara -
r20650:e811b93f default
parent child Browse files
Show More
@@ -5168,7 +5168,6 def serve(ui, repo, **opts):
5168 5168 s.serve_forever()
5169 5169
5170 5170 if opts["cmdserver"]:
5171 checkrepo()
5172 5171 s = commandserver.server(ui, repo, opts["cmdserver"])
5173 5172 return s.serve()
5174 5173
@@ -142,11 +142,15 class server(object):
142 142 else:
143 143 logfile = open(logpath, 'a')
144 144
145 # the ui here is really the repo ui so take its baseui so we don't end
146 # up with its local configuration
147 self.ui = repo.baseui
148 self.repo = repo
149 self.repoui = repo.ui
145 if repo:
146 # the ui here is really the repo ui so take its baseui so we don't
147 # end up with its local configuration
148 self.ui = repo.baseui
149 self.repo = repo
150 self.repoui = repo.ui
151 else:
152 self.ui = ui
153 self.repo = self.repoui = None
150 154
151 155 if mode == 'pipe':
152 156 self.cerr = channeledoutput(sys.stderr, sys.stdout, 'e')
@@ -183,12 +187,13 class server(object):
183 187 # copy the uis so changes (e.g. --config or --verbose) don't
184 188 # persist between requests
185 189 copiedui = self.ui.copy()
186 self.repo.baseui = copiedui
187 # clone ui without using ui.copy because this is protected
188 repoui = self.repoui.__class__(self.repoui)
189 repoui.copy = copiedui.copy # redo copy protection
190 self.repo.ui = self.repo.dirstate._ui = repoui
191 self.repo.invalidateall()
190 if self.repo:
191 self.repo.baseui = copiedui
192 # clone ui without using ui.copy because this is protected
193 repoui = self.repoui.__class__(self.repoui)
194 repoui.copy = copiedui.copy # redo copy protection
195 self.repo.ui = self.repo.dirstate._ui = repoui
196 self.repo.invalidateall()
192 197
193 198 req = dispatch.request(args[:], copiedui, self.repo, self.cin,
194 199 self.cout, self.cerr)
@@ -294,6 +294,11 def mqoutsidechanges(server):
294 294 # repo.mq should be recreated to point to new queue
295 295 runcommand(server, ['qqueue', '--active'])
296 296
297 def startwithoutrepo(server):
298 readchannel(server)
299 runcommand(server, ['init', 'repo2'])
300 runcommand(server, ['id', '-R', 'repo2'])
301
297 302 if __name__ == '__main__':
298 303 os.system('hg init repo')
299 304 os.chdir('repo')
@@ -329,3 +334,7 if __name__ == '__main__':
329 334 hgrc.write('[extensions]\nmq=\n')
330 335 hgrc.close()
331 336 check(mqoutsidechanges)
337
338 os.chdir('..')
339 check(hellomessage)
340 check(startwithoutrepo)
@@ -237,3 +237,16 popping 0.diff
237 237 patch queue now empty
238 238 runcommand qqueue --active
239 239 foo
240
241 testing hellomessage:
242
243 o, 'capabilities: getencoding runcommand\nencoding: ***'
244 runcommand id
245 abort: there is no Mercurial repository here (.hg not found)
246 [255]
247
248 testing startwithoutrepo:
249
250 runcommand init repo2
251 runcommand id -R repo2
252 000000000000 tip
General Comments 0
You need to be logged in to leave comments. Login now