Merge lp:~jelmer/bzr-svn/sprout into lp:bzr-svn/1.1

Proposed by Jelmer Vernooij on 2011-03-23
Status: Merged
Merged at revision: 3650
Proposed branch: lp:~jelmer/bzr-svn/sprout
Merge into: lp:bzr-svn/1.1
Diff against target: 96 lines (+39/-5)
3 files modified
NEWS (+3/-0)
fetch.py (+3/-3)
remote.py (+33/-2)
To merge this branch: bzr merge lp:~jelmer/bzr-svn/sprout
Reviewer Review Type Date Requested Status
bzr-svn developers 2011-03-23 Pending
Review via email: mp+54601@code.launchpad.net

Description of the change

Provide custom ControlDir.sprout() implementation - fixes compatibility with bzr 2.4.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2011-03-22 13:04:38 +0000
3+++ NEWS 2011-03-23 20:45:59 +0000
4@@ -64,6 +64,9 @@
5
6 * Transport.is_readonly() is now respected. (Jelmer Vernooij, #731268)
7
8+ * Fix ControlDir.sprout() implementation for newer versions of bzr.
9+ (Jelmer Vernooij, #717937)
10+
11 FEATURES
12
13 * When roundtripping revisions a revision property with the Bazaar testament is
14
15=== modified file 'fetch.py'
16--- fetch.py 2011-02-17 17:38:50 +0000
17+++ fetch.py 2011-03-23 20:45:59 +0000
18@@ -1522,7 +1522,8 @@
19 return revisionfinder.get_missing()
20
21 def fetch(self, revision_id=None, pb=None, find_ghosts=False,
22- needed=None, mapping=None, project=None, fetch_spec=None):
23+ needed=None, mapping=None, project=None, fetch_spec=None,
24+ target_is_empty=False):
25 """Fetch revisions. """
26 if revision_id == NULL_REVISION:
27 return
28@@ -1539,8 +1540,7 @@
29 if needed is None:
30 nested_pb = ui.ui_factory.nested_progress_bar()
31 try:
32- # FIXME: Specify target_is_empty
33- needed = self._get_needed(target_is_empty=False,
34+ needed = self._get_needed(target_is_empty=target_is_empty,
35 revision_id=revision_id, fetch_spec=fetch_spec,
36 find_ghosts=find_ghosts, project=project,
37 pb=nested_pb)
38
39=== modified file 'remote.py'
40--- remote.py 2011-03-23 18:01:26 +0000
41+++ remote.py 2011-03-23 20:45:59 +0000
42@@ -40,6 +40,7 @@
43 )
44 from bzrlib.transport import (
45 do_catching_redirections,
46+ get_transport,
47 )
48
49
50@@ -202,14 +203,44 @@
51 """
52 raise NotImplementedError(SvnRemoteAccess.clone)
53
54- def sprout(self, *args, **kwargs):
55+ def sprout(self, url, revision_id=None, force_new_repo=False,
56+ recurse='down', possible_transports=None,
57+ accelerator_tree=None, hardlink=False, stacked=False,
58+ source_branch=None, create_tree_if_local=True):
59+ from bzrlib.repository import InterRepository
60+ from bzrlib.transport.local import LocalTransport
61 if self.branch_path == "":
62 guessed_layout = self.find_repository().get_guessed_layout()
63 if guessed_layout is not None and not guessed_layout.is_branch(""):
64 trace.warning('Cloning Subversion repository as branch. '
65 'To import the individual branches in the repository, '
66 'use "bzr svn-import".')
67- return super(SvnRemoteAccess, self).sprout(*args, **kwargs)
68+ target_transport = get_transport(url, possible_transports)
69+ target_transport.ensure_base()
70+ cloning_format = self.cloning_metadir()
71+ # Create/update the result branch
72+ result = cloning_format.initialize_on_transport(target_transport)
73+ source_branch = self.open_branch()
74+ source_repository = self.find_repository()
75+ try:
76+ result_repo = result.find_repository()
77+ except errors.NoRepositoryPresent:
78+ result_repo = result.create_repository()
79+ target_is_empty = True
80+ else:
81+ target_is_empty = None # Unknown
82+ if stacked:
83+ raise errors.IncompatibleRepositories(source_repository, result_repo)
84+ interrepo = InterRepository.get(source_repository, result_repo)
85+ interrepo.fetch(revision_id=revision_id,
86+ project=source_branch.project, mapping=source_branch.mapping)
87+ result_branch = source_branch.sprout(result,
88+ revision_id=revision_id, repository=result_repo)
89+ if (create_tree_if_local and isinstance(target_transport, LocalTransport)
90+ and (result_repo is None or result_repo.make_working_trees())):
91+ result.create_workingtree(accelerator_tree=accelerator_tree,
92+ hardlink=hardlink, from_branch=result_branch)
93+ return result
94
95 def is_control_filename(self, path):
96 # Bare, so anything is a control file

Subscribers

People subscribed via source and target branches