Commits

Anonymous committed d1b70d7

context: support cloning by drag-n-drop

Comments (0)

Files changed (1)

tortoise/contextmenu.py

             run_program(hgpath, cmd)
 
     def _clone_here(self, parent_window):
-        win32ui.MessageBox("_clone_here", "Hg", win32con.MB_OK)
+        targets = self._filenames or [self._folder]
+        msg = "Create clone for %s in %s?" % (self._filenames[0], self._folder)
+        title = "Mercurial: clone"
+        rv = win32ui.MessageBox(msg, title, win32con.MB_OKCANCEL)
+        if rv == 2:
+            return
+
+        exepath = find_path(GUI_SHELL)
+        if exepath:
+            src = self._filenames[0]
+            repo_name = os.path.basename(src)
+            dest = os.path.join(self._folder, repo_name)
+            cmdline = "%s hg --verbose %s %s %s" % (
+                            exepath, 
+                            'clone',
+                            shellquote(self._filenames[0]),
+                            shellquote(dest))
+            run_program(exepath, cmdline)
+            
 
     def _push_here(self, parent_window):
         win32ui.MessageBox("_push_here", "Hg", win32con.MB_OK)