summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Plugins/Svn.py
diff options
context:
space:
mode:
authorJason Kincl <kincljc@ornl.gov>2012-12-03 15:25:39 -0500
committerJason Kincl <kincljc@ornl.gov>2012-12-03 15:25:39 -0500
commitb97fbb64ae7e79e96ddf150b577954149a0240c6 (patch)
treee032c3d50d77f1f9eab36261d73a7edc06bab3b3 /src/lib/Bcfg2/Server/Plugins/Svn.py
parente63eea186a953a53afbcddfae89ec49d602a1353 (diff)
downloadbcfg2-b97fbb64ae7e79e96ddf150b577954149a0240c6.tar.gz
bcfg2-b97fbb64ae7e79e96ddf150b577954149a0240c6.tar.bz2
bcfg2-b97fbb64ae7e79e96ddf150b577954149a0240c6.zip
Future-proofed conflict option selection
* moved from a map table to a getattr() lookup
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/Svn.py')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Svn.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Svn.py b/src/lib/Bcfg2/Server/Plugins/Svn.py
index a33948526..26443f103 100644
--- a/src/lib/Bcfg2/Server/Plugins/Svn.py
+++ b/src/lib/Bcfg2/Server/Plugins/Svn.py
@@ -21,24 +21,20 @@ class Svn(Bcfg2.Server.Plugin.Version):
__vcs_metadata_path__ = ".svn"
if HAS_SVN:
__rmi__ = Bcfg2.Server.Plugin.Version.__rmi__ + ['Update', 'Commit']
-
- conflict_resolution_map = {
- "base": pysvn.wc_conflict_choice.base,
- "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"""
- self.logger.info("Svn: Resolving conflict for %s with %s" % \
- (conflict_description['path'],
- self.svn_resolution))
- return self.conflict_resolution_map[self.svn_resolution], None, False
+ try:
+ choice = getattr(pysvn.wc_conflict_choice,
+ self.svn_resolution.replace('-','_'))
+ self.logger.info("Svn: Resolving conflict for %s with %s" % \
+ (conflict_description['path'],
+ self.svn_resolution))
+ return choice, None, False
+ except AttributeError:
+ return pysvn.wc_conflict_choice.postpone
def __init__(self, core, datastore):
Bcfg2.Server.Plugin.Version.__init__(self, core, datastore)