# HG changeset patch # User Adrian Buehlmann <[email protected]> # Date 1239116128 -7200 # Node ID 26037a7c9cbf7c350b5f2d72a52707fd5254091c # Parent ce64e8c75a3a851b0ff9d062efebd2820d6db237 clone: set selected folder as default source and destination folder
Currently, the selected folder is set as the destination folder and the source folder is empty, which doesn't make much sense IMHO. I often clone a local master repo and would like to say 'clone' on that repo's folder using the context menu. Setting that same folder name as default for the destination in the dialog allows me to quickly edit the destination. Example use case: I have a clone of 'http://bitbucket.org/tortoisehg/crew/' on my disk at 'W:\thg-crew'. When I want to start working on a new patch I want to clone 'W:\thg-crew' to, let's say, 'W:\thg-crew-hack1'. With this patch I can open an explorer window on 'W:', point at the 'thg-crew' folder and choose "Create Clone" from the context menu, which then opens the clone dialog with 'W:\thg-crew' preset both for the source and destination repo folder. I can then quickly edit the destination folder name by appending '-hack1' to it. diff --git a/hggtk/clone.py b/hggtk/clone.py --- a/hggtk/clone.py +++ b/hggtk/clone.py @@ -42,6 +42,7 @@ class CloneDialog(gtk.Window): self._dest_path = repos[1] elif len(repos): self._src_path = repos[0] + self._dest_path = repos[0] # build dialog self._create() diff --git a/tortoise/contextmenu.py b/tortoise/contextmenu.py --- a/tortoise/contextmenu.py +++ b/tortoise/contextmenu.py @@ -83,6 +83,7 @@ class ContextMenuExtension(menuthg.menuT def __init__(self): self.folder = None self.fnames = [] + self.directory = None self.menuitems = {} menuthg.menuThg.__init__(self) @@ -165,6 +166,7 @@ class ContextMenuExtension(menuthg.menuT if len(self.fnames) == 1 and os.path.isdir(f): cwd = f self.fnames = [] + self.directory = f else: cwd = os.path.dirname(f) else: @@ -243,11 +245,12 @@ class ContextMenuExtension(menuthg.menuT if not cmdline: win32ui.MessageBox('Unable to find ' + pypath, 'run_dialog') return - if self.fnames: + if self.fnames or self.directory: cmdline += ['--listfile', '-'] try: print "run_dialog: cmdline = ", cmdline print "run_dialog: fnames = ", self.fnames + print "run_dialog: directory = ", self.directory proc = subprocess.Popen(cmdline, shell=False, cwd=cwd, @@ -258,5 +261,8 @@ class ContextMenuExtension(menuthg.menuT if self.fnames: proc.stdin.write('\n'.join(self.fnames)) proc.stdin.close() + elif self.directory: + proc.stdin.write(self.directory) + proc.stdin.close() except win32api.error, details: win32ui.MessageBox('Error executing - ' + details, 'run_dialog') ------------------------------------------------------------------------------ This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com _______________________________________________ Tortoisehg-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop
