Rev 1800: Use simple variables to see whether a mapping uses revision or file properties. in file:///data/jelmer/bzr-svn/trunk/
Jelmer Vernooij
jelmer at samba.org
Thu Sep 4 09:54:41 BST 2008
At file:///data/jelmer/bzr-svn/trunk/
------------------------------------------------------------
revno: 1800
revision-id: jelmer at samba.org-20080904085440-pqgzn4u7b48mjch5
parent: jelmer at samba.org-20080904084816-k417xa7c05htl0y9
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Thu 2008-09-04 10:54:40 +0200
message:
Use simple variables to see whether a mapping uses revision or file properties.
modified:
__init__.py __init__.py-20051008155114-eae558e6cf149e1d
commit.py commit.py-20060607190346-qvq128wgfubhhgm2-1
mapping.py mapping.py-20080128201303-6cp01phc0dmc0kiv-1
mapping3/__init__.py __init__.py-20080502174630-9324zh25kka98vlw-1
mapping4.py mapping4.py-20080827182338-y4xzpsf43vyiwcir-1
upgrade.py upgrade.py-20070106192108-0rakplee2lzah4gs-1
=== modified file '__init__.py'
--- a/__init__.py 2008-09-04 08:11:08 +0000
+++ b/__init__.py 2008-09-04 08:54:40 +0000
@@ -520,7 +520,7 @@
if mapping is None:
mapping = mapping_registry.get_default()
new_mapping = mapping.from_repository(repos)
- if not new_mapping.supports_custom_revprops():
+ if not new_mapping.can_use_revprops:
raise BzrCommandError("Please specify a different mapping, %s doesn't support revision properties." % new_mapping.name)
set_revprops(repos, new_mapping)
=== modified file 'commit.py'
--- a/commit.py 2008-09-04 08:11:08 +0000
+++ b/commit.py 2008-09-04 08:54:40 +0000
@@ -193,12 +193,13 @@
self._base_branch_props = lazy_dict({}, self.repository.branchprop_list.get_properties, self.base_path, self.base_revnum)
self.supports_custom_revprops = self.repository.transport.has_capability("commit-revprops")
if (self.supports_custom_revprops is None and
- self.base_mapping.supports_custom_revprops() and
+ self.base_mapping.can_use_revprops and
self.repository.seen_bzr_revprops()):
raise BzrError("Please upgrade your Subversion client libraries to 1.5 or higher to be able to commit with Subversion mapping %s" % self.base_mapping.name)
if self.supports_custom_revprops == True:
self._svn_revprops = {}
+ # If possible, submit signature directly
if opt_signature is not None:
self._svn_revprops[mapping.SVN_REVPROP_BZR_SIGNATURE] = opt_signature
else:
=== modified file 'mapping.py'
--- a/mapping.py 2008-09-04 08:11:08 +0000
+++ b/mapping.py 2008-09-04 08:54:40 +0000
@@ -283,6 +283,8 @@
experimental = False
_warned_experimental = False
roundtripping = False
+ can_use_revprops = False
+ can_use_fileprops = False
def __init__(self):
if (version_info[3] == 'exp' or self.experimental) and not BzrSvnMapping._warned_experimental:
@@ -298,16 +300,6 @@
def from_revprops(cls, revprops):
raise NotImplementedError
- @classmethod
- def supports_custom_revprops(cls):
- """Whether this mapping will primarily use custom revision properties."""
- return False
-
- @classmethod
- def supports_custom_fileprops(cls):
- """Whether this mapping can be used with custom file properties."""
- return False
-
def get_mandated_layout(self, repository):
"""Return the repository layout if any is mandated by this mapping,
None otherwise."""
@@ -475,11 +467,6 @@
def __init__(self, name):
self.name = name
- @classmethod
- def supports_custom_fileprops(cls):
- """Whether this mapping can be used with custom file properties."""
- return True
-
def import_revision(self, svn_revprops, fileprops, uuid, branch, revnum, rev):
parse_svn_revprops(svn_revprops, rev)
if SVN_PROP_BZR_LOG in fileprops:
@@ -573,11 +560,6 @@
class BzrSvnMappingRevProps(object):
- @classmethod
- def supports_custom_revprops(cls):
- """Whether this mapping can be used with custom revision properties."""
- return True
-
def import_revision(self, svn_revprops, fileprops, uuid, branch, revnum, rev):
parse_svn_revprops(svn_revprops, rev)
parse_bzr_svn_revprops(svn_revprops, rev)
=== modified file 'mapping3/__init__.py'
--- a/mapping3/__init__.py 2008-09-04 07:58:37 +0000
+++ b/mapping3/__init__.py 2008-09-04 08:54:40 +0000
@@ -160,6 +160,7 @@
upgrade_suffix = "-svn3"
revid_prefix = "svn-v3-"
roundtripping = True
+ can_use_fileprops = True
def __init__(self, scheme, guessed_scheme=None):
mapping.BzrSvnMapping.__init__(self)
=== modified file 'mapping4.py'
--- a/mapping4.py 2008-09-04 07:58:37 +0000
+++ b/mapping4.py 2008-09-04 08:54:40 +0000
@@ -31,6 +31,8 @@
upgrade_suffix = "-svn4"
experimental = True
roundtripping = True
+ can_use_revprops = True
+ can_use_fileprops = True
def __init__(self, layout=None):
self.name = "v4"
@@ -49,10 +51,6 @@
def from_revprops(cls, revprops):
return cls()
- @staticmethod
- def supports_custom_revprops():
- return True
-
@classmethod
def revision_id_bzr_to_foreign(cls, revid):
assert isinstance(revid, str)
=== modified file 'upgrade.py'
--- a/upgrade.py 2008-09-04 08:11:08 +0000
+++ b/upgrade.py 2008-09-04 08:54:40 +0000
@@ -263,7 +263,7 @@
if old_mapping == new_mapping:
# Already the latest mapping
continue
- assert old_mapping.supports_custom_revprops() or bp is not None
+ assert old_mapping.can_use_revprops or bp is not None
new_revprops = dict(revprops.items())
revmeta = repository._revmeta(bp, changes, revnum, revprops, fileprops)
rev = revmeta.get_revision(old_mapping)
More information about the bazaar-commits
mailing list