# HG changeset patch
# User Simon Heimberg <sim...@besonet.ch>
# Date 1242801591 -7200
# Node ID 33acf9764dafc3a10b2e124f9491846a474c2ef9
# Parent  0b533d29360c3143cb4a6f03ed7e5d92071875b2
hglib: moved method for reading mergetools from thgconfig to hglib

diff -r 0b533d29360c -r 33acf9764daf hggtk/thgconfig.py
--- a/hggtk/thgconfig.py        Mon Aug 17 12:51:24 2009 +0200
+++ b/hggtk/thgconfig.py        Mit Mai 20 08:39:51 2009 +0200
@@ -941,21 +941,7 @@
                                 values.append(name)
                 elif cpath == 'ui.merge':
                     # Special case, add [merge-tools] to possible values
-                    try:
-                        tools = []
-                        for key, value in self.ui.configitems('merge-tools'):
-                            t = key.split('.')[0]
-                            if t not in tools:
-                                tools.append(t)
-                        for t in tools:
-                            # Ensure the tool is installed
-                            if filemerge._findtool(self.ui, t):
-                                values.append(t)
-                        values.append('internal:merge')
-                        values.append('internal:prompt')
-                        values.append('internal:dump')
-                    except ImportError:
-                        pass
+                    hglib.mergetools(self.ui, values)
 
                 currow = None
                 if not ispw:
diff -r 0b533d29360c -r 33acf9764daf thgutil/hglib.py
--- a/thgutil/hglib.py  Mon Aug 17 12:51:24 2009 +0200
+++ b/thgutil/hglib.py  Mit Mai 20 08:39:51 2009 +0200
@@ -125,6 +125,27 @@
                 # May already be canonical
                 canonpats.append(f)
     return canonpats
+    
+    
+def mergetools(ui, values=None):
+    'returns the configured merge tools and the internal ones'
+    if values == None:
+        values = []
+    from mercurial import filemerge
+    for key, value in ui.configitems('merge-tools'):
+        t = key.split('.')[0]
+        if t not in values:
+            # Ensure the tool is installed
+            if filemerge._findtool(ui, t):
+                values.append(t)
+    values.append('internal:merge')
+    values.append('internal:prompt')
+    values.append('internal:dump')
+    values.append('internal:local')
+    values.append('internal:other')
+    values.append('internal:fail')
+    return values
+
 
 def hgcmd_toq(path, q, *args):
     '''

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to