[vcv] Update vcv to support git
[commit: http://hg.dwscoalition.org/vcv/rev/2a96d620a2b6]
http://bugs.dwscoalition.org/show_bug.cgi?id=2463
Add git support to the checkout and build script.
Patch by
fu.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=2463
Add git support to the checkout and build script.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- bin/vcv
-------------------------------------------------------------------------------- diff -r 4bf387cf43f7 -r 2a96d620a2b6 bin/vcv --- a/bin/vcv Tue Apr 06 16:38:28 2010 +0000 +++ b/bin/vcv Fri Feb 18 18:33:37 2011 +0800 @@ -117,6 +117,7 @@ my $read_conf = sub my $file = shift; my $main = shift; + my $repopattern = '\(([\w\-]+)\)\s*=\s*(\S+)\s*(?:@([a-z0-9]+))?'; open (C, $file) or die "Error opening conf file.\n"; while (<C>) { @@ -137,7 +138,7 @@ my $read_conf = sub next; } - if (/^SVN\(([\w\-]+)\)\s*=\s*(\S+)\s*(?:@(\d+))?/) { + if (/^SVN$repopattern/) { die "SVN declaration without CVSDIR declared\n" unless $DIR_CVS; my ($ldir, $src, $rev) = ($1, $2, $3); @@ -180,7 +181,7 @@ my $read_conf = sub die "Failed to run svn: is it installed?"; } - } elsif (/^HG\(([\w\-]+)\)\s*=\s*(\S+)\s*(?:@([a-z0-9]+))?/) { + } elsif (/^HG$repopattern/) { die "HG declaration without CVSDIR declared\n" unless $DIR_CVS; my ($ldir, $src, $rev) = ($1, $2, $3); @@ -202,7 +203,28 @@ my $read_conf = sub system("hg", "clone", @opts, $src, $full_ldir) and die "Failed to run hg: is it installed?"; } + } elsif(/^GIT$repopattern/) { + die "GIT declaration without CVSDIR declared\n" unless $DIR_CVS; + my ( $ldir, $src, $rev ) = ( $1, $2, $3 ); + my @urlparts = split(/\//, $src); + my $url = join("/", @urlparts[0..$#urlparts-1]); + $REPO_URLS{$ldir} = $url; + $REPO_REV{$ldir} = $rev; + + my $full_ldir = "$DIR_CVS/$ldir"; + my $full_ldir_svn = "$DIR_CVS/$ldir/.git"; + + unless (-d $full_ldir && -d $full_ldir_svn) { + unless ($opt_checkout) { + die "Git directory '$ldir' doesn't exist under $DIR_CVS. " . + "Re-run vcv with --checkout for me to automatically get it for you.\n"; + } + my @opts; + if ($rev) { push @opts, "-r", $rev; } + system("git", "clone", @opts, $src, $full_ldir) and + die "Failed to run git: is it installed?"; + } } elsif (/(\S+)\s+(.+)/) { my ($from, $to) = ($1, $2); my $maybe = 0; @@ -306,7 +328,9 @@ foreach my $p (@paths) } elsif (-d ".hg" ) { system("hg", "pull"); system("hg", "update"); - } elsif ($SVK) { + } elsif (-d ".git" ) { + system("git", "pull"); + }elsif ($SVK) { my $info = `svk info $dir`; $info =~ /Mirrored From(.*)Rev. (\d+)/; my $ourrev = $2 || undef; @@ -342,6 +366,7 @@ foreach my $p (@paths) next if $file =~ /\bCVS\b/; next if $file eq ".svn"; next if $file eq ".hg"; + next if $file eq ".git"; next if $file eq 'var'; next if $file eq "." or $file eq ".."; if (-d "$fulldir/$file") { @@ -469,6 +494,7 @@ while ( @dirs ) { next if $file =~ /\bCVS\b/; next if $file eq ".svn"; next if $file eq ".hg"; + next if $file eq ".git"; next if $file eq "." or $file eq ".."; next if $file =~ /\.(?:rej|orig|swp)$/; --------------------------------------------------------------------------------