summaryrefslogtreecommitdiff
path: root/bzr_commit_handler.py
diff options
context:
space:
mode:
authorIan Clatworthy <ian.clatworthy@canonical.com>2009-08-28 21:19:30 +1000
committerIan Clatworthy <ian.clatworthy@canonical.com>2009-08-28 21:19:30 +1000
commit3f9de7294035230429a007082e6ccca1ad8f0f37 (patch)
treebdb1a782fb0ff7c7167f125ba4554d23b9a8b2e6 /bzr_commit_handler.py
parent013ce5843cd2fbeee0fe431549039cbd26ed75a0 (diff)
downloadbzr-fastimport-3f9de7294035230429a007082e6ccca1ad8f0f37.tar.gz
Sanitize None revision properties to empty string
Diffstat (limited to 'bzr_commit_handler.py')
-rw-r--r--bzr_commit_handler.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/bzr_commit_handler.py b/bzr_commit_handler.py
index d25754e..56d9500 100644
--- a/bzr_commit_handler.py
+++ b/bzr_commit_handler.py
@@ -216,7 +216,7 @@ class GenericCommitHandler(processor.CommitHandler):
return generate_ids.gen_revision_id(who, timestamp)
def build_revision(self):
- rev_props = self.command.properties or {}
+ rev_props = self._legal_revision_properties(self.command.properties)
self._save_author_info(rev_props)
committer = self.command.committer
who = self._format_name_email(committer[0], committer[1])
@@ -233,6 +233,21 @@ class GenericCommitHandler(processor.CommitHandler):
properties=rev_props,
parent_ids=self.parents)
+ def _legal_revision_properties(self, props):
+ """Clean-up any revision properties we can't handle."""
+ # For now, we just check for None because that's not allowed in 2.0rc1
+ result = {}
+ if props is not None:
+ for name, value in props.items():
+ if value is None:
+ self.warning(
+ "converting None to empty string for property %s"
+ % (name,))
+ result[name] = ''
+ else:
+ result[name] = value
+ return result
+
def _save_author_info(self, rev_props):
author = self.command.author
if author is None: