Mercurial > python-hglib
diff hglib/client.py @ 12:c2a9b716cd80
client: rewrite branches(), return a list of (branchname, rev, node)
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Wed, 10 Aug 2011 00:24:01 +0300 |
parents | 0549d00a617d |
children | 400cb1520834 |
line wrap: on
line diff
--- a/hglib/client.py Wed Aug 10 00:21:05 2011 +0300 +++ b/hglib/client.py Wed Aug 10 00:24:01 2011 +0300 @@ -156,13 +156,16 @@ # len('reset working directory to branch ') == 34 return out[34:] - def branches(self): - out = self.rawcommand(['branches']) - branches = {} - for line in out.rstrip().split('\n'): - branch, revnode = line.split() - branches[branch] = self.log(revrange=[revnode.split(':')[0]])[0] + def branches(self, active=False, closed=False): + args = cmdbuilder('branches', a=active, c=closed) + out = self.rawcommand(args) + branches = [] + for line in out.rstrip().splitlines(): + name, line = line.split(' ', 1) + rev, node = line.split(':') + node = node.split()[0] # get rid of ' (inactive)' + branches.append((name, int(rev), node)) return branches def cat(self, files, rev=None, output=None):