Rev 2271: Support returning layout source in get_layout_source(). in http://people.samba.org/bzr/jelmer/bzr-svn/0.5
Jelmer Vernooij
jelmer at samba.org
Tue Dec 16 19:05:53 GMT 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/0.5
------------------------------------------------------------
revno: 2271
revision-id: jelmer at samba.org-20081216190550-cbct78lyy0r24j6i
parent: jelmer at samba.org-20081216040147-qp5egjmxk5h6rzzm
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.5
timestamp: Tue 2008-12-16 20:05:50 +0100
message:
Support returning layout source in get_layout_source().
modified:
repository.py repository.py-20060306123302-1f8c5069b3fe0265
=== modified file 'repository.py'
--- a/repository.py 2008-12-08 19:54:23 +0000
+++ b/repository.py 2008-12-16 19:05:50 +0000
@@ -71,6 +71,12 @@
VirtualSignatureTexts,
)
+LAYOUT_SOURCE_GUESSED = 'guess'
+LAYOUT_SOURCE_CONFIG = 'config'
+LAYOUT_SOURCE_REGISTRY = 'registry'
+LAYOUT_SOURCE_OVERRIDDEN = 'overridden'
+LAYOUT_SOURCE_MAPPING_MANDATED = 'mapping-mandated'
+
class SvnRepositoryFormat(RepositoryFormat):
"""Repository format for Subversion repositories (accessed using svn_ra).
"""
@@ -129,6 +135,7 @@
self._lock_mode = None
self._lock_count = 0
self._layout = None
+ self._layout_source = None
self._guessed_layout = None
self._guessed_appropriate_layout = None
self.transport = transport
@@ -214,6 +221,7 @@
self._cached_tags = {}
self._cached_revnum = revnum
self._layout = None
+ self._layout_source = None
self._parents_provider = graph.CachingParentsProvider(self._real_parents_provider)
def lock_write(self):
@@ -360,11 +368,13 @@
"""Set the layout that should be used by default by this instance."""
self.get_mapping().check_layout(self, layout)
self._layout = layout
+ self._layout_source = LAYOUT_SOURCE_OVERRIDDEN
def store_layout(self, layout):
"""Permanantly store the layout for this repository."""
self.set_layout(layout)
self.get_config().set_layout(layout)
+ self._layout_source= LAYOUT_SOURCE_CONFIG
def get_layout(self):
"""Determine layout to use for this repository.
@@ -372,25 +382,33 @@
This will use whatever layout the user has specified, or
otherwise the layout that was guessed by bzr-svn.
"""
+ return self.get_layout_source()[0]
+
+ def get_layout_source(self):
if self._layout is None:
+ self._layout_source = LAYOUT_SOURCE_MAPPING_MANDATED
self._layout = self.get_mapping().get_mandated_layout(self)
if self._layout is None:
layoutname = self.get_config().get_layout()
if layoutname is not None:
+ self._layout_source = LAYOUT_SOURCE_CONFIG
self._layout = layout.layout_registry.get(layoutname)()
if self._layout is None:
branches = self.get_config().get_branches()
tags = self.get_config().get_tags()
if branches is not None:
+ self._layout_source = LAYOUT_SOURCE_CONFIG
self._layout = WildcardLayout(branches, tags or [])
if self._layout is None:
self._layout = layout.repository_registry.get(self.uuid)
+ self._layout_source = LAYOUT_SOURCE_REGISTRY
if self._layout is None:
if self._guessed_appropriate_layout is None:
(self._guessed_layout, self._guessed_appropriate_layout) = repository_guess_layout(self,
self.get_latest_revnum(), self._hinted_branch_path)
+ self._layout_source = LAYOUT_SOURCE_GUESSED
self._layout = self._guessed_appropriate_layout
- return self._layout
+ return self._layout, self._layout_source
def get_guessed_layout(self):
"""Retrieve the layout bzr-svn deems most appropriate for this repo.
More information about the bazaar-commits
mailing list