diff options
author | Laura Arjona Reina <larjona> | 2017-11-07 13:58:38 +0000 |
---|---|---|
committer | Laura Arjona Reina <larjona> | 2017-11-07 13:58:38 +0000 |
commit | a2e50f3748cef50765b4debb5ab78265a3ce5381 (patch) | |
tree | e25def3f2a7bfb6c63ce28003384bb976ce98c07 /Perl | |
parent | cfbe359c247520bebd37356025a9eae148b3c665 (diff) |
vcs_get_file function converted to use git checkouts, needs review and test
CVS version numbers
Perl/Local/VCS_git.pm: 1.10 -> 1.11
Diffstat (limited to 'Perl')
-rw-r--r-- | Perl/Local/VCS_git.pm | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/Perl/Local/VCS_git.pm b/Perl/Local/VCS_git.pm index 4cd80f28477..ca21a7f27b7 100644 --- a/Perl/Local/VCS_git.pm +++ b/Perl/Local/VCS_git.pm @@ -426,19 +426,6 @@ sub vcs_get_diff } -# returns the respository -# FIXME: this needs to be "translated" into git and hashes -sub _get_repository -{ - open( my $fd, '<', 'CVS/Repository' ) - or croak("Couldn't open `CVS/Repository': $!"); - my $repo = <$fd>; - close( $fd ); - - chomp $repo; - return $repo; -} - =item vcs_get_file Return a particular revision of a file @@ -453,7 +440,7 @@ Example use: my $text = vcs_get_file( 'foo.c', '1.12' ); -# FIXME: this needs to be "translated" into git and hashes +FIXME: converted to use git checkouts. Assumes we provide in $file the complete path. Needs review and test =cut @@ -466,21 +453,27 @@ sub vcs_get_file #TODO: what happens if we're not in the root webwml dir? - my $command = sprintf( 'cvs -q checkout -p -r%s %s/%s', - $rev, _get_repository, $file ); - - - local $/ = ('=' x 67) . "\n"; + my $command1 = sprintf( 'git -q checkout %s', $rev ); + my $command2 = sprintf( 'cat %s', $file ); + my $command3 = sprintf( 'git -q checkout origin/master'); my $text; - open ( my $git, '-|', $command ) - or croak("Error while executing `$command': $!"); - while ( my $line = <$git> ) + open ( my $git1, '-|', $command1 ) + or croak("Error while executing `$command1': $!"); + close( $git1 ); + open ( my $git2, '-|', $command2 ) + or croak("Error while executing `$command2': $!"); + while ( my $line = <$git2> ) { $text .= $line; } - close( $git ); + close( $git2 ); croak("Error while executing `$command': $!") unless WIFEXITED($?); + + # return to git master + open ( my $git3, '-|', $command3 ) + or croak("Error while executing `$command3': $!"); + close( $git3 ); # return the file return $text; |