Skip Menu |
 

This queue is for tickets about the svk CPAN distribution.

Report information
The Basics
Id: 28091
Status: open
Priority: 0/
Queue: svk

People
Owner: Nobody in particular
Requestors: adsb [...] openfoundry
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Please consider adding support for non interactive usage
Download (untitled) / with headers
text/plain 530b
===================== NOTE ===================== === We are in the process moving bug entries === === from rt.openfoundry.org to rt.cpan.org === === We apologize for any inconvenience === Hi, Please consider making it possible to run e.g. "svk info" non-interactively. The specific use case I have is to allow people to install svk and then run svk info from a script (in order to determine whether the current directory is an svk working directory) without being prompted if svk hasn't been initialised. Thanks, Adam
From: vincent.legoll [...] gmail.com
Download (untitled) / with headers
text/plain 433b
Yes this would be very valuable, please add a command line option: --dont-create-repository or something like that. BTW it is not practical to workaround the issue by doing it like this: echo 'n' | svk info > /dev/null 2> /dev/null because svk breaks the tty input handling, you'll have to blindly type `stty sane` afterwards to restore proper echo handling. $ svk -v This is svk, version v2.2.1 (using Subversion bindings 1.5.4)
From: vincent.legoll [...] gmail.com
Download (untitled) / with headers
text/plain 1.3k
Hello, I wanted to automate some svk use from a script, but found that even `svk info` is interactive (asking to create a local repo) I tried to overcome the problem with: echo n | svk info but that won't work properly, neither did `expect`, BTW. And add that when doing the above `echo n | svk info` the tty was messed with and left in a bad state: local echo was disabled and has to be restored manually with `stty sane`. :-( Then I though something should already exist to avoid that user interaction, and after some search found the following bug report: #28091: Please consider adding support for non interactive usage. I looked at the code and found the "I'm not given a tty as stdin, let's use /dev/tty" gem (ruby pun intended) in Util.pm::get_prompt(). If you're not given a "real" tty, maybe that's just what the user wants, don't try to be smarter, please. The attached patch remove that code, and allows one to do: echo n | svk info /tmp/this/is/not/a/svk/repo And still have a tty in a good shape afterwards. Ok, this is still a workaround for that there's no command line option to disallow svk from creating a local repository when all we want to know if some directory is a working copy. Maybe the real fix would be not to ask for a local repo creation from SVK::Command::Info, and just return the "%1 is not a checkout path" mantra What do you think ?
Index: lib/SVK/XD.pm =================================================================== --- lib/SVK/XD.pm (revision 3150) +++ lib/SVK/XD.pm (working copy) @@ -242,7 +242,7 @@ qr/^[yn]/i, ); next if $ans =~ /^n/i; - $self->_create_depot($path) + $self->_create_depot($path) } return; }
Index: lib/SVK/Util.pm =================================================================== --- lib/SVK/Util.pm (revision 3150) +++ lib/SVK/Util.pm (working copy) @@ -180,15 +180,10 @@ local $| = 1; print $prompt; - local *IN; local *SAVED = *STDIN; local *STDIN = *STDIN; - my $formfeed = ""; - if (!-t STDIN and -r '/dev/tty' and open IN, '<', '/dev/tty') { - *STDIN = *IN; - $formfeed = "\r"; - } + my $formfeed = (IS_WIN32 ? "" : "\r"); require Term::ReadKey; Term::ReadKey::ReadMode(IS_WIN32 ? 'normal' : 'raw');


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.