Commits

Yuya Nishihara committed 0b29124

clone: do not create or change destination just before command execution

It should no longer be necessary because

- CloneDialog can now show errors reported by Mercurial
- and empty destination is set on source/destination changed

Also, if it create the destination directory, "hg clone" cannot delete it
on error.

  • Participants
  • Parent commits 1619a66

Comments (0)

Files changed (1)

tortoisehg/hgqt/clone.py

         return bool(src and dest and src != dest)
 
     def runCommand(self):
-        src, dest = self.source(), self.destination()
-
-        if not dest.startswith('ssh://'):
-            if not os.path.exists(dest):
-                try:
-                    os.mkdir(dest)
-                except EnvironmentError:
-                    qtlib.ErrorMsgBox(_('TortoiseHg Clone'),
-                    _('Error creating destination folder'),
-                    _('Please specify a different path.'))
-                    return cmdcore.nullCmdSession()
-
-        # verify input
-        if dest == os.getcwdu():
-            if os.listdir(dest):
-                # cur dir has files, specify no dest, let hg take
-                # basename
-                dest = ''
-            else:
-                dest = '.'
-        else:
-            abs = os.path.abspath(dest)
-            dirabs = os.path.dirname(abs)
-            if dirabs == src:
-                dest = os.path.join(os.path.dirname(dirabs), dest)
-
-        # prepare command line
-        self.src_combo.setEditText(src)
-        self.dest_combo.setEditText(dest)
+        src = self.source()
         cmdline = self._composeCommand()
         worker = src.startswith('p4://') and 'proc' or None
         return self._cmdagent.runCommand(cmdline, self, worker=worker)