summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Plugins/Svn.py
diff options
context:
space:
mode:
authorJason Kincl <kincljc@ornl.gov>2012-11-27 14:30:45 -0500
committerJason Kincl <kincljc@ornl.gov>2012-11-27 14:30:45 -0500
commitbf98d0d2c56c00ef5b5eb71aeb03e76b41475e2b (patch)
treeba57dbc58b348f635dedc2274b969d433229f0c6 /src/lib/Bcfg2/Server/Plugins/Svn.py
parent5e0265f837f0eb72123be0b5150451aebdf8b031 (diff)
downloadbcfg2-bf98d0d2c56c00ef5b5eb71aeb03e76b41475e2b.tar.gz
bcfg2-bf98d0d2c56c00ef5b5eb71aeb03e76b41475e2b.tar.bz2
bcfg2-bf98d0d2c56c00ef5b5eb71aeb03e76b41475e2b.zip
adding svn merge resolution map
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/Svn.py')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Svn.py30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Svn.py b/src/lib/Bcfg2/Server/Plugins/Svn.py
index bc585570d..a79cc3c0e 100644
--- a/src/lib/Bcfg2/Server/Plugins/Svn.py
+++ b/src/lib/Bcfg2/Server/Plugins/Svn.py
@@ -5,6 +5,7 @@ updating the repository. """
import sys
import Bcfg2.Server.Plugin
+from Bcfg2.Compat import ConfigParser
try:
import pysvn
HAS_SVN = True
@@ -21,9 +22,21 @@ class Svn(Bcfg2.Server.Plugin.Version):
if HAS_SVN:
__rmi__ = Bcfg2.Server.Plugin.Version.__rmi__ + ['Update', 'Commit']
- def callback_conflict_resolver(self):
+ conflict_resolution_map = {
+ "base": pysvn.wc_conflict_choice.base,
+ "working": pysvn.wc_conflict_choice.working,
+ "mine-conflict": pysvn.wc_conflict_choice.mine_conflict,
+ "theirs-conflict": pysvn.wc_conflict_choice.theirs_conflict,
+ "mine-full": pysvn.wc_conflict_choice.mine_full,
+ "theirs-full": pysvn.wc_conflict_choice.theirs_full,
+ "none": None
+ }
+ else:
+ __vcs_metadata_path__ = ".svn"
+
+ def callback_conflict_resolver(self, conflict_description):
"""PySvn callback function to resolve conflicts"""
- return pysvn.wc_conflict_choice.theirs_full, None, False
+ return self.conflict_resolution_map[svn_resolution], None, False
def __init__(self, core, datastore):
Bcfg2.Server.Plugin.Version.__init__(self, core, datastore)
@@ -36,7 +49,18 @@ class Svn(Bcfg2.Server.Plugin.Version):
self.client = None
else:
self.client = pysvn.Client()
- self.client.callback_conflict_resolver = self.callback_conflict_resolver
+ try:
+ if self.setup.cfg.has_option("svn", "conflict_resolution"):
+ svn_resolution = self.setup.cfp.get("svn",
+ "conflict_resolution")
+ self.client.callback_conflict_resolver = self.callback_conflict_resolver
+ except ConfigParser.NoSectionError:
+ msg = "Svn: No [svn] section found in bcfg2.conf"
+ LOGGER.warning(msg)
+ except ConfigParser.NoOptionError:
+ msg = "Svn: Option not found in bcfg2.conf: %s" % \
+ sys.exc_info()[1]
+ LOGGER.warning(msg)
self.logger.debug("Initialized svn plugin with SVN directory %s" %
self.vcs_path)