Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9.3, 2.0, and 2.0.1

stable dnd: Initial implementation of drag_move and drag_copy commands

These use HeadlessQuickop to display any error messages to the user.

Changeset 27929f0fba22

Parent b346766b3b42

by Daniel Atallah

Changes to 2 files · Browse files at 27929f0fba22 Showing diff from parent b346766b3b42 Diff from another changeset...

Change 1 of 1 Show Entire File tortoisehg/​hgqt/​dnd.py Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
@@ -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
699
700
 
 
 
 
 
 
 
 
 
 
701
702
703
 
959
960
961
 
 
962
963
964
 
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
 
969
970
971
972
973
974
975
976
@@ -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')),