Mercurial > python-hglib
changeset 54:29d01b5dc38c
client: add bundle command
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Fri, 19 Aug 2011 20:07:56 +0300 |
parents | 066dfa5c0b70 |
children | 5833f6ac0929 |
files | hglib/client.py tests/test-bundle.py |
diffstat | 2 files changed, 33 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hglib/client.py Fri Aug 19 19:47:03 2011 +0300 +++ b/hglib/client.py Fri Aug 19 20:07:56 2011 +0300 @@ -268,6 +268,22 @@ branches.append((name, int(rev), node)) return branches + def bundle(self, file, destrepo=None, rev=[], branch=[], base=[], all=False, + force=False, type=None, ssh=None, remotecmd=None, insecure=False): + """ + create a changegroup file + + Return True if a bundle was created, False if no changes were found. + """ + args = cmdbuilder('bundle', file, destrepo, f=force, r=rev, b=branch, + base=base, a=all, t=type, e=ssh, remotecmd=remotecmd, + insecure=insecure) + + eh = util.reterrorhandler(args) + self.rawcommand(args, eh=eh) + + return bool(eh) + def cat(self, files, rev=None, output=None): args = cmdbuilder('cat', *files, r=rev, o=output) out = self.rawcommand(args)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-bundle.py Fri Aug 19 20:07:56 2011 +0300 @@ -0,0 +1,17 @@ +import common + +class test_bundle(common.basetest): + def test_no_changes(self): + self.append('a', 'a') + rev, node0 = self.client.commit('first', addremove=True) + self.assertFalse(self.client.bundle('bundle', destrepo='.')) + + def test_basic(self): + self.append('a', 'a') + rev, node0 = self.client.commit('first', addremove=True) + self.client.clone(dest='other') + + self.append('a', 'a') + rev, node1 = self.client.commit('second') + + self.assertTrue(self.client.bundle('bundle', destrepo='other'))