Rev 1751: Remove mapping.unprefix() - this is now the job of RepositoryLayout. in file:///data/jelmer/bzr-svn/trunk/

Jelmer Vernooij jelmer at samba.org
Mon Sep 1 14:22:48 BST 2008


At file:///data/jelmer/bzr-svn/trunk/

------------------------------------------------------------
revno: 1751
revision-id: jelmer at samba.org-20080901132231-mgno9a1impoctzid
parent: jelmer at samba.org-20080901022315-j0h5p5aw8x0admwi
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Mon 2008-09-01 15:22:31 +0200
message:
  Remove mapping.unprefix() - this is now the job of RepositoryLayout.
modified:
  TODO                           todo-20060729211917-2kpobww0zyvvo0j2-1
  __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
  fileids.py                     fileids.py-20060714013623-u5iiyqqnko11grcf-1
  layout.py                      layout.py-20080323165407-y9qw8nx4oykvoe1k-1
  mapping.py                     mapping.py-20080128201303-6cp01phc0dmc0kiv-1
  mapping3/__init__.py           __init__.py-20080502174630-9324zh25kka98vlw-1
  mapping3/scheme.py             scheme.py-20060516195850-95181aae6b272f9e
  repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
  revids.py                      revids.py-20070416220458-36vfa0730cchevp1-1
=== modified file 'TODO'
--- a/TODO	2008-09-01 02:23:15 +0000
+++ b/TODO	2008-09-01 13:22:31 +0000
@@ -1,6 +1,8 @@
 mappingv4:
  - implement layout functions, including command
  - allow skipping a revision completely - to allow creating branches using "svn cp"
+ - create schemes from layouts rather than the other way around
+  + remove Mapping.get_guessed_layout()
 
 - generate deltas rather than fulltexts when creating file id maps
 - transform file ids in workingtree in svn-upgrade

=== modified file '__init__.py'
--- a/__init__.py	2008-08-31 18:31:26 +0000
+++ b/__init__.py	2008-09-01 13:22:31 +0000
@@ -30,7 +30,7 @@
 For more information about bzr-svn, see the bzr-svn FAQ.
 
 """
-import bzrlib
+import bzrlib, bzrlib.repository
 from bzrlib import log
 from bzrlib.bzrdir import BzrDirFormat, format_registry
 from bzrlib.errors import BzrError
@@ -128,7 +128,7 @@
 
 check_subversion_version()
 
-from bzrlib.plugins.svn import format, revspec
+from bzrlib.plugins.svn import format, revspec, repository
 
 register_transport_proto('svn+ssh://', 
     help="Access using the Subversion smart server tunneled over SSH.")
@@ -157,6 +157,7 @@
                          "Subversion working copy. ", 
                          native=False, hidden=True)
 SPEC_TYPES.append(revspec.RevisionSpec_svn)
+bzrlib.repository.SvnRepositoryFormat = repository.SvnRepositoryFormat
 
 log.properties_handler_registry.register_lazy("subversion",
                                               "bzrlib.plugins.svn.log",

=== modified file 'fileids.py'
--- a/fileids.py	2008-08-25 01:58:11 +0000
+++ b/fileids.py	2008-09-01 13:22:31 +0000
@@ -120,7 +120,7 @@
         :param renames: List of renames (known file ids for particular paths)
         :param mapping: Mapping
         """
-        renames = mapping.import_fileid_map(revmeta.revprops, revmeta.fileprops)
+        renames = revmeta.get_fileid_map(mapping)
         assert revmeta.paths is not None
         changes = get_local_changes(revmeta.paths, revmeta.branch_path, mapping,
                     self.repos.get_layout(),
@@ -129,7 +129,7 @@
             def get_children(path, revid):
                 (bp, revnum, mapping) = self.repos.lookup_revision_id(revid)
                 for p in find_children(bp+"/"+path, revnum):
-                    yield mapping.unprefix(bp, p)
+                    yield p[len(bp):].strip("/")
         else:
             get_children = None
 

=== modified file 'layout.py'
--- a/layout.py	2008-08-31 15:56:28 +0000
+++ b/layout.py	2008-09-01 13:22:31 +0000
@@ -25,6 +25,7 @@
 
     def __init__(self, repository):
         self.repository = repository
+        self._config = repository.get_config()
 
     def get_tag_path(self, name, project=""):
         """Return the path at which the tag with specified name should be found.
@@ -159,6 +160,7 @@
         :return: Tuple with type ('tag', 'branch'), project name, branch path and path 
             inside the branch
         """
+        assert isinstance(path, str)
         parts = path.split("/")
         for i, p in enumerate(parts):
             if (i > 0 and parts[i-1] in ("branches", "tags")) or p == "trunk":

=== modified file 'mapping.py'
--- a/mapping.py	2008-08-31 17:34:49 +0000
+++ b/mapping.py	2008-09-01 13:22:31 +0000
@@ -433,9 +433,6 @@
     def get_revision_id(self, branch_path, revprops, fileprops):
         raise NotImplementedError(self.get_revision_id)
 
-    def unprefix(self, branch_path, repos_path):
-        raise NotImplementedError(self.unprefix)
-
 
 class BzrSvnMappingv1(BzrSvnMapping):
     """This was the initial version of the mappings as used by bzr-svn
@@ -712,7 +709,7 @@
 mapping_registry.register_lazy('v4', 'bzrlib.plugins.svn.mapping4', 
                                'BzrSvnMappingv4',
                                'Fourth format (bzr-svn 0.5.x)')
-mapping_registry.set_default('v3')
+mapping_registry.set_default('v4')
 
 def parse_mapping_name(name):
     assert isinstance(name, str)

=== modified file 'mapping3/__init__.py'
--- a/mapping3/__init__.py	2008-08-31 15:31:04 +0000
+++ b/mapping3/__init__.py	2008-09-01 13:22:31 +0000
@@ -267,11 +267,6 @@
     def revision_id_foreign_to_bzr(self, (uuid, revnum, path)):
         return self._generate_revision_id(uuid, revnum, path, self.scheme)
 
-    def unprefix(self, branch_path, repos_path):
-        (proj, bp, np) = self.scheme.unprefix(repos_path)
-        assert branch_path == bp
-        return np
-
     def __eq__(self, other):
         return type(self) == type(other) and self.scheme == other.scheme
 

=== modified file 'mapping3/scheme.py'
--- a/mapping3/scheme.py	2008-08-26 12:15:28 +0000
+++ b/mapping3/scheme.py	2008-09-01 13:22:31 +0000
@@ -536,6 +536,14 @@
     return ListBranchingScheme(branch_list) 
 
 
+def scheme_from_layout(layout):
+    if isinstance(layout, TrunkLayout):
+        return TrunkBranchingScheme()
+    if isinstance(layout, RootLayout):
+        return NoBranchingScheme()
+    return TrunkBranchingScheme()
+
+
 help_schemes = """Subversion Branching Schemes
 
 Subversion is basically a versioned file system. It does not have 

=== modified file 'repository.py'
--- a/repository.py	2008-09-01 02:23:15 +0000
+++ b/repository.py	2008-09-01 13:22:31 +0000
@@ -161,6 +161,9 @@
 
         return rev
 
+    def get_fileid_map(self, mapping):
+        return mapping.import_fileid_map(self.revprops, self.fileprops)
+
     def __hash__(self):
         return hash((self.__class__, self.repository.uuid, self.branch_path, self.revnum))
 

=== modified file 'revids.py'
--- a/revids.py	2008-08-31 13:35:18 +0000
+++ b/revids.py	2008-09-01 13:22:31 +0000
@@ -78,6 +78,8 @@
 
         :return: First revision number on which a revision property was found, or None
         """
+        if self.repos.transport.has_capability("log-revprops") != True:
+            return
         for (_, revno, revprops) in self.repos._log.iter_changes(None, from_revnum, to_revnum):
             if is_bzr_revision_revprops(revprops):
                 mapping = find_mapping(revprops, {})




More information about the bazaar-commits mailing list