##// 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 b' def serve(ui, repo, **opts):'
5168 s.serve_forever()
5168 s.serve_forever()
5169
5169
5170 if opts["cmdserver"]:
5170 if opts["cmdserver"]:
5171 checkrepo()
5172 s = commandserver.server(ui, repo, opts["cmdserver"])
5171 s = commandserver.server(ui, repo, opts["cmdserver"])
5173 return s.serve()
5172 return s.serve()
5174
5173
@@ -142,11 +142,15 b' class server(object):'
142 else:
142 else:
143 logfile = open(logpath, 'a')
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
145 if repo:
146 # up with its local configuration
146 # the ui here is really the repo ui so take its baseui so we don't
147 self.ui = repo.baseui
147 # end up with its local configuration
148 self.repo = repo
148 self.ui = repo.baseui
149 self.repoui = repo.ui
149 self.repo = repo
150 self.repoui = repo.ui
151 else:
152 self.ui = ui
153 self.repo = self.repoui = None
150
154
151 if mode == 'pipe':
155 if mode == 'pipe':
152 self.cerr = channeledoutput(sys.stderr, sys.stdout, 'e')
156 self.cerr = channeledoutput(sys.stderr, sys.stdout, 'e')
@@ -183,12 +187,13 b' class server(object):'
183 # copy the uis so changes (e.g. --config or --verbose) don't
187 # copy the uis so changes (e.g. --config or --verbose) don't
184 # persist between requests
188 # persist between requests
185 copiedui = self.ui.copy()
189 copiedui = self.ui.copy()
186 self.repo.baseui = copiedui
190 if self.repo:
187 # clone ui without using ui.copy because this is protected
191 self.repo.baseui = copiedui
188 repoui = self.repoui.__class__(self.repoui)
192 # clone ui without using ui.copy because this is protected
189 repoui.copy = copiedui.copy # redo copy protection
193 repoui = self.repoui.__class__(self.repoui)
190 self.repo.ui = self.repo.dirstate._ui = repoui
194 repoui.copy = copiedui.copy # redo copy protection
191 self.repo.invalidateall()
195 self.repo.ui = self.repo.dirstate._ui = repoui
196 self.repo.invalidateall()
192
197
193 req = dispatch.request(args[:], copiedui, self.repo, self.cin,
198 req = dispatch.request(args[:], copiedui, self.repo, self.cin,
194 self.cout, self.cerr)
199 self.cout, self.cerr)
@@ -294,6 +294,11 b' def mqoutsidechanges(server):'
294 # repo.mq should be recreated to point to new queue
294 # repo.mq should be recreated to point to new queue
295 runcommand(server, ['qqueue', '--active'])
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 if __name__ == '__main__':
302 if __name__ == '__main__':
298 os.system('hg init repo')
303 os.system('hg init repo')
299 os.chdir('repo')
304 os.chdir('repo')
@@ -329,3 +334,7 b" if __name__ == '__main__':"
329 hgrc.write('[extensions]\nmq=\n')
334 hgrc.write('[extensions]\nmq=\n')
330 hgrc.close()
335 hgrc.close()
331 check(mqoutsidechanges)
336 check(mqoutsidechanges)
337
338 os.chdir('..')
339 check(hellomessage)
340 check(startwithoutrepo)
@@ -237,3 +237,16 b' popping 0.diff'
237 patch queue now empty
237 patch queue now empty
238 runcommand qqueue --active
238 runcommand qqueue --active
239 foo
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