536 return '%s.%d.tmp' % (address, os.getpid()) |
536 return '%s.%d.tmp' % (address, os.getpid()) |
537 |
537 |
538 def _hashaddress(address, hashstr): |
538 def _hashaddress(address, hashstr): |
539 return '%s-%s' % (address, hashstr) |
539 return '%s-%s' % (address, hashstr) |
540 |
540 |
541 class chgunixservice(commandserver.unixservice): |
541 class _chgunixservice(commandserver.unixservice): |
542 def __init__(self, ui, repo, opts): |
|
543 super(chgunixservice, self).__init__(ui, repo=None, opts=opts) |
|
544 if repo: |
|
545 # one chgserver can serve multiple repos. drop repo infomation |
|
546 self.ui.setconfig('bundle', 'mainreporoot', '', 'repo') |
|
547 |
|
548 def init(self): |
542 def init(self): |
549 self._inithashstate() |
543 self._inithashstate() |
550 self._checkextensions() |
544 self._checkextensions() |
551 class cls(AutoExitMixIn, socketserver.ForkingMixIn, |
545 class cls(AutoExitMixIn, socketserver.ForkingMixIn, |
552 socketserver.UnixStreamServer): |
546 socketserver.UnixStreamServer): |
651 def _createcmdserver(self, repo, conn, fin, fout): |
645 def _createcmdserver(self, repo, conn, fin, fout): |
652 ui = self.server.ui |
646 ui = self.server.ui |
653 return chgcmdserver(ui, repo, fin, fout, conn, |
647 return chgcmdserver(ui, repo, fin, fout, conn, |
654 self.server.hashstate, self.server.baseaddress) |
648 self.server.hashstate, self.server.baseaddress) |
655 |
649 |
|
650 def chgunixservice(ui, repo, opts): |
|
651 if repo: |
|
652 # one chgserver can serve multiple repos. drop repo infomation |
|
653 ui.setconfig('bundle', 'mainreporoot', '', 'repo') |
|
654 return _chgunixservice(ui, repo=None, opts=opts) |
|
655 |
656 def uisetup(ui): |
656 def uisetup(ui): |
657 commandserver._servicemap['chgunix'] = chgunixservice |
657 commandserver._servicemap['chgunix'] = chgunixservice |
658 |
658 |
659 # CHGINTERNALMARK is temporarily set by chg client to detect if chg will |
659 # CHGINTERNALMARK is temporarily set by chg client to detect if chg will |
660 # start another chg. drop it to avoid possible side effects. |
660 # start another chg. drop it to avoid possible side effects. |