Changeset 27929f0fba22…
Parent b346766b3b42…
by
Changes to 2 files · Browse files at 27929f0fba22 Showing diff from parent b346766b3b42 Diff from another changeset...
|
@@ -0,0 +1,26 @@ + # dnd.py - TortoiseHg's Drag and Drop handling
+#
+# Copyright 2011 Daniel Atallah <daniel.atallah@gmail.com>
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+
+from tortoisehg.util import hglib, paths
+from tortoisehg.hgqt import thgrepo, quickop
+
+def __do_run(ui, command, *pats, **_opts):
+ root = paths.find_root()
+ repo = thgrepo.repository(ui, root)
+
+ pats = hglib.canonpaths(pats)
+
+ cmdline = [command] + pats
+
+ instance = quickop.HeadlessQuickop(repo, cmdline)
+ return instance
+
+def run_copy(ui, *pats, **opts):
+ return __do_run(ui, "copy", *pats, **opts)
+
+def run_move(ui, *pats, **opts):
+ return __do_run(ui, "move", *pats, **opts)
|
@@ -698,6 +698,16 @@ from tortoisehg.hgqt.rebase import run
return qtrun(run, ui, *pats, **opts)
+def drag_move(ui, *pats, **opts):
+ """Move the selected files to the desired directory"""
+ from tortoisehg.hgqt.dnd import run_move
+ return qtrun(run_move, ui, *pats, **opts)
+
+def drag_copy(ui, *pats, **opts):
+ """Copy the selected files to the desired directory"""
+ from tortoisehg.hgqt.dnd import run_copy
+ return qtrun(run_copy, ui, *pats, **opts)
+
def thgimport(ui, *pats, **opts):
"""import an ordered set of patches"""
from tortoisehg.hgqt.thgimport import run
@@ -959,6 +969,8 @@ [('u', 'user', '', _('record user as committer')),
('d', 'date', '', _('record datecode as commit date'))],
_('thg commit [OPTIONS] [FILE]...')),
+ "drag_move": (drag_move, [], _('thg drag_move SOURCE... DEST')),
+ "drag_copy": (drag_copy, [], _('thg drag_copy SOURCE... DEST')),
"^grep|search": (grep,
[('i', 'ignorecase', False, _('ignore case during search')),],
_('thg grep')),
|
Loading...