Commits

Anonymous committed 3d171ca

hgproc: setup merge tools for dialog calls

Comments (0)

Files changed (1)

 import sys
 import getopt
 from tortoise import thgutil
+from mercurial import ui
 
 os.environ['PATH'] = "%s;%s" % (thgutil.get_prog_root(), os.environ['PATH'])
 hg_executable = thgutil.find_path("hg")
 if trace: print "hgproc: hg_executable = %s" % hg_executable
 
+# setup merge tool for any dialogs that do merging
+uimerge = ui.ui().config('ui', 'merge', None)
+hgmerge = os.environ.get('HGMERGE', None)
+if uimerge:
+    print "ui.merge = %s" % uimerge
+elif hgmerge:
+    print "HGMERGE = %s" % os.environ['HGMERGE']
+else:
+    app_path = thgutil.find_path("simplemerge", thgutil.get_prog_root(), '.EXE;.BAT')
+    os.environ['HGMERGE'] = ('%s -L my -L other' % thgutil.shellquote(app_path))
+    print "HGMERGE = %s" % os.environ['HGMERGE']
+        
 def get_option(args):
     long_opt_list =  ['command=', 'exepath=', 'listfile=', 'title=',
                       'root=', 'cwd=', 'notify', 'deletelistfile']
         import hggtk.diff
         return hggtk.diff.run(root=option['root'], files=filelist)
     elif option['hgcmd'] == 'merge':
-        from mercurial import ui
         import hggtk.merge
-        uimerge = ui.ui().config('ui', 'merge', None)
-        hgmerge = os.environ.get('HGMERGE', None)
-        if uimerge:
-            print "ui.merge = %s" % uimerge
-        elif hgmerge:
-            print "HGMERGE = %s" % os.environ['HGMERGE']
-        else:
-            app_path = thgutil.find_path("simplemerge", thgutil.get_prog_root(), '.EXE;.BAT')
-            os.environ['HGMERGE'] = ('%s -L my -L other' % thgutil.shellquote(app_path))
-            print "HGMERGE = %s" % os.environ['HGMERGE']
         return hggtk.merge.run(root=option['root'])
     elif option['hgcmd'] in ('tip', 'parents', 'heads'):
         import hggtk.revisions
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.