Skip to content

Commit 570e7ec

Browse files
felipecgitster
authored andcommitted
remote-bzr: add support for older versions of bzr
At least as old as 2.0. Signed-off-by: Felipe Contreras <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7edea5c commit 570e7ec

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

contrib/remote-helpers/git-remote-bzr

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
import sys
1818

1919
import bzrlib
20-
bzrlib.initialize()
20+
if hasattr(bzrlib, "initialize"):
21+
bzrlib.initialize()
2122

2223
import bzrlib.plugin
2324
bzrlib.plugin.load_plugins()
@@ -553,7 +554,7 @@ def parse_commit(parser):
553554

554555
repo.lock_write()
555556
try:
556-
builder = repo.get_commit_builder(parents, None, date, tz, committer, props, revid, False)
557+
builder = repo.get_commit_builder(parents, None, date, tz, committer, props, revid)
557558
try:
558559
list(builder.record_iter_changes(mtree, mtree.last_revision(), changes))
559560
builder.finish_inventory()
@@ -612,7 +613,10 @@ def do_export(parser):
612613
if ref == 'refs/heads/master':
613614
repo.generate_revision_history(revid, marks.get_tip('master'))
614615
revno, revid = repo.last_revision_info()
615-
peer.import_last_revision_info_and_tags(repo, revno, revid)
616+
if hasattr(peer, "import_last_revision_info_and_tags"):
617+
peer.import_last_revision_info_and_tags(repo, revno, revid)
618+
else:
619+
peer.import_last_revision_info(repo.repository, revno, revid)
616620
wt = peer.bzrdir.open_workingtree()
617621
wt.update()
618622
print "ok %s" % ref
@@ -646,12 +650,12 @@ def get_repo(url, alias):
646650
global dirname, peer
647651

648652
clone_path = os.path.join(dirname, 'clone')
649-
origin = bzrlib.controldir.ControlDir.open(url)
653+
origin = bzrlib.bzrdir.BzrDir.open(url)
650654
remote_branch = origin.open_branch()
651655

652656
if os.path.exists(clone_path):
653657
# pull
654-
d = bzrlib.controldir.ControlDir.open(clone_path)
658+
d = bzrlib.bzrdir.BzrDir.open(clone_path)
655659
branch = d.open_branch()
656660
result = branch.pull(remote_branch, [], None, False)
657661
else:

0 commit comments

Comments
 (0)