Mercurial > python-hglib
diff hglib/client.py @ 79:ca5f8f43e585
branches: more robust parsing strategy
The right side of output is more strictly defined than the left, so
parse from right to left. This fixes issues with spaces in branch names.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 09 Nov 2011 16:09:46 -0600 |
parents | 15485fa4b35e |
children | 5661d5f7e39b |
line wrap: on
line diff
--- a/hglib/client.py Wed Nov 09 14:07:29 2011 -0600 +++ b/hglib/client.py Wed Nov 09 16:09:46 2011 -0600 @@ -381,8 +381,9 @@ branches = [] for line in out.rstrip().splitlines(): - name, line = line.split(' ', 1) - rev, node = line.split(':') + namerev, node = line.rsplit(':', 1) + name, rev = namerev.rsplit(' ', 1) + name = name.rstrip() node = node.split()[0] # get rid of ' (inactive)' branches.append((name, int(rev), node)) return branches