From bab37641f4a4ca54ae55ec3f73ed55a831a9f04b Mon Sep 17 00:00:00 2001 From: Laura Arjona Reina Date: Tue, 7 Nov 2017 09:35:03 +0000 Subject: Remove Subversion functions that were experimental and are not used CVS version numbers Perl/Local/VCS_git.pm: 1.3 -> 1.4 --- Perl/Local/VCS_git.pm | 248 -------------------------------------------------- 1 file changed, 248 deletions(-) (limited to 'Perl') diff --git a/Perl/Local/VCS_git.pm b/Perl/Local/VCS_git.pm index bd53629a3e1..71ce6c92db2 100644 --- a/Perl/Local/VCS_git.pm +++ b/Perl/Local/VCS_git.pm @@ -18,9 +18,6 @@ Local::VCS_git - generic wrapper around version control systems -- git version my %info = vcs_path_info( '.', recursive => 1, verbose => 1 ); print Dumper($info{'foo.wml'}); - my %info2 = svn_file_info( 'foo.wml' ); - print Dumper(\%info2); - =head1 DESCRIPTION This module retrieves git info (such as revision of latest change, date @@ -548,251 +545,6 @@ Free Software Foundation. 42; -# stuff below is an old Subversion implementation that we probably won't use -# ignore for now, I will get rid of it as the rewrite progresses -# -- Bas. __END__ - -=item svn_diff - -Return diff for the specified file - -The first argument is a name of a file. -The second argument is the revision against which to take the diff (use undef for HEAD) -If a thrird argument is present, it signifies that hte use want a diff between -the version specified in the second agument and the one in the third argument - -Example use: - - # get diff of local changes against head - my $diff1 = $svn_diff( 'foo.c' ); - # get diff of local changes against revision 12 - my $diff2 = $svn_diff( 'foo.c', 'r12' ); - # get diff between version 11 and 12 of the file - my $diff1 = $svn_diff( 'foo.c', 'r11', 'r12' ); - -=cut - -sub svn_diff -{ - my $file = shift or carp("No file specified"); - my $rev1 = shift or carp("No orig revision specified"); - my $rev2 = shift or carp("No target revision specified"); - - carp( "No such file: $file" ) unless -e $file; - - # intitalize SVN client - my $ctx = SVN::Client->new(); - - # create twoo filehandles for output and error streams - - # TODO: this doesn't work (bug in SVN::Client?) - my ($out,$err); - #open ( my $fd_out, '>', \$out ) or croak("Couldn't open \\\$out"); - #open ( my $fd_err, '>', \$err ) or croak("Couldn't open \\\$err"); - - open ( my $fd_out, '+>', undef ) or croak("Couldn't open anonymous output"); - open ( my $fd_err, '+>', undef ) or croak("Couldn't open anonymous error"); - - $ctx->diff( - [], # options to diff (-u is default) - $file, $rev1, # first file - $file, $rev2, # second file - 1, # recursiveness - 1, # don't bother with ancestors - 0, # do diff deleted files - $fd_out, # output file - $fd_err, # error output file - ); - - # read the stuff from the files - seek( $fd_out, 0, SEEK_SET ); - seek( $fd_err, 0, SEEK_SET ); - { - local $/; - $out = <$fd_out>; - $err = <$fd_err>; - } - - # done with the files - close( $fd_out ); - close( $fd_err ); - - # croak on error - croak( $err ) if $err; - - # return the diff - return $out; -} - - -=item svn_log - -Return the log entries of a particular file - -The first argument is a name of a file. -The (optional) second and third argument specify the revision range - -This function retrieves the log entry/entries of the specified revision(s) for -the specified file. If only a file name is given, the entire history is -returned; if only 1 revision is specified, the log entrie of that particular -revision is returned; if two revisions are specified, all log entries in -between are returned. - -Example use: - - my @log = svn_log( 'foo.c' ); - my @log = svn_log( 'foo.c', 'r42' ); - my @log = svn_log( 'foo.c', 'r42', 'r112' ); - my @log = svn_log( 'foo.c', 'r42', 'HEAD' ); - -=cut - -my @_log_collection; - -sub _log_receiver -{ - my $paths = shift; # NOTE: not used - my $rev = shift; - my $author = shift; - my $date = str2time( shift ); - my $msg = shift; - - push @_log_collection, { - 'rev' => $rev, - 'author' => $author, - 'date' => $date, - 'message' => $msg, - }; - -} - -sub svn_log -{ - my $file = shift or carp("No file specified"); - my $rev1 = shift || '0'; - my $rev2 = shift || 'HEAD'; - - carp( "No such file: $file" ) unless -e $file; - - # clear log - @_log_collection = (); - - # intitialize SVN client - my $ctx = SVN::Client->new(); - - eval { - $ctx->log( - $file, - $rev1, - $rev2, - 0, # determine which files were changed on each revision? - 0, # don't traverse history of copies? - \&_log_receiver - ); - }; - carp($@) if $@; - - - # return a copy of the logs - return @_log_collection; -} - -=item svn_get_info - -Return info about the (local) Subversion repository - -The first argument is a name of a checked-out file or directory. - -Example use: - - my %info = svn_info( 'foo.c' ); - -=cut - -my %_info_data; - -sub _info_receiver -{ - my( $path, $info, $pool ) = @_; - - # return if the info is already known - return if %_info_data; - - %_info_data = ( - 'url' => $info->URL(), - 'rev' => $info->rev(), - 'kind' => $info->kind(), - 'root' => $info->repos_root_URL(), - 'uuid' => $info->repos_UUID(), - 'last_changed_rev' => $info->last_changed_rev(), - 'last_changed_date' => $info->last_changed_date(), - 'last_changed_author' => $info->last_changed_author(), - ); -}; - -sub svn_get_info -{ - my $file = shift or carp("No file specified"); - - $file = rel2abs( $file ); - - # intitialize SVN client - my $ctx = SVN::Client->new(); - - # reset the info hash - %_info_data = (); - - eval { - $ctx->info( - $file, - undef, # no revision info, so... - undef, # ...only use local info - \&_info_receiver, - 0, # no, don't recurse - ); - }; - carp($@) if $@; - - return %_info_data; -} - - -=item svn_get_depth - -Find how deep we are inside the repository - -The first argument is a name of a checked-out file or directory. - -Example use: - - my $depth = svn_get_topdir( 'foo.c' ); - -=cut - -sub svn_get_depth -{ - my $file = shift or carp("No file specified"); - - - my %info = svn_get_info( $file ); - my $top = $info{'url'}; - my $root = $info{'root'}; - - # if $file really is a file (not a dir), only look at the directory part of - # the filename - $top = dirname( $top ) if $info{'kind'} == 1; - - # remove the root from the start of url to get a top dir - $top =~ s{^\Q$root\E}{}; - $top =~ s{/+}{/}; - - # count the number of elements in the path - my $num = scalar splitdir( $top ); - - # minus 1, because $top starts with a '/', and thus splitdir adds an empty - # field at the beginning - return $num - 1; -} -- cgit v1.2.3