Mercurial > python-hglib
diff hglib/client.py @ 171:2725547a5f92 2.0
commit: allow rev and node to be anywhere in the output
a01d3d32b53a in hg changed the output of commit --debug so the committed
changeset isn't necessarily the last line.
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Thu, 31 Dec 2015 16:53:51 -0800 |
parents | e6589149b2c8 |
children | c16e2087660f |
line wrap: on
line diff
--- a/hglib/client.py Thu Oct 01 12:38:14 2015 -0500 +++ b/hglib/client.py Thu Dec 31 16:53:51 2015 -0800 @@ -568,8 +568,12 @@ close_branch=closebranch, d=date, u=user, l=logfile, I=include, X=exclude, amend=amend) out = self.rawcommand(args) - rev, node = out.splitlines()[-1].rsplit(b(':')) - return int(rev.split()[-1]), node + m = re.search(b(r'^committed changeset (\d+):([0-9a-f]+)'), out, + re.MULTILINE) + if not m: + raise ValueError('revision and node not found in hg output: %r' % out) + rev, node = m.groups() + return int(rev), node def config(self, names=[], untrusted=False, showsource=False): """Return a list of (section, key, value) config settings from all