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

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

From: Wolfgang Kleinschmit <wolfgang_at_kleinschmit.info>
Date: Thu, 02 Oct 2014 13:10:13 +0200

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.

Best regards
Wolfgang Kleinschmit

------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=3089344

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2014-10-02 13:46:12 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.