# HG changeset patch # User Idan Kamara # Date 1313773676 -10800 # Node ID 29d01b5dc38ccab0b34f2c563923908ac75b4b5f # Parent 066dfa5c0b702d8acb6d75e91c69bfb49072d785 client: add bundle command diff -r 066dfa5c0b70 -r 29d01b5dc38c hglib/client.py --- 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) diff -r 066dfa5c0b70 -r 29d01b5dc38c tests/test-bundle.py --- /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'))