package VCP::Utils::cvs ; =head1 NAME VCP::Utils::cvs - utilities for dealing with the cvs command =head1 SYNOPSIS use VCP::Utils::cvs ; =head1 DESCRIPTION A mix-in class providing methods shared by VCP::Source::cvs and VCP::Dest::cvs, mostly wrappers for calling the cvs command. =cut use strict ; use Carp ; use VCP::Debug qw( debug debugging ) ; use File::Spec ; use File::Temp qw( mktemp ) ; use POSIX ":sys_wait_h" ; =head1 METHODS =item cvs Calls the cvs command with the appropriate cvsroot option. =cut sub cvs { my $self = shift ; my $args = shift ; unshift @$args, "-d" . $self->repo_server if defined $self->repo_server; return $self->run_safely( [ qw( cvs -Q -z9 ), @$args ], @_ ) ; } =item parse_cvs_repo_spec This handles ":pserver:"-like type repository specs specially, defaulting to normal processing if the scheme is not followed by something like "foo". The username and password are parsed out of the spec If the first colon is followed by a colon, like cvs::pserver:user@server/foo:bar , then the special processing kicks in and the spec is parsed accordingly. Everything up to and including the first colon and starting with the last colon are stripped, just like with L<normal specs|VCP::Plugin/parse_repo_spec>, and the remainder becomes the CVSROOT. This does have the side effect of plaintexting the password in various CVS places (like the local CVS directories and the command lines that VCP forks to launch CVS). Let me know if you need this changed. =cut sub parse_cvs_repo_spec { my $self = shift; my ( $spec ) = @_; return $self->parse_repo_spec( @_ ) unless $spec =~ /\A\w+::/; my ( $scheme, $cvs_root, $filespec ) = ( $spec =~ /\A([^:]*):(.*):([^:]*)\z/ ) or die "Can't parse CVS remote file spec '$spec'\n"; $self->repo_scheme( $scheme ); $self->repo_server( $cvs_root ); $self->repo_filespec( $filespec ); die "parse_cvs_repo_spec does not return a result" if defined wantarray; } =item create_cvs_workspace $self->create_cvs_workspace; $self->create_cvs_workspace( create_in_repository => 1 ); Creates a temp dir named "co" for C<cvs> to work in, checks out the module there, and sets the work root and cvs working dir to that directory. =cut sub create_cvs_workspace { my $self = shift ; my %options = @_; confess "Can't create_workspace twice" unless $self->none_seen ; ## establish_workspace in a directory named "co" for "checkout". This is ## so that VCP::Source::cvs can use a different directory to contain ## the revs, since all the revs need to be kept around until the VCP::Dest ## is through with them. $self->command_chdir( $self->tmp_dir( "co" ) ) ; my $module = $self->rev_root; die "Empty cvs module spec\n" unless defined $module and length $module ; my @expect_cannot_find_module = ( stderr_filter => qr/cvs checkout: cannot find module .*\n/, ok_result_codes => [0,1], ); $self->cvs( [ "checkout", $module ], $options{create_in_repository} ? @expect_cannot_find_module : ( ok_result_codes => [0], ## Shouldn't be needed, but Just In Case ), ) ; if ( $self->command_result_code == 1 ) { my $empty_dir = $self->tmp_dir( "empty_dir" ); $self->mkdir( $empty_dir ); $self->cvs( [ "import", "-m", "VCP destination directory creation", $module, "vcp", "start" ] ); $self->cvs( [ "checkout", $module ] ) ; } $self->work_root( $self->tmp_dir( "co" ) ) ; $self->command_chdir( $self->tmp_dir( "co" ) ) ; } =head1 COPYRIGHT Copyright 2000, Perforce Software, Inc. All Rights Reserved. This module and the VCP package are licensed according to the terms given in the file LICENSE accompanying this distribution, a copy of which is included in L<vcp>. =cut 1 ;
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#31 | 5081 | barrie_slaymaker |
- VCP::Utils::cvs only tries cvs login if :pserver: and password field is missing. |
||
#30 | 5080 | barrie_slaymaker | - Don't try to log in to cvs when using :ext: in CVSROOT | ||
#29 | 4227 | barrie_slaymaker |
- VCP::Dest::cvs now handles a module name with no trailing "/..." (reported by Alexandros Karypidis karypid inf uth gr). - VCP::Dest::cvs now handles a missing filespec (module name) if the source repository passed along a rev_root |
||
#28 | 4209 | barrie_slaymaker |
- CVS workspace creation announces cvs subcommands consistently with other parts of VCP |
||
#27 | 4207 | barrie_slaymaker |
- The cvs login command is now run with STDERR unredirected to allow the user to log in. - The cvs workspace setup process prints what it's doing before running possibly long-lived cvs commands |
||
#26 | 4151 | barrie_slaymaker | - dist/vcp.exe now works again | ||
#25 | 4021 | barrie_slaymaker |
- Remove all phashes and all base & fields pragmas - Work around SWASHGET error |
||
#24 | 3970 | barrie_slaymaker |
- VCP::Source handles rev queing, uses disk to reduce RAM - Lots of other fixes |
||
#23 | 3571 | barrie_slaymaker | - Get working with cvs-11.5 on Win2k | ||
#22 | 3532 | john_fetkovich |
changed File::Spec->rel2abs( blah, start_dir ) to start_dir_rel2abs blah everywhere. which does the same thing and is defined in VCP::Utils |
||
#21 | 3384 | john_fetkovich | moved setting of default repo_id | ||
#20 | 3285 | john_fetkovich |
In 'sub new' constructor, Only call parse_cvs_repo_spec if a $spec is provided. parse_cvs_repo_spec also now sets repo_id. |
||
#19 | 3167 | barrie_slaymaker |
Add profiling report that details various chunks of time taken. |
||
#18 | 3155 | barrie_slaymaker |
Convert to logging using VCP::Logger to reduce stdout/err spew. Simplify & speed up debugging quite a bit. Provide more verbose information in logs. Print to STDERR progress reports to keep users from wondering what's going on. Breaks test; halfway through upgrading run3() to an inline function for speed and for VCP specific features. |
||
#17 | 3129 | barrie_slaymaker |
Stop calling the slow Cwd::cwd so much, use start_dir instead. |
||
#16 | 2933 | john_fetkovich | Added calls to empty() | ||
#15 | 2691 | barrie_slaymaker |
Generalize underscorification of RCS tags a bit to reduce chances of a collision (still possible, but should be much lower probability). |
||
#14 | 2680 | barrie_slaymaker |
Implemented real CVS tag testing and underscorification based on reading CVS's rcs.c source code. |
||
#13 | 2667 | barrie_slaymaker | Convert more to IPC::Run3 | ||
#12 | 2389 | john_fetkovich |
removed calls to methods: command_stderr_filter command_ok_result_codes command_chdir and replaced with named Plugin::run_safely method parameters stderr_filter ok_result_codes in_dir respectively, where possible. |
||
#11 | 2293 | barrie_slaymaker | Update CHANGES, TODO, improve .vcp files, add --init-cvs | ||
#10 | 2267 | barrie_slaymaker | factor out cvs2revml, test both --use-cvs and direct modes, with times | ||
#9 | 2240 | barrie_slaymaker | Start on cvs -r option support. | ||
#8 | 2228 | barrie_slaymaker | working checkin | ||
#7 | 2026 | barrie_slaymaker | VCP::8::cvs now supoprt branching | ||
#6 | 2009 | barrie_slaymaker |
lots of fixes, improve core support for branches and VCP::Source::cvs now supports branches. |
||
#5 | 2006 | barrie_slaymaker |
more preparations for branching support, handling of cvs :foo:... CVSROOT specs, misc fixes, improvements |
||
#4 | 1742 | barrie_slaymaker | document VCP::Utils::cvs::create_cvs_workspace() | ||
#3 | 813 | barrie_slaymaker | Fix path math when checking out a module. | ||
#2 | 723 | barrie_slaymaker | VCP::Dest::cvs tuning and cvs and p4 bugfixes | ||
#1 | 705 | barrie_slaymaker | Release 0.22. |