Commits

Henrik Stuart committed a339484

guess: use cmdutil.copy instead of removed wctx.remove/copy

  • Participants
  • Parent commits c295e2d
  • Branches hgtk-default

Comments (0)

Files changed (1)

tortoisehg/hgtk/guess.py

 import cStringIO
 import Queue
 
-from mercurial import hg, ui, mdiff, scmutil, match, error
+from mercurial import hg, ui, mdiff, scmutil, match, error, cmdutil
 from mercurial import similar
 
 from tortoisehg.util.i18n import _
             src, usrc, dest, udest, percent, sensitive = row
             if not sensitive:
                 continue
-            if not os.path.exists(self.repo.wjoin(src)):
-                # Mark missing rename source as removed
-                wctx.remove([src])
-            wctx.copy(src, dest)
+
+            wlock = self.repo.wlock(False)
+            try:
+                opts = {
+                        'after': True,
+                        'force': False,
+                        'include': [],
+                        'exclude': [],
+                        'dry-run': False,
+                        }
+                cmdutil.copy(self.repo.ui, self.repo, [src, dest], opts,
+                        rename=not os.path.exists(self.repo.wjoin(src)))
+            finally:
+                wlock.release()
+
             shlib.shell_notify([self.repo.wjoin(src), self.repo.wjoin(dest)])
             if self.notify_func:
                 self.notify_func()