Changeset 780


Ignore:
Timestamp:
05/18/09 08:01:58 (4 years ago)
Author:
bruno
Message:

r3072@localhost: bruno | 2009-05-17 19:39:56 +0200
Adds support for SVK as a DVCS/CMS to project builder

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/lib/ProjectBuilder/CMS.pm

    r736 r780  
    106106    $ENV{'PBREVISION'}=$tmp; 
    107107    $ENV{'PBCMSLOGFILE'}="svn.log"; 
     108} elsif ($scheme =~ /^svk/) { 
     109    $tmp = `(cd "$ENV{'PBDIR'}" ; $vcscmd info . | grep -E '^Revision:' | cut -d: -f2)`; 
     110    $tmp =~ s/\s+//; 
     111    chomp($tmp); 
     112    $ENV{'PBREVISION'}=$tmp; 
     113    $ENV{'PBCMSLOGFILE'}="svk.log"; 
    108114} elsif ($scheme =~ /^cvs/) { 
    109115    # Way too slow 
     
    152158        } 
    153159        $source = pb_cms_mod_http($source,"svn"); 
    154         pb_system("$vcscmd export $source $tmp","Exporting $source from SVN to $tmp "); 
     160        pb_system("$vcscmd export $source $tmp","Exporting $source from $scheme to $tmp "); 
    155161    } else { 
    156162        $uri = pb_cms_mod_http($uri,"svn"); 
    157         pb_system("$vcscmd export $uri $destdir","Exporting $uri from SVN to $destdir "); 
     163        pb_system("$vcscmd export $uri $destdir","Exporting $uri from $scheme to $destdir "); 
     164    } 
     165} elsif ($scheme eq "svk") { 
     166    if (defined $source) { 
     167        if (-d $source) { 
     168            $tmp = $destdir; 
     169        } else { 
     170            $tmp = "$destdir/".basename($source); 
     171        } 
     172        $source = pb_cms_mod_http($source,"svk"); 
     173        # This doesn't exist ! 
     174        # pb_system("$vcscmd export $path $tmp","Exporting $path from $scheme to $tmp "); 
     175        pb_log(4,"$uri,$source,$destdir,$scheme, $account, $host, $port, $path,$tmp"); 
     176        pb_system("mkdir -p $tmp ; cd $tmp; tar -cf - -C $source . | tar xf -","Exporting $path from $scheme to $tmp "); 
     177    } else { 
     178        die "Unable to export from svk without a source defined"; 
    158179    } 
    159180} elsif ($scheme eq "dir") { 
     
    283304    close(PIPE); 
    284305    chomp($res); 
     306} elsif ($scheme =~ /^svk/) { 
     307    open(PIPE,"LANGUAGE=C $vcscmd info $dir |") || return(""); 
     308    my $void2 = ""; 
     309    while (<PIPE>) { 
     310        ($void,$void2,$res) = split(/ /) if (/^Depot/); 
     311    } 
     312    $res =~ s/^\s*//; 
     313    close(PIPE); 
     314    chomp($res); 
    285315} elsif ($scheme =~ /^hg/) { 
    286316    open(HGRC,".hg/hgrc/") || return(""); 
     
    352382    pb_system("$vcscmd copy -m \"Creation of $newurl from $oldurl\" $oldurl $newurl","Copying $oldurl to $newurl "); 
    353383} elsif ($scheme eq "flat") { 
    354 } elsif ($scheme =~ /^cvs/) { 
    355 } else { 
    356     die "cms $scheme unknown"; 
     384} else { 
     385    die "cms $scheme unknown for project management"; 
    357386} 
    358387} 
     
    376405if ($scheme =~ /^svn/) { 
    377406    $url = pb_cms_mod_http($url,"svn"); 
     407    pb_system("$vcscmd co $url $destination","Checking out $url to $destination "); 
     408} elsif ($scheme =~ /^svk/) { 
     409    $url = pb_cms_mod_http($url,"svk"); 
    378410    pb_system("$vcscmd co $url $destination","Checking out $url to $destination "); 
    379411} elsif ($scheme =~ /^hg/) { 
     
    421453my $vcscmd = pb_cms_cmd($scheme); 
    422454 
    423 if (($scheme =~ /^svn/) || ($scheme =~ /^hg/) || ($scheme =~ /^git/) || ($scheme =~ /^cvs/)) { 
     455if (($scheme =~ /^svn/) || ($scheme =~ /^svk/) || ($scheme =~ /^hg/) || ($scheme =~ /^git/) || ($scheme =~ /^cvs/)) { 
    424456    pb_system("$vcscmd up $dir","Updating $dir "); 
    425457} elsif ($scheme eq "flat") { 
     
    448480$msg = "Project $ENV{PBPROJ} creation" if (defined $pbinit); 
    449481 
    450 if (($scheme =~ /^svn/) || ($scheme =~ /^hg/) || ($scheme =~ /^git/) || ($scheme =~ /^cvs/)) { 
     482if (($scheme =~ /^svn/) || ($scheme =~ /^svk/) || ($scheme =~ /^hg/) || ($scheme =~ /^git/) || ($scheme =~ /^cvs/)) { 
    451483    pb_system("cd $dir ; $vcscmd ci -m \"$msg\" .","Checking in $dir "); 
    452484} elsif ($scheme eq "flat") { 
     
    470502my $vcscmd = pb_cms_cmd($scheme); 
    471503 
    472 if (($scheme =~ /^svn/) || ($scheme =~ /^hg/) || ($scheme =~ /^git/) || ($scheme =~ /^cvs/)) { 
     504if (($scheme =~ /^svn/) || ($scheme =~ /^svk/) || ($scheme =~ /^hg/) || ($scheme =~ /^git/) || ($scheme =~ /^cvs/)) { 
    473505    pb_system("$vcscmd add $f","Adding $f to VCS "); 
    474506} elsif ($scheme eq "flat") { 
     
    492524my $vcscmd = pb_cms_cmd($scheme); 
    493525 
    494 if (($scheme =~ /^svn/) || ($scheme =~ /^hg/) || ($scheme =~ /^git/) || ($scheme =~ /^cvs/)) { 
     526if (($scheme =~ /^svn/) || ($scheme =~ /^svk/) || ($scheme =~ /^hg/) || ($scheme =~ /^git/) || ($scheme =~ /^cvs/)) { 
    495527    open(PIPE,"$vcscmd diff $dir |") || die "Unable to get $vcscmd diff from $dir"; 
    496528    my $l = 0; 
     
    628660        pb_cms_checkout($scheme,$uri,$ENV{$envar}); 
    629661    } 
    630 } elsif (($scheme !~ /^cvs/) || ($scheme !~ /^svn/) || ($scheme !~ /^hg/) || ($scheme !~ /^git/) ) { 
     662} elsif (($scheme !~ /^cvs/) || ($scheme !~ /^svn/) || ($scheme =~ /^svk/) || ($scheme !~ /^hg/) || ($scheme !~ /^git/) ) { 
    631663    # Do not compare if it's not a real cms 
    632664    return; 
     
    749781        } 
    750782    } 
     783} elsif ($scheme =~ /^svk/) { 
     784    if (! -f "$dest/ChangeLog") { 
     785        pb_system("$vcscmd log -v $pkgdir > $dest/$ENV{'PBCMSLOGFILE'}","Extracting log info from SVK"); 
     786        } 
    751787} elsif ($scheme =~ /^hg/) { 
    752788    if (! -f "$dest/ChangeLog") { 
     
    822858} elsif ($scheme =~ /svn/) { 
    823859    return($cmd."svn") 
     860} elsif ($scheme =~ /svk/) { 
     861    return($cmd."svk") 
    824862} elsif ($scheme =~ /cvs/) { 
    825863    return($cmd."cvs") 
Note: See TracChangeset for help on using the changeset viewer.