Mercurial > python-hglib
diff hglib/client.py @ 11:0549d00a617d
client: add missing options to branch()
and add some more tests
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Wed, 10 Aug 2011 00:21:05 +0300 |
parents | fce3102c19e5 |
children | c2a9b716cd80 |
line wrap: on
line diff
--- a/hglib/client.py Tue Aug 09 23:24:40 2011 +0300 +++ b/hglib/client.py Wed Aug 10 00:21:05 2011 +0300 @@ -141,9 +141,20 @@ self.server = None return ret - def branch(self, name=None): - if not name: - return self.rawcommand(['branch']).rstrip() + def branch(self, name=None, clean=False, force=False): + if name and clean: + raise ValueError('cannot use both name and clean') + + args = cmdbuilder('branch', name, f=force, C=clean) + out = self.rawcommand(args).rstrip() + + if name: + return name + elif not clean: + return out + else: + # len('reset working directory to branch ') == 34 + return out[34:] def branches(self): out = self.rawcommand(['branches'])