Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

cmenu: cleanup detection and launch of hgtk

Changeset 8396e1b42612

Parent cd643567147b

by Steve Borho

Changes to one file · Browse files at 8396e1b42612 Showing diff from parent cd643567147b Diff from another changeset...

 
5
6
7
 
8
9
10
 
222
223
224
225
 
 
 
 
 
 
 
 
 
 
 
 
226
227
228
229
230
231
232
233
234
 
235
236
237
 
238
239
240
241
242
243
 
 
 
244
245
246
 
 
5
6
7
8
9
10
11
 
223
224
225
 
226
227
228
229
230
231
232
233
234
235
236
237
238
 
 
 
 
 
 
 
 
239
240
 
 
241
242
243
244
245
246
247
248
249
250
251
 
 
252
@@ -5,6 +5,7 @@
   import os  import tempfile +import subprocess  import pythoncom  from win32com.shell import shell, shellcon  import win32con @@ -222,25 +223,30 @@
  else:   files.append(f)   self.fnames = files - gpopts = " %s" % hgcmd + + cmdline = None + exepath = os.path.join(get_prog_root(), 'hgtk.exe') + if os.path.exists(exepath): + cmdline = ['hgtk.exe', hgcmd] + elif not hasattr(sys, 'frozen'): + pypath = os.path.join(get_prog_root(), 'hgtk') + if os.path.exists(pypath): + cmdline = [sys.executable, pypath, hgcmd] + if not cmdline: + win32ui.MessageBox('Unable to find ' + pypath, 'run_dialog') + return   if self.fnames: - fd, tmpfile = tempfile.mkstemp(prefix="tortoisehg_filelist_") - os.write(fd, "\n".join(self.fnames)) - os.close(fd) - gpopts += " --listfile %s" % (shellquote(tmpfile)) - app_path = find_path("hgtk", get_prog_root(), '.EXE;.BAT') - if not app_path: - app_path = find_path("hgtk", None, '.EXE;.BAT') - cmdline = shellquote(app_path) + gpopts + cmdline += ['--listfile', '-']   try: - import subprocess - pop = subprocess.Popen(cmdline, + proc = subprocess.Popen(cmdline,   shell=False,   cwd=cwd,   creationflags=win32con.CREATE_NO_WINDOW,   stderr=subprocess.STDOUT,   stdout=subprocess.PIPE,   stdin=subprocess.PIPE) + if self.fnames: + proc.stdin.write('\n'.join(self.fnames)) + proc.stdin.close()   except win32api.error, details: - win32ui.MessageBox("Error executing command - %s" % (details), - "gpopen") + win32ui.MessageBox('Error executing - ' + details, 'run_dialog')