On 07.04.2009 20:54, Steve Borho wrote:
> On Tue, Apr 7, 2009 at 1:45 PM, Adrian Buehlmann <[email protected]> wrote:
>> On 07.04.2009 19:36, Steve Borho wrote:
>>> On Tue, Apr 7, 2009 at 12:29 PM, Adrian Buehlmann <[email protected]>
>>> wrote:
>>>> # 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.
>>> While I think the end-goal is correct, I don't want to make
>>> modifications to the context menu logic just for this fix. Can your
>>> patch simply use os.getcwd() as the default source, or perhaps run a
>>> root finding algorithm on os.getcwd()?
>> Hmm. This looks all a bit strange to me. We have a selection from explorer,
>> why use getcwd()?
>
> On crew, the context menu extension always sets the cwd of the hgtk
> process to the folder where the menu was opened. That's why it's
> redundant to pass the folder name to the application.
I see. Thanks for the explanation.
>> The way hggtk\clone.py is picking up file arguments is just a bit odd:
>>
>> if __name__ == "__main__":
>> import sys
>> opts = {}
>> opts['cwd'] = os.getcwd()
>> opts['files'] = sys.argv[1:]
>> run(**opts)
>
> You can ignore these stansas in the source files. This code is only
> used when directly running the source files (debugging). Hgtk
> directly uses the run() method in each file.
Yup. So it is
def run(cwd='', files=[], **opts):
dialog = CloneDialog(cwd, repos=files)
dialog.show_all()
gtk.gdk.threads_init()
gtk.gdk.threads_enter()
gtk.main()
gtk.gdk.threads_leave()
which is relevant here.
For the 'two directories selected case' the directories seem to be passed using
the files param
>> I'll probably leave that aside for the moment. Maybe you see a better way
>> to achieve what I was trying.
>
> I can try later this evening
>
http://www.bitbucket.org/tortoisehg/crew/changeset/2cc5fba06b15/
did the trick.
POTENTIAL TODO: abort with an error message when trying to clone a repository
onto itself.
Currently, if I say clone (non-empty) repo 'W:\X' to 'W:\X' (which is
intentionally silly),
it creates a new clone of X inside directory X (for example, I then have a
directory
'W:\X\X\.hg' afterwards). [tested with Mercurial 777a9efdae2d and thg
2cc5fba06b15]
Otherwise, exactly what I wanted. Thanks!
------------------------------------------------------------------------------
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