Do not forget to collect mercurial servers

Current variant spawns way too many hg instances which are not collected until 
Vim exits.
This commit is contained in:
Foo 2017-04-24 17:45:39 +03:00
parent d4d6bca2d0
commit 0a2359848a
1 changed files with 14 additions and 14 deletions

View File

@ -63,20 +63,20 @@ class Repository(object):
return self.do_status(self.directory, path) return self.do_status(self.directory, path)
def do_status(self, directory, path): def do_status(self, directory, path):
repo = self._repo(directory) with self._repo(directory) as repo:
if path: if path:
path = os.path.join(directory, path) path = os.path.join(directory, path)
statuses = repo.status(include=path, all=True) statuses = repo.status(include=path, all=True)
for status, paths in statuses: for status, paths in statuses:
if paths: if paths:
return self.statuses[status][0] return self.statuses[status][0]
return None return None
else: else:
resulting_status = 0 resulting_status = 0
for status, paths in repo.status(all=True): for status, paths in repo.status(all=True):
if paths: if paths:
resulting_status |= self.statuses[status][1] resulting_status |= self.statuses[status][1]
return self.repo_statuses_str[resulting_status] return self.repo_statuses_str[resulting_status]
def branch(self): def branch(self):
config_file = join(self.directory, '.hg', 'branch') config_file = join(self.directory, '.hg', 'branch')