changeset 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 031cbb8d4f65
children 009e7858a93b
files hglib/client.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
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