Discussion:
[MISSING FEATURE] How to detect if the Repository Browser was canceled?
Wolfgang Kleinschmit
2014-10-02 11:10:13 UTC
Permalink
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-6zjzXkf2FExf8fUKLXF2/HdfcadvtA/***@public.gmane.org].
Stefan Küng
2014-10-06 17:29:45 UTC
Permalink
Post by Wolfgang Kleinschmit
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 "...".
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.
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
* 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-6zjzXkf2FExf8fUKLXF2/HdfcadvtA/***@public.gmane.org].
Loading...