[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [MISSING FEATURE] How to detect if the Repository Browser was canceled?

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Mon, 06 Oct 2014 19:29:45 +0200

On 02.10.2014 13:10, Wolfgang Kleinschmit wrote:
> Hi all,
>
> I want to use the Repository Browser from my own application, to enable
> the user to select a path in a repository. Much in the same way as, for
> example, the first "..."-button on Tortoise's "Checkout"-dialog does.
> In fact, my configuration is just the same: A text-box next to a button
> labeled "...".
> Clicking said button calls TortoiseProc.exe like this:
>
> TortoiseProc |/command|:repobrowser /outfile:"..."/path:"..."
>
> where /outfile points to a newly created, empty temporary file and /path
> is either missing (leaving TortoiseProc to ask for an initial path) or
> gives the path that was in the text-box before.
>
> This works all well... with one exception:
> The user might click the "Ok"-button or the "Cancel"-button, the result
> is always the same.
>
> The exit-code of TortoiseProc is 0 in any case and the temporary file
> given by /outfile always contains the last selected repository path.
>
> I have checked the source-code and in RepositoryBrowserCommand.cpp, line
> 107, the result of dlg.DoModal(); is, indeed, just silently ignored.
>
> My suggestion would be to either
>
> * return a non-zero exit code from TortoiseProc if the dialog was
> canceled.
> This, however, might have the drawback of breaking existing code
> since it's not really an error.
> But then again, since most TortoiseProc commands spawn some kind of
> dialog, this could be made a general rule and some special
> exit-code, say 1, could be dedicated to signal the "User canceled
> the operation" condition.
>
> or
>
> * Do not write the /outfile at all or, even better, make sure it
> exists but is empty.
> This, again, might break some existing code. So maybe it's still
> better to:
> * Add a third line to the output file, saying either "Ok" or "Cancel".
>
> Thanks for reading this and please let me know your comments.

I'll go with the option of leaving the outfile empty in case the dialog
was cancelled. I guess that's what should have been done all along.

I also opened issue #667 for this:
https://code.google.com/p/tortoisesvn/issues/detail?id=667

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest interface to (Sub)version control
    /_/   \_\     http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=3089492
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2014-10-06 19:29:31 CEST

This is an archived mail posted to the TortoiseSVN Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.