Rev 1624: Pass information about whether custom revprops can be committed. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk
Jelmer Vernooij
jelmer at samba.org
Sat Aug 23 22:12:23 BST 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/trunk
------------------------------------------------------------
revno: 1624
revision-id: jelmer at samba.org-20080823211220-3ksv36tnuezrt4te
parent: jelmer at samba.org-20080823201849-mcwgp3nmgyq4amxv
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Sat 2008-08-23 23:12:20 +0200
message:
Pass information about whether custom revprops can be committed.
modified:
Makefile makefile.other-20080311181537-5svhje3v1flh1n4f-1
commit.py commit.py-20060607190346-qvq128wgfubhhgm2-1
mapping.py mapping.py-20080128201303-6cp01phc0dmc0kiv-1
=== modified file 'Makefile'
--- a/Makefile 2008-08-23 18:39:03 +0000
+++ b/Makefile 2008-08-23 21:12:20 +0000
@@ -17,6 +17,7 @@
DEBUGGER ?=
BZR ?= $(shell which bzr)
+BZR_OPTIONS ?=
PYTHON ?= $(shell which python)
SETUP ?= $(PYTHON) ./setup.py
PYDOCTOR ?= pydoctor
@@ -60,7 +61,7 @@
ln -sf .. $@
check:: build-inplace $(TMP_PLUGINS_DIR)/svn
- BZR_PLUGIN_PATH=$(TMP_PLUGINS_DIR) $(DEBUGGER) $(PYTHON) $(PYTHON_OPTIONS) $(BZR) selftest $(TEST_OPTIONS) --starting-with=bzrlib.plugins.svn $(TESTS)
+ BZR_PLUGIN_PATH=$(TMP_PLUGINS_DIR) $(DEBUGGER) $(PYTHON) $(PYTHON_OPTIONS) $(BZR) $(BZR_OPTIONS) selftest $(TEST_OPTIONS) --starting-with=bzrlib.plugins.svn $(TESTS)
check-verbose::
$(MAKE) check TEST_OPTIONS=-v
=== modified file 'commit.py'
--- a/commit.py 2008-08-23 20:18:49 +0000
+++ b/commit.py 2008-08-23 21:12:20 +0000
@@ -184,7 +184,8 @@
base_branch_props = {}
else:
base_branch_props = lazy_dict({}, self.repository.branchprop_list.get_properties, self.base_path, self.base_revnum)
- (self._svn_revprops, self._svnprops) = self.base_mapping.export_revision(self.branch.get_branch_path(), timestamp, timezone, committer, revprops, revision_id, self.base_revno+1, merges, base_branch_props)
+ self.supports_custom_revprops = self.repository.transport.has_capability("commit-revprops")
+ (self._svn_revprops, self._svnprops) = self.base_mapping.export_revision(self.supports_custom_revprops, self.branch.get_branch_path(), timestamp, timezone, committer, revprops, revision_id, self.base_revno+1, merges, base_branch_props)
if len(merges) > 0:
new_svk_merges = update_svk_features(base_branch_props.get(SVN_PROP_SVK_MERGE, ""), merges)
@@ -463,10 +464,13 @@
text_parents[path] = revid
mutter('in %r: overriding text revid for %r -> %r' % (self._new_revision_id, path, revid))
- self.base_mapping.export_text_parents(text_parents, self._svn_revprops, self._svnprops)
- self.base_mapping.export_fileid_map(fileids, self._svn_revprops, self._svnprops)
+ self.base_mapping.export_text_parents(self.supports_custom_revprops, text_parents,
+ self._svn_revprops, self._svnprops)
+ self.base_mapping.export_fileid_map(self.supports_custom_revprops, fileids,
+ self._svn_revprops, self._svnprops)
if self._config.get_log_strip_trailing_newline():
- self.base_mapping.export_message(message, self._svn_revprops, self._svnprops)
+ self.base_mapping.export_message(message, self.supports_custom_revprops,
+ self._svn_revprops, self._svnprops)
message = message.rstrip("\n")
if not self.push_metadata:
self._svn_revprops = {}
@@ -479,7 +483,7 @@
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.repository.transport.has_capability("commit-revprops"):
+ if self.supports_custom_revprops:
self.editor = self.repository.transport.get_commit_editor(
self._svn_revprops, done, None, False)
self._svn_revprops = {}
=== modified file 'mapping.py'
--- a/mapping.py 2008-08-23 14:55:24 +0000
+++ b/mapping.py 2008-08-23 21:12:20 +0000
@@ -357,9 +357,10 @@
"""
raise NotImplementedError(self.import_fileid_map)
- def export_fileid_map(self, fileids, revprops, fileprops):
+ def export_fileid_map(self, supports_custom_revprops, fileids, revprops, fileprops):
"""Adjust the properties for a file id map.
+ :param supports_custom_revprops: Whether or not custom revprops can be used
:param fileids: Dictionary
:param revprops: Subversion revision properties
:param fileprops: File properties
@@ -374,23 +375,26 @@
"""
raise NotImplementedError(self.import_text_parents)
- def export_text_parents(self, text_parents, revprops, fileprops):
+ def export_text_parents(self, supports_custom_revprops, text_parents, revprops, fileprops):
"""Store a text parent map.
+ :param supports_custom_revprops: Whether or not custom revprops can be used
:param text_parents: Text parent map
:param revprops: Revision properties
:param fileprops: File properties
"""
raise NotImplementedError(self.export_text_parents)
- def export_revision(self, branch_root, timestamp, timezone, committer, revprops,
+ def export_revision(self, supports_custom_revprops, branch_root, timestamp, timezone, committer, revprops,
revision_id, revno, merges, fileprops):
"""Determines the revision properties and branch root file
properties.
+
+ :param supports_custom_revprops: Whether or not custom revprops can be used
"""
raise NotImplementedError(self.export_revision)
- def export_message(self, log, revprops, fileprops):
+ def export_message(self, supports_custom_revprops, log, revprops, fileprops):
raise NotImplementedError(self.export_message)
def get_revision_id(self, branch_path, revprops, fileprops):
@@ -494,7 +498,7 @@
return {}
return parse_text_parents_property(metadata)
- def export_text_parents(self, text_parents, svn_revprops, fileprops):
+ def export_text_parents(self, supports_custom_revprops, text_parents, svn_revprops, fileprops):
if text_parents != {}:
fileprops[SVN_PROP_BZR_TEXT_PARENTS] = generate_text_parents_property(text_parents)
else:
@@ -530,7 +534,7 @@
return svnprops
- def export_revision(self, branch_root, timestamp, timezone, committer, revprops, revision_id, revno, merges, old_fileprops):
+ def export_revision(self, supports_custom_revprops, branch_root, timestamp, timezone, committer, revprops, revision_id, revno, merges, old_fileprops):
# Keep track of what Subversion properties to set later on
fileprops = {}
@@ -567,7 +571,7 @@
mutter(str(e))
return (None, None)
- def export_fileid_map(self, fileids, revprops, fileprops):
+ def export_fileid_map(self, supports_custom_revprops, fileids, revprops, fileprops):
if fileids != {}:
file_id_text = generate_fileid_property(fileids)
fileprops[SVN_PROP_BZR_FILEIDS] = file_id_text
@@ -595,7 +599,7 @@
return {}
return parse_text_parents_property(svn_revprops[SVN_REVPROP_BZR_TEXT_PARENTS])
- def export_text_parents(self, text_parents, svn_revprops, fileprops):
+ def export_text_parents(self, supports_custom_revprops, text_parents, svn_revprops, fileprops):
svn_revprops[SVN_REVPROP_BZR_TEXT_PARENTS] = generate_text_parents_property(text_parents)
def get_rhs_parents(self, branch_path, svn_revprops,
@@ -616,10 +620,10 @@
return (revno, revid)
return (None, None)
- def export_message(self, message, revprops, fileprops):
+ def export_message(self, supports_custom_revprops, message, revprops, fileprops):
revprops[SVN_REVPROP_BZR_LOG] = message.encode("utf-8")
- def export_revision(self, branch_root, timestamp, timezone, committer,
+ def export_revision(self, supports_custom_revprops, branch_root, timestamp, timezone, committer,
revprops, revision_id, revno, merges,
fileprops):
svn_revprops = {SVN_REVPROP_BZR_MAPPING_VERSION: str(MAPPING_VERSION)}
@@ -645,7 +649,7 @@
return (svn_revprops, {})
- def export_fileid_map(self, fileids, revprops, fileprops):
+ def export_fileid_map(self, supports_custom_revprops, fileids, revprops, fileprops):
revprops[SVN_REVPROP_BZR_FILEIDS] = generate_fileid_property(fileids)
def get_rhs_ancestors(self, branch_path, revprops, fileprops):
More information about the bazaar-commits
mailing list