mercurial/commandserver.py
branchstable
changeset 14882 bb2cffe81a94
parent 14864 1b872599f39f
child 14939 b4c06b97dfe0
equal deleted inserted replaced
14881:2e54387976d4 14882:bb2cffe81a94
   130     Listens for commands on stdin, runs them and writes the output on a channel
   130     Listens for commands on stdin, runs them and writes the output on a channel
   131     based stream to stdout.
   131     based stream to stdout.
   132     """
   132     """
   133     def __init__(self, ui, repo, mode):
   133     def __init__(self, ui, repo, mode):
   134         self.cwd = os.getcwd()
   134         self.cwd = os.getcwd()
   135         self.ui = ui
       
   136 
   135 
   137         logpath = ui.config("cmdserver", "log", None)
   136         logpath = ui.config("cmdserver", "log", None)
   138         if logpath:
   137         if logpath:
   139             global logfile
   138             global logfile
   140             if logpath == '-':
   139             if logpath == '-':
   141                 # write log on a special 'd'ebug channel
   140                 # write log on a special 'd'ebug channel
   142                 logfile = channeledoutput(sys.stdout, sys.stdout, 'd')
   141                 logfile = channeledoutput(sys.stdout, sys.stdout, 'd')
   143             else:
   142             else:
   144                 logfile = open(logpath, 'a')
   143                 logfile = open(logpath, 'a')
   145 
   144 
       
   145         # the ui here is really the repo ui so take its baseui so we don't end up
       
   146         # with its local configuration
       
   147         self.ui = repo.baseui
   146         self.repo = repo
   148         self.repo = repo
   147         self.repoui = repo.ui
   149         self.repoui = repo.ui
   148 
   150 
   149         if mode == 'pipe':
   151         if mode == 'pipe':
   150             self.cerr = channeledoutput(sys.stderr, sys.stdout, 'e')
   152             self.cerr = channeledoutput(sys.stderr, sys.stdout, 'e')