Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1, 2.1.1, and 2.1.2

qtlib: several fixes for editfiles()

* _ was not being imported
* the error dialog arguments were busted
* the cwd calculation was wrong

Reported by Michael De Wildt

Changeset 4d205ef053fa

Parent ae92f1c4bbba

by Steve Borho

Changes to one file · Browse files at 4d205ef053fa Showing diff from parent ae92f1c4bbba Diff from another changeset...

 
18
19
20
 
21
22
23
 
89
90
91
 
 
 
 
 
 
92
93
94
 
138
139
140
141
142
143
144
145
146
147
148
149
150
 
 
151
152
153
 
18
19
20
21
22
23
24
 
90
91
92
93
94
95
96
97
98
99
100
101
 
145
146
147
 
 
 
 
148
149
150
151
152
 
153
154
155
156
157
@@ -18,6 +18,7 @@
 from mercurial import extensions, util    from tortoisehg.util import hglib, paths, wconfig +from tortoisehg.hgqt.i18n import _  from hgext.color import _styles    from PyQt4.QtCore import * @@ -89,6 +90,12 @@
  return fn, wconfig.readfile(fn)    def editfiles(repo, files, lineno=None, search=None, parent=None): + if len(files) == 1: + path = repo.wjoin(files[0]) + cwd = os.path.dirname(path) + files = [os.path.basename(path)] + else: + cwd = repo.root   files = [util.shellquote(util.localpath(f)) for f in files]   editor = repo.ui.config('tortoisehg', 'editor')   assert len(files) == 1 or lineno == None @@ -138,16 +145,13 @@
    cmdline = util.quotecommand(cmdline)   try: - try: - cwd = os.path.dirname(files[0]) - except: - cwd = repo.root   subprocess.Popen(cmdline, shell=True, creationflags=openflags,   stderr=None, stdout=None, stdin=None, cwd=cwd)   except (OSError, EnvironmentError), e:   QMessageBox.warning(parent,   _('Editor launch failure'), - _('%s : %s') % (cmd, str(e))) + u'%s : %s' % (hglib.tounicode(cmdline), + hglib.tounicode(str(e))))   return False    # _styles maps from ui labels to effects