Mercurial > hg-stable
comparison hgext/convert/darcs.py @ 17413:97f1f22c2dba stable
convert: use subprocess for all commandline calls
Avoid mixing popen and subprocess calls, it simplifies the command line
generation and quoting issues with redirections.
In practice, it fixes the subversion sink on Windows and probably helps
with monotone and darcs sources.
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Fri, 03 Aug 2012 21:37:33 +0200 |
parents | 363e808de349 |
children | 650b5b6e75ed |
comparison
equal
deleted
inserted
replaced
17412:e169b11fa1e0 | 17413:97f1f22c2dba |
---|---|
102 etree = ElementTree() | 102 etree = ElementTree() |
103 # While we are decoding the XML as latin-1 to be as liberal as | 103 # While we are decoding the XML as latin-1 to be as liberal as |
104 # possible, etree will still raise an exception if any | 104 # possible, etree will still raise an exception if any |
105 # non-printable characters are in the XML changelog. | 105 # non-printable characters are in the XML changelog. |
106 parser = XMLParser(encoding='latin-1') | 106 parser = XMLParser(encoding='latin-1') |
107 fp = self._run(cmd, **kwargs) | 107 p = self._run(cmd, **kwargs) |
108 etree.parse(fp, parser=parser) | 108 etree.parse(p.stdout, parser=parser) |
109 self.checkexit(fp.close()) | 109 p.wait() |
110 self.checkexit(p.returncode) | |
110 return etree.getroot() | 111 return etree.getroot() |
111 | 112 |
112 def format(self): | 113 def format(self): |
113 output, status = self.run('show', 'repo', no_files=True, | 114 output, status = self.run('show', 'repo', no_files=True, |
114 repodir=self.path) | 115 repodir=self.path) |