Mercurial > python-hglib
comparison 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 |
comparison
equal
deleted
inserted
replaced
78:031cbb8d4f65 | 79:ca5f8f43e585 |
---|---|
379 args = cmdbuilder('branches', a=active, c=closed) | 379 args = cmdbuilder('branches', a=active, c=closed) |
380 out = self.rawcommand(args) | 380 out = self.rawcommand(args) |
381 | 381 |
382 branches = [] | 382 branches = [] |
383 for line in out.rstrip().splitlines(): | 383 for line in out.rstrip().splitlines(): |
384 name, line = line.split(' ', 1) | 384 namerev, node = line.rsplit(':', 1) |
385 rev, node = line.split(':') | 385 name, rev = namerev.rsplit(' ', 1) |
386 name = name.rstrip() | |
386 node = node.split()[0] # get rid of ' (inactive)' | 387 node = node.split()[0] # get rid of ' (inactive)' |
387 branches.append((name, int(rev), node)) | 388 branches.append((name, int(rev), node)) |
388 return branches | 389 return branches |
389 | 390 |
390 def bundle(self, file, destrepo=None, rev=[], branch=[], base=[], all=False, | 391 def bundle(self, file, destrepo=None, rev=[], branch=[], base=[], all=False, |