Commits

Steve Borho committed 8c6b50b

rename: perform renames as move, then hg mv -A

By performing rename using os.rename(), we bypass some of Mercurial's safety
checks and allow some non-trivial renames to succeed. It makes our rename
dialog behave closer to a shell rename function.

Closes #687

Comments (0)

Files changed (1)

tortoisehg/hgtk/rename.py

 # 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
 import sys
 import gtk
 import cStringIO
     new_name = hglib.fromutf(dlg.entry.get_text())
     opts = {}
     opts['force'] = False # Checkbox? Nah.
-    opts['after'] = False
+    opts['after'] = True
     opts['dry_run'] = False
 
     saved = sys.stderr
         repo.ui.pushbuffer()
         repo.ui.quiet = True
         try:
+            os.rename(dlg.orig, new_name)
             commands.rename(repo.ui, repo, dlg.orig, new_name, **opts)
             toquit = True
-        except (util.Abort, hglib.RepoError), inst:
+        except (OSError, util.Abort, hglib.RepoError), inst:
             dlg.error_dialog(None, _('rename error'), str(inst))
             toquit = False
     finally: