From: Felipe Contreras <felipe.contreras@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH v2 4/5] remote-bzr: add support for remote repositories
Date: Mon, 5 Nov 2012 16:56:19 +0100 [thread overview]
Message-ID: <1352130980-3998-5-git-send-email-felipe.contreras@gmail.com> (raw)
In-Reply-To: <1352130980-3998-1-git-send-email-felipe.contreras@gmail.com>
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>
---
contrib/remote-helpers/git-remote-bzr | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/contrib/remote-helpers/git-remote-bzr b/contrib/remote-helpers/git-remote-bzr
index 9e0062f..c981fda 100755
--- a/contrib/remote-helpers/git-remote-bzr
+++ b/contrib/remote-helpers/git-remote-bzr
@@ -547,7 +547,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()
@@ -570,6 +570,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
@@ -598,8 +600,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
--
1.8.0
next prev parent reply other threads:[~2012-11-05 15:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-05 15:56 [PATCH v2 0/5] New remote-bzr remote helper Felipe Contreras
2012-11-05 15:56 ` [PATCH v2 1/5] Add new remote-bzr transport helper Felipe Contreras
2012-11-05 15:56 ` [PATCH v2 2/5] remote-bzr: add simple tests Felipe Contreras
2012-11-05 15:56 ` [PATCH v2 3/5] remote-bzr: add support for pushing Felipe Contreras
2012-11-05 15:56 ` Felipe Contreras [this message]
2012-11-05 15:56 ` [PATCH v2 5/5] remote-bzr: update working tree Felipe Contreras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1352130980-3998-5-git-send-email-felipe.contreras@gmail.com \
--to=felipe.contreras@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox