Mercurial > wikked
comparison wikked/scm/mercurial.py @ 172:27492ea65657
More work on initialization/teardown:
- Share the same Mercurial command server across requests.
- Better handling of database sessions.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 28 Jan 2014 08:16:35 -0800 |
parents | a71822a4beed |
children | 7533ffec1b5a |
comparison
equal
deleted
inserted
replaced
171:8701790360e0 | 172:27492ea65657 |
---|---|
172 logger.debug("Running Mercurial: " + str(exe)) | 172 logger.debug("Running Mercurial: " + str(exe)) |
173 return subprocess.check_output(exe) | 173 return subprocess.check_output(exe) |
174 | 174 |
175 | 175 |
176 class MercurialCommandServerSourceControl(MercurialBaseSourceControl): | 176 class MercurialCommandServerSourceControl(MercurialBaseSourceControl): |
177 def __init__(self, root): | 177 def __init__(self, root, client=None): |
178 MercurialBaseSourceControl.__init__(self, root) | 178 MercurialBaseSourceControl.__init__(self, root) |
179 | 179 |
180 import hglib | 180 if client is None: |
181 self.client = hglib.open(self.root) | 181 import hglib |
182 client = hglib.open(root) | |
183 self.client = client | |
182 | 184 |
183 def getHistory(self, path=None, limit=10): | 185 def getHistory(self, path=None, limit=10): |
184 if path is not None: | 186 if path is not None: |
185 status = self.client.status(include=[path]) | 187 status = self.client.status(include=[path]) |
186 if len(status) > 0 and status[0] == '?': | 188 if len(status) > 0 and status[0] == '?': |