Rev 991: Remove more uses of schemes inside the main code. in file:///data/jelmer/bzr-svn/layout/
Jelmer Vernooij
jelmer at samba.org
Fri May 2 20:36:01 BST 2008
At file:///data/jelmer/bzr-svn/layout/
------------------------------------------------------------
revno: 991
revision-id: jelmer at samba.org-20080502193600-gdwwchgznph0y37c
parent: jelmer at samba.org-20080502190723-sb0pvaduzeep7f2q
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: layout
timestamp: Fri 2008-05-02 21:36:00 +0200
message:
Remove more uses of schemes inside the main code.
modified:
__init__.py __init__.py-20051008155114-eae558e6cf149e1d
branch.py svnbranch.py-20051017135706-11c749eb0dab04a7
convert.py svn2bzr.py-20051018015439-cb4563bff29e632d
errors.py errors.py-20061226172623-w1sbj8ynpo0eojqp-1
fetch.py fetch.py-20060625004942-x2lfaib8ra707a8p-1
fileids.py fileids.py-20060714013623-u5iiyqqnko11grcf-1
mapping.py mapping.py-20080128201303-6cp01phc0dmc0kiv-1
mapping3/__init__.py __init__.py-20080502174630-9324zh25kka98vlw-1
repository.py repository.py-20060306123302-1f8c5069b3fe0265
=== modified file '__init__.py'
--- a/__init__.py 2008-05-02 18:37:05 +0000
+++ b/__init__.py 2008-05-02 19:36:00 +0000
@@ -99,7 +99,7 @@
register_lazy_transport('svn+', 'bzrlib.plugins.svn.transport',
'SvnRaTransport')
topic_registry.register_lazy('svn-branching-schemes',
- 'bzrlib.plugins.svn.scheme',
+ 'bzrlib.plugins.svn.mapping3.scheme',
'help_schemes', 'Subversion branching schemes')
BzrDirFormat.register_control_format(format.SvnRemoteFormat)
=== modified file 'branch.py'
--- a/branch.py 2008-05-02 12:30:29 +0000
+++ b/branch.py 2008-05-02 19:36:00 +0000
@@ -84,7 +84,7 @@
raise NotBranchError(self.base)
raise
if not self.mapping.is_branch(branch_path):
- raise NotSvnBranchPath(branch_path, scheme=self.mapping.scheme)
+ raise NotSvnBranchPath(branch_path, mapping=self.mapping)
def set_branch_path(self, branch_path):
"""Change the branch path for this branch.
@@ -161,7 +161,7 @@
:raises NoSuchRevision: If the revision id was not found.
"""
(bp, revnum, mapping) = self.repository.lookup_revision_id(revid,
- scheme=self.mapping.scheme)
+ ancestry=(self.get_branch_path(), self.get_revnum()))
assert bp.strip("/") == self.get_branch_path(revnum).strip("/"), \
"Got %r, expected %r" % (bp, self.get_branch_path(revnum))
return revnum
=== modified file 'convert.py'
--- a/convert.py 2008-05-02 16:15:47 +0000
+++ b/convert.py 2008-05-02 19:36:00 +0000
@@ -80,7 +80,7 @@
return repos
-def convert_repository(source_repos, output_url, scheme=None,
+def convert_repository(source_repos, output_url, layout=None,
create_shared_repo=True, working_trees=False, all=False,
format=None, filter_branch=None):
"""Convert a Subversion repository and its' branches to a
@@ -88,7 +88,7 @@
:param source_repos: Subversion repository
:param output_url: URL to write Bazaar repository to.
- :param scheme: Branching scheme (object) to use
+ :param layout: Repository layout (object) to use
:param create_shared_repo: Whether to create a shared Bazaar repository
:param working_trees: Whether to create working trees
:param all: Whether old revisions, even those not part of any existing
@@ -111,10 +111,10 @@
dirs[path] = format.initialize_on_transport(nt)
return dirs[path]
- if scheme is not None:
- source_repos.set_branching_scheme(scheme)
-
- layout = source_repos.get_layout()
+ if layout is not None:
+ source_repos.set_layout(layout)
+ else:
+ layout = source_repos.get_layout()
if create_shared_repo:
try:
=== modified file 'errors.py'
--- a/errors.py 2008-03-24 04:52:30 +0000
+++ b/errors.py 2008-05-02 19:36:00 +0000
@@ -36,9 +36,9 @@
_fmt = """%(path)s is not a valid Subversion branch path.
See 'bzr help svn-branching-schemes' for details."""
- def __init__(self, branch_path, scheme=None):
+ def __init__(self, branch_path, mapping=None):
NotBranchError.__init__(self, urllib.quote(branch_path))
- self.scheme = scheme
+ self.mapping = mapping
class InvalidSvnBranchPath(NotBranchError):
=== modified file 'fetch.py'
--- a/fetch.py 2008-05-02 19:07:23 +0000
+++ b/fetch.py 2008-05-02 19:36:00 +0000
@@ -30,13 +30,12 @@
from bzrlib.plugins.svn.errors import InvalidFileName
from logwalker import lazy_dict
-from bzrlib.plugins.svn.mapping import (SVN_PROP_BZR_ANCESTRY, SVN_PROP_BZR_MERGE,
+from bzrlib.plugins.svn.mapping import (SVN_PROP_BZR_MERGE,
SVN_PROP_BZR_PREFIX, SVN_PROP_BZR_REVISION_INFO,
SVN_PROP_BZR_REVISION_ID,
SVN_PROP_BZR_FILEIDS, SVN_REVPROP_BZR_SIGNATURE,
parse_merge_property,
parse_revision_metadata)
-from bzrlib.plugins.svn.mapping3 import SVN_PROP_BZR_BRANCHING_SCHEME
from repository import SvnRepository, SvnRepositoryFormat
from svk import SVN_PROP_SVK_MERGE
from tree import (apply_txdelta_handler, parse_externals_description,
@@ -107,8 +106,6 @@
self._id_map = None
self.dir_baserev = {}
self._revinfo = None
- self._bzr_merges = ()
- self._svk_merges = []
self._premature_deletes = set()
self.pool = Pool()
self.old_inventory = prev_inventory
@@ -277,37 +274,16 @@
self._branch_fileprops = {}
self._branch_fileprops[name] = value
- if name == SVN_PROP_BZR_BRANCHING_SCHEME:
- if new_id != self.inventory.root.file_id:
- mutter('rogue %r on non-root directory' % name)
- return
- elif name == SVN_PROP_BZR_ANCESTRY+str(self.mapping.scheme):
- if new_id != self.inventory.root.file_id:
- mutter('rogue %r on non-root directory' % name)
- return
-
- self._bzr_merges = parse_merge_property(value.splitlines()[-1])
- elif name == SVN_PROP_SVK_MERGE:
- self._svk_merges = None # Force Repository.revision_parents() to look it up
- elif name == SVN_PROP_BZR_REVISION_INFO:
- if new_id != self.inventory.root.file_id:
- mutter('rogue %r on non-root directory' % SVN_PROP_BZR_REVISION_INFO)
- return
-
- elif name in (svn.core.SVN_PROP_ENTRY_COMMITTED_DATE,
+ if name in (svn.core.SVN_PROP_ENTRY_COMMITTED_DATE,
svn.core.SVN_PROP_ENTRY_COMMITTED_REV,
svn.core.SVN_PROP_ENTRY_LAST_AUTHOR,
svn.core.SVN_PROP_ENTRY_LOCK_TOKEN,
svn.core.SVN_PROP_ENTRY_UUID,
- svn.core.SVN_PROP_EXECUTABLE,
- SVN_PROP_BZR_MERGE, SVN_PROP_BZR_FILEIDS):
- pass
- elif (name.startswith(SVN_PROP_BZR_ANCESTRY) or
- name.startswith(SVN_PROP_BZR_REVISION_ID) or
- name.startswith(svn.core.SVN_PROP_WC_PREFIX)):
- pass
- elif (name.startswith(svn.core.SVN_PROP_PREFIX) or
- name.startswith(SVN_PROP_BZR_PREFIX)):
+ svn.core.SVN_PROP_EXECUTABLE):
+ pass
+ elif (name.startswith(svn.core.SVN_PROP_WC_PREFIX)):
+ pass
+ elif name.startswith(svn.core.SVN_PROP_PREFIX):
mutter('unsupported dir property %r' % name)
def change_file_prop(self, id, name, value, pool):
@@ -538,7 +514,7 @@
def _get_repo_format_to_test():
return None
- def _find_all(self):
+ def _find_all(self, mapping):
"""Find all revisions from the source repository that are not
yet in the target repository.
"""
@@ -549,7 +525,7 @@
available_revs = set()
pb = ui.ui_factory.nested_progress_bar()
try:
- for (revnum, bp, mapping, changes, revprops) in self.source.iter_all_changes(pb=pb):
+ for (revnum, bp, changes, revprops) in self.source.iter_all_changes(pb=pb):
revid = self.source.generate_revision_id(revnum, bp, mapping, revprops)
available_revs.add(revid)
revprops_map[revid] = revprops
@@ -725,7 +701,7 @@
if branches is not None:
needed = self._find_branches(branches, find_ghosts, fetch_rhs_ancestry)
elif revision_id is None:
- needed = self._find_all()
+ needed = self._find_all(self.source.get_mapping())
else:
needed = self._find_until(revision_id, find_ghosts, fetch_rhs_ancestry)
finally:
=== modified file 'fileids.py'
--- a/fileids.py 2008-05-02 18:48:10 +0000
+++ b/fileids.py 2008-05-02 19:36:00 +0000
@@ -131,7 +131,7 @@
todo = []
next_parent_revs = []
- if mapping.scheme.is_branch(""):
+ if mapping.is_branch(""):
map = {u"": (mapping.generate_file_id(uuid, 0, "", u""), NULL_REVISION)}
else:
map = {}
@@ -243,7 +243,7 @@
return map
if len(next_parent_revs) == 0:
- if mapping.scheme.is_branch(""):
+ if mapping.is_branch(""):
map = {u"": (mapping.generate_file_id(uuid, 0, "", u""), NULL_REVISION)}
else:
map = {}
=== modified file 'mapping.py'
--- a/mapping.py 2008-05-02 19:07:23 +0000
+++ b/mapping.py 2008-05-02 19:36:00 +0000
@@ -44,7 +44,6 @@
SVN_REVPROP_BZR_REVNO = 'bzr:revno'
SVN_REVPROP_BZR_REVPROP_PREFIX = 'bzr:revprop:'
SVN_REVPROP_BZR_ROOT = 'bzr:root'
-SVN_REVPROP_BZR_SCHEME = 'bzr:scheme'
SVN_REVPROP_BZR_SIGNATURE = 'bzr:gpg-signature'
SVN_REVPROP_BZR_TIMESTAMP = 'bzr:timestamp'
SVN_REVPROP_BZR_LOG = 'bzr:log'
=== modified file 'mapping3/__init__.py'
--- a/mapping3/__init__.py 2008-05-02 19:07:23 +0000
+++ b/mapping3/__init__.py 2008-05-02 19:36:00 +0000
@@ -16,7 +16,9 @@
from bzrlib import osutils, ui
from bzrlib.trace import mutter
from bzrlib.plugins.svn import mapping
-from mapping3.scheme import BranchingScheme, guess_scheme_from_branch_path, guess_scheme_from_history
+from mapping3.scheme import (BranchingScheme, guess_scheme_from_branch_path,
+ guess_scheme_from_history, ListBranchingScheme,
+ parse_list_scheme_text)
SVN_PROP_BZR_BRANCHING_SCHEME = 'bzr:branching-scheme'
=== modified file 'repository.py'
--- a/repository.py 2008-05-02 19:07:23 +0000
+++ b/repository.py 2008-05-02 19:36:00 +0000
@@ -47,8 +47,6 @@
get_default_mapping, parse_revision_id)
from bzrlib.plugins.svn.mapping3 import BzrSvnMappingv3FileProps
from revids import CachingRevidMap, RevidMap
-from mapping3.scheme import (ListBranchingScheme,
- parse_list_scheme_text, guess_scheme_from_history)
from svk import (SVN_PROP_SVK_MERGE, svk_features_merged_since,
parse_svk_feature)
from tree import SvnRevisionTree
@@ -237,9 +235,9 @@
return self.fileid_map.apply_changes(uuid, revnum, branch, changes,
renames, mapping)[0]
- def iter_all_changes(self, mapping=None, pb=None):
- if mapping is None:
- mapping = self.get_mapping()
+ def iter_all_changes(self, layout=None, pb=None):
+ if layout is None:
+ layout = self.get_layout()
latest_revnum = self.get_latest_revnum()
@@ -249,17 +247,21 @@
yielded_paths = set()
for p in paths:
try:
- bp = mapping.scheme.unprefix(p)[0]
+ bp = mapping.parse(p)[0]
if not bp in yielded_paths:
if not paths.has_key(bp) or paths[bp][0] != 'D':
assert revnum > 0 or bp == ""
yielded_paths.add(bp)
- yield (revnum, bp, mapping, paths, revprops)
+ yield (revnum, bp, paths, revprops)
except NotBranchError:
pass
- def all_revision_ids(self, mapping=None):
- for (revnum, bp, mapping, changes, revprops) in self.iter_all_changes(mapping):
+ def all_revision_ids(self, layout=None, mapping=None):
+ if mapping is None:
+ mapping = self.get_mapping()
+ if layout is None:
+ layout = self.get_layout()
+ for (revnum, bp, changes, revprops) in self.iter_all_changes(layout):
yield self.generate_revision_id(revnum, bp, mapping, revprops)
def get_inventory_weave(self):
@@ -609,7 +611,7 @@
graph = self.get_graph()
if revision_id is None:
- revision_ids = self.all_revision_ids(self.get_mapping())
+ revision_ids = self.all_revision_ids(self.get_layout(), self.get_mapping())
else:
revision_ids = [revision_id]
More information about the bazaar-commits
mailing list