Rev 1633: Set revision properties when possible. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk
Jelmer Vernooij
jelmer at samba.org
Sun Aug 24 15:52:03 BST 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/trunk
------------------------------------------------------------
revno: 1633
revision-id: jelmer at samba.org-20080824145200-6811k0oue7tvgepn
parent: jelmer at samba.org-20080824145143-wo5qwb4de8dsrphn
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Sun 2008-08-24 16:52:00 +0200
message:
Set revision properties when possible.
modified:
NEWS news-20061231030336-h9fhq245ie0de8bs-1
commit.py commit.py-20060607190346-qvq128wgfubhhgm2-1
mapping.py mapping.py-20080128201303-6cp01phc0dmc0kiv-1
mapping3/__init__.py __init__.py-20080502174630-9324zh25kka98vlw-1
=== modified file 'NEWS'
--- a/NEWS 2008-08-23 10:15:40 +0000
+++ b/NEWS 2008-08-24 14:52:00 +0000
@@ -21,6 +21,8 @@
* add --incremental option to bzr-svn for incremental imports.
+ * set revision properties from v3 mappings when possible.
+
bzr-svn 0.4.11~rc1 2008-08-08
CHANGES
=== modified file 'commit.py'
--- a/commit.py 2008-08-23 21:41:57 +0000
+++ b/commit.py 2008-08-24 14:52:00 +0000
@@ -485,16 +485,8 @@
for prop in self._svn_revprops:
if not properties.is_valid_property_name(prop):
warning("Setting property %r with invalid characters in name", prop)
- if self.supports_custom_revprops:
- self.editor = self.repository.transport.get_commit_editor(
- self._svn_revprops, done, None, False)
- self._svn_revprops = {}
- else:
- # Try without bzr: revprops
- self.editor = self.repository.transport.get_commit_editor({
- properties.PROP_REVISION_LOG: self._svn_revprops[properties.PROP_REVISION_LOG]},
- done, None, False)
- del self._svn_revprops[properties.PROP_REVISION_LOG]
+ self.editor = self.repository.transport.get_commit_editor(
+ self._svn_revprops, done, None, False)
root = self.editor.open_root(self.base_revnum)
@@ -557,12 +549,6 @@
new_revprops[properties.PROP_REVISION_DATE] = properties.time_to_cstring(1000000*self._timestamp)
set_svn_revprops(self.repository.transport, result_revision, new_revprops)
- try:
- set_svn_revprops(self.repository.transport, result_revision,
- self._svn_revprops)
- except RevpropChangeFailed:
- pass # Ignore for now
-
return revid
def record_entry_contents(self, ie, parent_invs, path, tree,
=== modified file 'mapping.py'
--- a/mapping.py 2008-08-23 21:41:57 +0000
+++ b/mapping.py 2008-08-24 14:52:00 +0000
@@ -383,8 +383,7 @@
"""
raise NotImplementedError(self.export_text_parents)
- def export_revision(self, can_use_custom_revprops, branch_root, timestamp, timezone, committer, revprops,
- revision_id, revno, merges, fileprops):
+ def export_revision(self, can_use_custom_revprops, branch_root, timestamp, timezone, committer, revprops, revision_id, revno, merges, fileprops):
"""Determines the revision properties and branch root file
properties.
"""
@@ -619,10 +618,8 @@
def export_message(self, can_use_custom_revprops, message, revprops, fileprops):
revprops[SVN_REVPROP_BZR_LOG] = message.encode("utf-8")
- def export_revision(self, can_use_custom_revprops, branch_root, timestamp, timezone, committer,
- revprops, revision_id, revno, merges,
- fileprops):
- svn_revprops = {SVN_REVPROP_BZR_MAPPING_VERSION: str(MAPPING_VERSION)}
+ def export_revision(self, can_use_custom_revprops, branch_root, timestamp, timezone, committer, revprops, revision_id, revno, merges, fileprops):
+ svn_revprops = {}
if timestamp is not None:
svn_revprops[SVN_REVPROP_BZR_TIMESTAMP] = format_highres_date(timestamp, timezone)
@@ -663,6 +660,10 @@
def import_revision(self, svn_revprops, fileprops, uuid, branch, revnum, rev):
super(BzrSvnMappingv4, self).import_revision(svn_revprops, fileprops, uuid, branch, revnum, rev)
+ def export_revision(self, can_use_custom_revprops, branch_root, timestamp, timezone, committer, revprops, revision_id, revno, merges, fileprops):
+ svn_revprops[SVN_REVPROP_BZR_MAPPING_VERSION] = "4"
+ BzrSvnMappingRevProps.export_revision(self, can_use_custom_revprops, branch_root, timestamp, timezone, committer, revprops, revision_id, revno, merges, fileprops)
+
@classmethod
def parse_revision_id(cls, revid):
assert isinstance(revid, str)
=== modified file 'mapping3/__init__.py'
--- a/mapping3/__init__.py 2008-08-24 03:34:05 +0000
+++ b/mapping3/__init__.py 2008-08-24 14:52:00 +0000
@@ -330,11 +330,38 @@
class BzrSvnMappingv3FileProps(mapping.BzrSvnMappingFileProps, BzrSvnMappingv3):
- pass
+
+ def __init__(self, scheme, guessed_scheme=None):
+ mapping.BzrSvnMappingFileProps.__init__(self, scheme, guessed_scheme)
+ BzrSvnMappingv3.__init__(self, scheme, guessed_scheme)
+ self.revprop_map = mapping.BzrSvnMappingRevProps()
+
+ def export_text_parents(self, can_use_custom_revprops, text_parents, svn_revprops, fileprops):
+ mapping.BzrSvnMappingFileProps.export_text_parents(self, can_use_custom_revprops, text_parents, svn_revprops, fileprops)
+ if can_use_custom_revprops:
+ self.revprop_map.export_text_parents(can_use_custom_revprops, text_parents, svn_revprops, fileprops)
+
+ def export_revision(self, can_use_custom_revprops, branch_root, timestamp, timezone, committer, revprops, revision_id, revno, merges, old_fileprops):
+ (_, fileprops) = mapping.BzrSvnMappingFileProps.export_revision(self, can_use_custom_revprops, branch_root, timestamp, timezone, committer, revprops, revision_id, revno, merges, old_fileprops)
+ if can_use_custom_revprops:
+ (revprops, _) = self.revprop_map.export_revision(can_use_custom_revprops, branch_root, timestamp, timezone, committer, revprops, None, revno, merges, old_fileprops)
+ return (revprops, fileprops)
+
+ def export_fileid_map(self, can_use_custom_revprops, fileids, revprops, fileprops):
+ mapping.BzrSvnMappingFileProps.export_fileid_map(self, can_use_custom_revprops, fileids, revprops, fileprops)
+ if can_use_custom_revprops:
+ self.revprop_map.export_fileid_map(can_use_custom_revprops, fileids, revprops, fileprops)
+
+ def export_message(self, can_use_custom_revprops, log, revprops, fileprops):
+ mapping.BzrSvnMappingFileProps.export_message(self, can_use_custom_revprops, log, revprops, fileprops)
+ if can_use_custom_revprops:
+ self.revprop_map.export_message(can_use_custom_revprops, log, revprops, fileprops)
class BzrSvnMappingv3RevProps(mapping.BzrSvnMappingRevProps, BzrSvnMappingv3):
- pass
+ def export_revision(self, can_use_custom_revprops, branch_root, timestamp, timezone, committer, revprops, revision_id, revno, merges, fileprops):
+ svn_revprops[mapping.SVN_REVPROP_BZR_MAPPING_VERSION] = "3"
+ BzrSvnMappingRevProps.export_revision(self, can_use_custom_revprops, branch_root, timestamp, timezone, committer, revprops, revision_id, revno, merges, fileprops)
class BzrSvnMappingv3Hybrid(BzrSvnMappingv3):
More information about the bazaar-commits
mailing list