asdlei00 / tortoisesvn

Automatically exported from code.google.com/p/tortoisesvn
0 stars 0 forks source link

Detect if repository browser was canceled #667

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Reported on the mailing list:
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=30893
44

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".

Original issue reported on code.google.com by tortoisesvn on 6 Oct 2014 at 5:28

GoogleCodeExporter commented 9 years ago
I will go with the option that leaves the outfile empty if the dialog is 
cancelled.

Original comment by tortoisesvn on 6 Oct 2014 at 5:29

GoogleCodeExporter commented 9 years ago

Original comment by tortoisesvn on 6 Oct 2014 at 5:31

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r25923.

Original comment by tortoisesvn on 6 Oct 2014 at 5:31

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r25927.

Original comment by tortoisesvn on 6 Oct 2014 at 8:05