Merge property changes from 0.4.
[jelmer/subvertpy.git] / config.py
index 4556a4fb6f30facce294670b9656b0827c54604c..090e6e178d570bbd60634833fd34c1c82d29857b 100644 (file)
--- a/config.py
+++ b/config.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2007 Jelmer Vernooij <jelmer@samba.org>
+# Copyright (C) 2007-2008 Jelmer Vernooij <jelmer@samba.org>
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 from bzrlib import osutils, urlutils, trace
 from bzrlib.config import IniBasedConfig, config_dir, ensure_config_dir_exists, GlobalConfig, LocationConfig, Config, STORE_BRANCH, STORE_GLOBAL, STORE_LOCATION
 
+from bzrlib.plugins.svn.core import SubversionException
+
 import os
 
-from mapping3.scheme import BranchingScheme
-import svn.core
+from bzrlib.plugins.svn import properties
 
 # Settings are stored by UUID. 
 # Data stored includes default branching scheme and locations the repository 
@@ -58,11 +59,19 @@ class SvnRepositoryConfig(IniBasedConfig):
                 return None
             return GlobalConfig()._get_user_option(name)
 
+    def get_reuse_revisions(self):
+        ret = self._get_user_option("reuse-revisions")
+        if ret is None:
+            return "other-branches"
+        assert ret in ("none", "other-branches", "removed-branches")
+        return ret
+
     def get_branching_scheme(self):
         """Get the branching scheme.
 
         :return: BranchingScheme instance.
         """
+        from mapping3.scheme import BranchingScheme
         schemename = self._get_user_option("branching-scheme", use_global=False)
         if schemename is not None:
             return BranchingScheme.find_scheme(schemename.encode('ascii'))
@@ -113,10 +122,13 @@ class SvnRepositoryConfig(IniBasedConfig):
         def get_list(parser, section):
             try:
                 if parser.get_bool(section, "override-svn-revprops"):
-                    return [svn.core.SVN_PROP_REVISION_DATE, svn.core.SVN_PROP_REVISION_AUTHOR]
+                    return [properties.PROP_REVISION_DATE, properties.PROP_REVISION_AUTHOR]
                 return []
             except ValueError:
-                return parser.get_value(section, "override-svn-revprops").split(",")
+                val = parser.get_value(section, "override-svn-revprops")
+                if not isinstance(val, list):
+                    return [val]
+                return val
             except KeyError:
                 return None
         ret = get_list(self._get_parser(), self.uuid)
@@ -185,6 +197,15 @@ class BranchConfig(Config):
             self._repository_config = SvnRepositoryConfig(self.branch.repository.uuid)
         return self._repository_config
 
+    def get_set_revprops(self):
+        return self._get_repository_config().get_set_revprops()
+
+    def get_log_strip_trailing_newline(self):
+        return self._get_repository_config().get_log_strip_trailing_newline()
+
+    def get_override_svn_revprops(self):
+        return self._get_repository_config().get_override_svn_revprops()
+
     def _get_user_option(self, option_name):
         """See Config._get_user_option."""
         for source in self.option_sources:
@@ -209,7 +230,7 @@ class BranchConfig(Config):
                     return "True"
                 else:
                     return "False"
-            except svn.core.SubversionException:
+            except SubversionException:
                 return None
         return None