From 1eabd9e2593a563729c5478b7a11129de04c6b32 Mon Sep 17 00:00:00 2001 From: mhagger Date: Sat, 12 Jun 2010 09:38:33 +0000 Subject: [PATCH] Change AutoPropsPropertySetter into a FilePropertySetter. git-svn-id: http://cvs2svn.tigris.org/svn/cvs2svn/trunk@5149 be7e6eca-30d4-0310-a8e5-ac0d63af7087 --- cvs2bzr-example.options | 4 ++-- cvs2git-example.options | 4 ++-- cvs2hg-example.options | 4 ++-- cvs2svn-example.options | 4 ++-- cvs2svn_lib/property_setters.py | 15 ++++++++------- cvs2svn_lib/run_options.py | 2 +- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/cvs2bzr-example.options b/cvs2bzr-example.options index a6432a67..c7399c79 100644 --- a/cvs2bzr-example.options +++ b/cvs2bzr-example.options @@ -350,8 +350,6 @@ ctx.username = 'cvs2svn' # conversion, but some of these properties have side-effects that do # affect the Bazaar output. FIXME: Document this in more detail. ctx.file_property_setters.extend([ - ]) -ctx.revision_property_setters.extend([ # To read auto-props rules from a file, uncomment the following line # and specify a filename. The boolean argument specifies whether # case should be ignored when matching filenames to the filename @@ -361,6 +359,8 @@ ctx.revision_property_setters.extend([ # ignore_case=True, # ), + ]) +ctx.revision_property_setters.extend([ # To read mime types from a file, uncomment the following line and # specify a filename: #MimeMapper(r'/etc/mime.types', ignore_case=False), diff --git a/cvs2git-example.options b/cvs2git-example.options index 001773b6..48eb7dcb 100644 --- a/cvs2git-example.options +++ b/cvs2git-example.options @@ -385,8 +385,6 @@ ctx.username = 'cvs2svn' # conversion, but some of these properties have side-effects that do # affect the git output. FIXME: Document this in more detail. ctx.file_property_setters.extend([ - ]) -ctx.revision_property_setters.extend([ # To read auto-props rules from a file, uncomment the following line # and specify a filename. The boolean argument specifies whether # case should be ignored when matching filenames to the filename @@ -396,6 +394,8 @@ ctx.revision_property_setters.extend([ # ignore_case=True, # ), + ]) +ctx.revision_property_setters.extend([ # To read mime types from a file, uncomment the following line and # specify a filename: #MimeMapper(r'/etc/mime.types', ignore_case=False), diff --git a/cvs2hg-example.options b/cvs2hg-example.options index 3382588f..7de017a6 100644 --- a/cvs2hg-example.options +++ b/cvs2hg-example.options @@ -346,8 +346,6 @@ ctx.username = 'cvs2svn' # conversion, but some of these properties have side-effects that do # affect the hg output. FIXME: Document this in more detail. ctx.file_property_setters.extend([ - ]) -ctx.revision_property_setters.extend([ # To read auto-props rules from a file, uncomment the following line # and specify a filename. The boolean argument specifies whether # case should be ignored when matching filenames to the filename @@ -357,6 +355,8 @@ ctx.revision_property_setters.extend([ # ignore_case=True, # ), + ]) +ctx.revision_property_setters.extend([ # To read mime types from a file, uncomment the following line and # specify a filename: #MimeMapper(r'/etc/mime.types', ignore_case=False), diff --git a/cvs2svn-example.options b/cvs2svn-example.options index 994abc59..c30e6054 100644 --- a/cvs2svn-example.options +++ b/cvs2svn-example.options @@ -447,8 +447,6 @@ ctx.username = None # should be used for properties that are allowed to vary from revision # to revision; these should implement RevisionPropertySetter. ctx.file_property_setters.extend([ - ]) -ctx.revision_property_setters.extend([ # To read auto-props rules from a file, uncomment the following line # and specify a filename. The boolean argument specifies whether # case should be ignored when matching filenames to the filename @@ -458,6 +456,8 @@ ctx.revision_property_setters.extend([ # ignore_case=True, # ), + ]) +ctx.revision_property_setters.extend([ # To read mime types from a file, uncomment the following line and # specify a filename: #MimeMapper(r'/etc/mime.types', ignore_case=False), diff --git a/cvs2svn_lib/property_setters.py b/cvs2svn_lib/property_setters.py index c48d5374..983274af 100644 --- a/cvs2svn_lib/property_setters.py +++ b/cvs2svn_lib/property_setters.py @@ -202,7 +202,7 @@ class MimeMapper(RevisionPropertySetter): s_item.svn_props[self.propname] = mime_type -class AutoPropsPropertySetter(RevisionPropertySetter): +class AutoPropsPropertySetter(FilePropertySetter): """Set arbitrary svn properties based on an auto-props configuration. This class supports case-sensitive or case-insensitive pattern @@ -356,17 +356,18 @@ class AutoPropsPropertySetter(RevisionPropertySetter): return propdict - def set_properties(self, s_item): - propdict = self.get_propdict(s_item.cvs_rev.cvs_file) + def set_properties(self, cvs_file): + propdict = self.get_propdict(cvs_file) for (k,v) in propdict.items(): - if k in s_item.svn_props: - if s_item.svn_props[k] != v: + if k in cvs_file.properties: + if cvs_file.properties[k] != v: Log().warn( "Property '%s' already set to %r for file %s; " "auto-props value (%r) ignored." - % (k, s_item.svn_props[k], s_item.cvs_rev.cvs_path, v,)) + % (k, cvs_file.properties[k], cvs_file.cvs_path, v,) + ) else: - s_item.svn_props[k] = v + cvs_file.properties[k] = v class CVSBinaryFileDefaultMimeTypeSetter(RevisionPropertySetter): diff --git a/cvs2svn_lib/run_options.py b/cvs2svn_lib/run_options.py index fe6bb2c2..f0386882 100644 --- a/cvs2svn_lib/run_options.py +++ b/cvs2svn_lib/run_options.py @@ -1027,7 +1027,7 @@ class RunOptions(object): options = self.options for value in options.auto_props_files: - ctx.revision_property_setters.append( + ctx.file_property_setters.append( AutoPropsPropertySetter(value, options.auto_props_ignore_case) ) -- 2.11.4.GIT