merge-tools: make premerge valid values extensible
authorPierre-Yves David <pierre-yves.david@fb.com>
Mon, 04 Aug 2014 16:58:39 -0700
changeset 22031 b36c60cfe46f
parent 22030 ecdff28d13e2
child 22032 d7f25834ffbb
merge-tools: make premerge valid values extensible We want to introduce a version leaving merge3 style markers.
mercurial/filemerge.py
--- a/mercurial/filemerge.py	Mon Aug 04 16:50:15 2014 -0700
+++ b/mercurial/filemerge.py	Mon Aug 04 16:58:39 2014 -0700
@@ -178,14 +178,15 @@
 
     ui = repo.ui
 
+    validkeep = ['keep']
+
     # do we attempt to simplemerge first?
     try:
         premerge = _toolbool(ui, tool, "premerge", not binary)
     except error.ConfigError:
         premerge = _toolstr(ui, tool, "premerge").lower()
-        valid = 'keep'.split()
-        if premerge not in valid:
-            _valid = ', '.join(["'" + v + "'" for v in valid])
+        if premerge not in validkeep:
+            _valid = ', '.join(["'" + v + "'" for v in validkeep])
             raise error.ConfigError(_("%s.premerge not valid "
                                       "('%s' is neither boolean nor %s)") %
                                     (tool, premerge, _valid))
@@ -195,7 +196,7 @@
         if not r:
             ui.debug(" premerge successful\n")
             return 0
-        if premerge != 'keep':
+        if premerge not in validkeep:
             util.copyfile(back, a) # restore from backup and try again
     return 1 # continue merging