Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

rename: use cmdui instead of hg.commands

Changeset a968904ed54c

Parent 0b27581e7a06

by Johan Samyn

Changes to one file · Browse files at a968904ed54c Showing diff from parent 0b27581e7a06 Diff from another changeset...

 
6
7
8
9
 
10
11
12
13
14
 
15
16
17
 
56
57
58
59
60
61
62
63
64
 
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
 
 
 
 
 
 
 
291
292
293
294
295
296
297
298
299
300
301
302
303
 
 
304
305
306
307
308
309
310
311
312
313
 
 
 
314
315
316
 
6
7
8
 
9
10
11
12
13
 
14
15
16
17
 
56
57
58
 
 
 
59
60
61
 
270
271
272
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
274
275
276
277
278
279
280
 
 
 
 
 
 
 
 
 
 
 
 
281
282
283
284
285
 
 
 
 
 
 
 
286
287
288
289
290
291
@@ -6,12 +6,12 @@
 # This software may be used and distributed according to the terms of the  # GNU General Public License version 2, incorporated herein by reference.   -import os, sys, cStringIO +import os, sys    from PyQt4.QtCore import *  from PyQt4.QtGui import *   -from mercurial import hg, ui, util, commands, error +from mercurial import hg, ui, util, error    from tortoisehg.hgqt.i18n import _  from tortoisehg.hgqt import cmdui, qtlib, thgrepo, thread @@ -56,9 +56,6 @@
  target = hglib.toutf(util.normpath(target))   else:   target = hglib.toutf(fname) - self.opts = {} - self.opts['force'] = False # Checkbox? Nah. - self.opts['dry_run'] = False   return (fname, target)     def init_view(self, src, dest): @@ -273,44 +270,22 @@
  if not res:   return   - # prepare command line - #cmdline, vcl = self.compose_command(self.get_src(), self.get_dest()) - #qtlib.InfoMsgBox('from rename', cmdline) - #return - - # start archiving - #self.cmd.run(cmdline) - - opts = self.opts - saved = sys.stderr - errors = cStringIO.StringIO() - try: - sys.stderr = errors - self.repo.ui.pushbuffer() - self.repo.ui.quiet = True + cmdline, vcl = self.compose_command(src, dest) + self.show_command((cmdline, vcl)) + new_name = util.canonpath(self.root, self.root, new_name) + targetdir = os.path.dirname(new_name) or '.' + if not os.path.isdir(targetdir): + os.makedirs(targetdir) + if not self.copy_chk.isChecked():   try: - new_name = util.canonpath(self.root, self.root, new_name) - targetdir = os.path.dirname(new_name) or '.' - if not os.path.isdir(targetdir): - os.makedirs(targetdir) - if self.copy_chk.isChecked(): - commands.copy(self.repo.ui, self.repo, curr_name, - new_name, **opts) - else: - os.rename(curr_name, new_name) - commands.rename(self.repo.ui, self.repo, curr_name, - new_name, **opts) - except (OSError, IOError, util.Abort, error.RepoError), inst: + os.rename(curr_name, new_name) + except (OSError, IOError), inst:   qtlib.ErrorMsgBox(self.errTitle,   _('The following erorr was caught with rename :'),   hglib.tounicode(inst)) - finally: - sys.stderr = saved - textout = hglib.tounicode(errors.getvalue() - + self.repo.ui.popbuffer()) - errors.close() - if len(textout) > 1: - qtlib.ErrorMsgBox(self.errTitle, textout) + return + + self.cmd.run(cmdline)     def detail_clicked(self):   if self.cmd.is_show_output():