# HG changeset patch # User Matt Mackall # Date 1320876586 21600 # Node ID ca5f8f43e585b00c477c00a0d02804d5c9e06714 # Parent 031cbb8d4f65d762d363f61d4ea08a572d2d9305 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. diff -r 031cbb8d4f65 -r ca5f8f43e585 hglib/client.py --- 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