Rev 1899: Move layout guess functions to layout.guess. in file:///data/jelmer/bzr-svn/trunk/
Jelmer Vernooij
jelmer at samba.org
Wed Sep 10 17:19:32 BST 2008
At file:///data/jelmer/bzr-svn/trunk/
------------------------------------------------------------
revno: 1899
revision-id: jelmer at samba.org-20080910161915-11n0289lg72ocwke
parent: jelmer at samba.org-20080909212551-5ar93j5yvuj4coyk
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Wed 2008-09-10 18:19:15 +0200
message:
Move layout guess functions to layout.guess.
modified:
layout/guess.py guess.py-20080909185308-vfoi9po1pzy6u4le-1
mapping.py mapping.py-20080128201303-6cp01phc0dmc0kiv-1
mapping3/scheme.py scheme.py-20060516195850-95181aae6b272f9e
=== modified file 'layout/guess.py'
--- a/layout/guess.py 2008-09-09 18:53:33 +0000
+++ b/layout/guess.py 2008-09-10 16:19:15 +0000
@@ -15,6 +15,27 @@
from bzrlib.plugins.svn.layout.standard import TrunkLayout
+def find_commit_paths(changed_paths):
+ """Find the commit-paths used in a bunch of revisions.
+
+ :param changed_paths: List of changed_paths (dictionary with path -> action)
+ :return: List of potential commit paths.
+ """
+ for changes in changed_paths:
+ yield _find_common_prefix(changes.keys())
+
+
+def _find_common_prefix(paths):
+ prefix = ""
+ # Find a common prefix
+ parts = paths[0].split("/")
+ for i in range(len(parts)+1):
+ for j in paths:
+ if j.split("/")[:i] != parts[:i]:
+ return prefix
+ prefix = "/".join(parts[:i])
+ return prefix
+
def repository_guess_layout(repository, revnum):
# FIXME
return TrunkLayout(), TrunkLayout()
=== modified file 'mapping.py'
--- a/mapping.py 2008-09-09 18:09:35 +0000
+++ b/mapping.py 2008-09-10 16:19:15 +0000
@@ -723,7 +723,7 @@
mapping_registry.register_lazy('v4', 'bzrlib.plugins.svn.mapping4',
'BzrSvnMappingv4',
'Fourth format (bzr-svn 0.5.x)')
-mapping_registry.set_default('v4')
+mapping_registry.set_default('v3')
def find_mapping(revprops, fileprops):
=== modified file 'mapping3/scheme.py'
--- a/mapping3/scheme.py 2008-09-09 18:53:33 +0000
+++ b/mapping3/scheme.py 2008-09-10 16:19:15 +0000
@@ -20,6 +20,7 @@
from bzrlib.trace import mutter
from base64 import urlsafe_b64decode, urlsafe_b64encode
+from bzrlib.plugins.svn.layout.guess import find_commit_paths
from bzrlib.plugins.svn.layout.standard import TrunkLayout, RootLayout, CustomLayout
from bzrlib.plugins.svn.errors import InvalidSvnBranchPath, LayoutUnusable
from bzrlib.plugins.svn import properties
@@ -412,28 +413,6 @@
return "single-%s" % self.path
-def _find_common_prefix(paths):
- prefix = ""
- # Find a common prefix
- parts = paths[0].split("/")
- for i in range(len(parts)+1):
- for j in paths:
- if j.split("/")[:i] != parts[:i]:
- return prefix
- prefix = "/".join(parts[:i])
- return prefix
-
-
-def find_commit_paths(changed_paths):
- """Find the commit-paths used in a bunch of revisions.
-
- :param changed_paths: List of changed_paths (dictionary with path -> action)
- :return: List of potential commit paths.
- """
- for changes in changed_paths:
- yield _find_common_prefix(changes.keys())
-
-
def guess_scheme_from_branch_path(relpath):
"""Try to guess the branching scheme from a branch path.
@@ -572,4 +551,6 @@
The branching scheme bzr-svn should use for a repository can be set in the
configuration file ~/.bazaar/subversion.conf.
+
+Branching schemes are only used for version 3 of the Bzr<->Svn mappings.
"""
More information about the bazaar-commits
mailing list