diff options
author | Felipe Contreras <felipe.contreras@gmail.com> | 2012-11-11 15:19:54 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-11-28 09:39:11 -0800 |
commit | dc2177c21c249460bf9c809ac248ca588bc3b988 (patch) | |
tree | 9bad0ed67baa2bbbcef656b1992ade9e1289176a /contrib | |
parent | f04977168f520a50b51794c17b443e256a61b4ec (diff) | |
download | git-dc2177c21c249460bf9c809ac248ca588bc3b988.tar.gz git-dc2177c21c249460bf9c809ac248ca588bc3b988.tar.xz |
remote-bzr: add support for remote repositories
Strictly speaking bzr doesn't need any changes to interact with remote
repositories, but it's dead slow.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/remote-helpers/git-remote-bzr | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/contrib/remote-helpers/git-remote-bzr b/contrib/remote-helpers/git-remote-bzr index 8366234ca..2c05f35ef 100755 --- a/contrib/remote-helpers/git-remote-bzr +++ b/contrib/remote-helpers/git-remote-bzr @@ -546,7 +546,7 @@ def parse_reset(parser): parsed_refs[ref] = mark_to_rev(from_mark) def do_export(parser): - global parsed_refs, dirname + global parsed_refs, dirname, peer parser.next() @@ -569,6 +569,8 @@ def do_export(parser): for ref, revid in parsed_refs.iteritems(): if ref == 'refs/heads/master': repo.generate_revision_history(revid, marks.get_tip('master')) + revno, revid = repo.last_revision_info() + peer.import_last_revision_info_and_tags(repo, revno, revid) print "ok %s" % ref print @@ -597,8 +599,28 @@ def do_list(parser): print def get_repo(url, alias): + global dirname, peer + + clone_path = os.path.join(dirname, 'clone') origin = bzrlib.controldir.ControlDir.open(url) - return origin.open_branch() + remote_branch = origin.open_branch() + + if os.path.exists(clone_path): + # pull + d = bzrlib.controldir.ControlDir.open(clone_path) + branch = d.open_branch() + result = branch.pull(remote_branch, [], None, False) + else: + # clone + d = origin.sprout(clone_path, None, + hardlink=True, create_tree_if_local=False, + source_branch=remote_branch) + branch = d.open_branch() + branch.bind(remote_branch) + + peer = remote_branch + + return branch def main(args): global marks, prefix, dirname |