Rev 2213: Simplify logic a bit. in file:///data/jelmer/bzr-svn/mappings/
Jelmer Vernooij
jelmer at samba.org
Sun Dec 7 03:44:07 GMT 2008
At file:///data/jelmer/bzr-svn/mappings/
------------------------------------------------------------
revno: 2213
revision-id: jelmer at samba.org-20081207034405-hzbjkqfcrcp9d9ah
parent: jelmer at samba.org-20081207025826-sptapcukknl1qyh9
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: mappings
timestamp: Sun 2008-12-07 04:44:05 +0100
message:
Simplify logic a bit.
modified:
TODO todo-20060729211917-2kpobww0zyvvo0j2-1
commit.py commit.py-20060607190346-qvq128wgfubhhgm2-1
repository.py repository.py-20060306123302-1f8c5069b3fe0265
=== modified file 'TODO'
--- a/TODO 2008-12-07 02:58:26 +0000
+++ b/TODO 2008-12-07 03:44:05 +0000
@@ -4,7 +4,7 @@
- cope with old mappings in find_tags_between_*
- set-revprops upgrades v3 stuff as well?
- set-revprops should refuse to work when there is no commit-revprops capability
- - special fileproperty bzr:use-revprops for use when quick_revprops is not available
+ - use special fileproperty bzr:use-revprops for when log-revprops is not available
- automatically disable cache in some situations, allow partial cache?
- in-memory caching of revid mapping (LRUCache ?)
- warn when retrieving revision properties slowly
=== modified file 'commit.py'
--- a/commit.py 2008-12-07 02:58:26 +0000
+++ b/commit.py 2008-12-07 03:44:05 +0000
@@ -397,23 +397,19 @@
self._svn_revprops = {}
self._svnprops = lazy_dict({}, lambda: dict(self._base_branch_props.iteritems()))
- if self.supports_custom_revprops and self.mapping.can_use_revprops:
- self.set_custom_revprops = True
- self.set_custom_fileprops = self.mapping.must_use_fileprops
+ (self.set_custom_revprops, self.set_custom_fileprops) = self.repository._properties_to_set(mapping)
+ if self.supports_custom_revprops:
# If possible, submit signature directly
if opt_signature is not None:
self._svn_revprops[mapping.SVN_REVPROP_BZR_SIGNATURE] = opt_signature
# Set hint for potential clients that they have to check revision
# properties
if (not self.set_custom_fileprops and
- self.repository.transport.has_capability("log-revprops")):
+ not self.repository.transport.has_capability("log-revprops")):
# Tell clients about first approximate use of revision
# properties
self.mapping.export_revprop_redirect(
self.repository.get_latest_revnum()+1, self._svnprops)
- else:
- self.set_custom_fileprops = True
- self.set_custom_revprops = False
revno = self.base_revno + 1
if self.set_custom_fileprops:
self.mapping.export_revision_fileprops(
@@ -771,8 +767,17 @@
fileprops = dict(revmeta.get_fileprops().iteritems())
if set_metadata:
assert mapping.supports_hidden
- mapping.export_hidden_revprops(branch_path, revprops)
- mapping.export_hidden_fileprops(fileprops)
+ (set_custom_revprops, set_custom_fileprops) = repository._properties_to_set(mapping)
+ if set_custom_revprops:
+ mapping.export_hidden_revprops(branch_path, revprops)
+ if (not set_custom_fileprops and
+ not repository.transport.has_capability("log-revprops")):
+ # Tell clients about first approximate use of revision
+ # properties
+ mapping.export_revprop_redirect(
+ repository.get_latest_revnum()+1, fileprops)
+ if set_custom_fileprops:
+ mapping.export_hidden_fileprops(fileprops)
parent = urlutils.dirname(branch_path)
bp_parts = branch_path.split("/")
=== modified file 'repository.py'
--- a/repository.py 2008-12-07 02:58:26 +0000
+++ b/repository.py 2008-12-07 03:44:05 +0000
@@ -277,6 +277,14 @@
return mapping_registry.get(config_mapping_name)
return mapping_registry.get_default()
+ def _properties_to_set(self, mapping):
+ supports_custom_revprops = self.transport.has_capability("commit-revprops")
+ if supports_custom_revprops and mapping.can_use_revprops:
+ return (True, mapping.must_use_fileprops)
+ else:
+ return (mapping.can_use_fileprops, False)
+
+
def get_mapping(self):
"""Get the default mapping that is used for this repository."""
if self._default_mapping is None:
More information about the bazaar-commits
mailing list