Changeset 1678 in ProjectBuilder for devel/pb-modules/lib/ProjectBuilder/VCS.pm
- Timestamp:
- Nov 16, 2012, 9:06:13 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb-modules/lib/ProjectBuilder/VCS.pm
r1586 r1678 35 35 36 36 our @ISA = qw(Exporter); 37 our @EXPORT = qw(pb_vcs_export pb_vcs_get_uri pb_vcs_copy pb_vcs_checkout pb_vcs_up pb_vcs_checkin pb_vcs_isdiff pb_vcs_add pb_vcs_ cmd);37 our @EXPORT = qw(pb_vcs_export pb_vcs_get_uri pb_vcs_copy pb_vcs_checkout pb_vcs_up pb_vcs_checkin pb_vcs_isdiff pb_vcs_add pb_vcs_add_if_not_in pb_vcs_cmd); 38 38 ($VERSION,$REVISION) = pb_version_init(); 39 39 … … 112 112 } else { 113 113 # Look at svk admin hotcopy 114 die"Unable to export from svk without a source defined";114 confess "Unable to export from svk without a source defined"; 115 115 } 116 116 } elsif ($scheme eq "dir") { … … 131 131 if ($@) { 132 132 # File::MimeInfo not found 133 die("ERROR: Install File::MimeInfo to handle scheme $scheme\n");133 confess("ERROR: Install File::MimeInfo to handle scheme $scheme\n"); 134 134 } 135 135 … … 220 220 pb_system("cd $dir ; $vcscmd -d $account\@$host:$path export $cvsopt -d $base $tmp1","Exporting $tmp1 from $source under CVS to $destdir "); 221 221 } else { 222 die"cms $scheme unknown";222 confess "cms $scheme unknown"; 223 223 } 224 224 return(undef); … … 243 243 244 244 if ($scheme =~ /^svn/) { 245 open(PIPE,"LANGUAGE=C $vcscmd info $dir |") || return("");245 open(PIPE,"LANGUAGE=C $vcscmd info $dir 2> /dev/null |") || return(""); 246 246 while (<PIPE>) { 247 247 ($void,$res) = split(/^URL:/) if (/^URL:/); … … 251 251 chomp($res); 252 252 } elsif ($scheme =~ /^svk/) { 253 open(PIPE,"LANGUAGE=C $vcscmd info $dir |") || return("");253 open(PIPE,"LANGUAGE=C $vcscmd info $dir 2> /dev/null |") || return(""); 254 254 my $void2 = ""; 255 255 while (<PIPE>) { … … 267 267 chomp($res); 268 268 } elsif ($scheme =~ /^git/) { 269 open(GIT,"git --git-dir=$dir/.git remote -v |") || return("");269 open(GIT,"git --git-dir=$dir/.git remote -v 2> /dev/null |") || return(""); 270 270 while (<GIT>) { 271 271 next unless (/^origin\s+(\S+) \(push\)$/); … … 277 277 } elsif ($scheme =~ /^cvs/) { 278 278 # This path is always the root path of CVS, but we may be below 279 open(FILE,"$dir/CVS/Root") || die"$dir isn't CVS controlled";279 open(FILE,"$dir/CVS/Root") || confess "$dir isn't CVS controlled"; 280 280 $res = <FILE>; 281 281 chomp($res); … … 286 286 $rdir = dirname($rdir); 287 287 } 288 die"Unable to find a CVSROOT dir in the parents of $dir" if (! -d "$rdir/CVSROOT");288 confess "Unable to find a CVSROOT dir in the parents of $dir" if (! -d "$rdir/CVSROOT"); 289 289 #compute our place under that root dir - should be a relative path 290 290 $dir =~ s|^$rdir||; … … 300 300 $res = $prefix.$res.$suffix; 301 301 } else { 302 die"cms $scheme unknown";302 confess "cms $scheme unknown"; 303 303 } 304 304 pb_log(1,"pb_vcs_get_uri returns $res\n"); … … 332 332 # Nothing to do. 333 333 } else { 334 die"cms $scheme unknown for project management";334 confess "cms $scheme unknown for project management"; 335 335 } 336 336 } … … 385 385 pb_vcs_export($url,undef,$destination); 386 386 } else { 387 die"cms $scheme unknown";387 confess "cms $scheme unknown"; 388 388 } 389 389 } … … 411 411 # Nothing to do. 412 412 } else { 413 die"cms $scheme unknown";413 confess "cms $scheme unknown"; 414 414 } 415 415 } … … 437 437 # Nothing to do. 438 438 } else { 439 die"cms $scheme unknown";439 confess "cms $scheme unknown"; 440 440 } 441 441 pb_vcs_up($scheme,$dir); 442 } 443 444 =item B<pb_vcs_add_if_not_in> 445 446 This function adds to a VCS content from a local directory if the content wasn't already managed under th VCS. 447 The first parameter is the schema of the VCS systems (svn, cvs, svn+ssh, ...) 448 The second parameter is a list of directory/file to add. 449 450 =cut 451 452 sub pb_vcs_add_if_not_in { 453 my $scheme = shift; 454 my @f = @_; 455 my $vcscmd = pb_vcs_cmd($scheme); 456 457 if ($scheme =~ /^((hg)|(git)|(svn)|(svk)|(cvs))/o) { 458 for my $f (@f) { 459 my $uri = pb_vcs_get_uri($scheme,$f); 460 pb_vcs_add($scheme,$f) if ($uri !~ /^$scheme/); 461 } 462 } elsif ($scheme =~ /^(flat)|(ftp)|(http)|(file)\b/o) { 463 # Nothing to do. 464 } else { 465 confess "cms $scheme unknown"; 466 } 442 467 } 443 468 … … 460 485 # Nothing to do. 461 486 } else { 462 die"cms $scheme unknown";487 confess "cms $scheme unknown"; 463 488 } 464 489 pb_vcs_up($scheme,@f); … … 480 505 481 506 if ($scheme =~ /^((svn)|(cvs)|(svk))/o) { 482 open(PIPE,"$vcscmd diff $dir |") || die"Unable to get $vcscmd diff from $dir";507 open(PIPE,"$vcscmd diff $dir |") || confess "Unable to get $vcscmd diff from $dir"; 483 508 $l = 0; 484 509 while (<PIPE>) { … … 490 515 $l = 0; 491 516 } else { 492 die"cms $scheme unknown";517 confess "cms $scheme unknown"; 493 518 } 494 519 pb_log(1,"pb_vcs_isdiff returns $l\n"); … … 552 577 return($cmd."$command -o "); 553 578 } else { 554 die"Unable to handle $scheme.\nNo wget/curl available, please install one of those";579 confess "Unable to handle $scheme.\nNo wget/curl available, please install one of those"; 555 580 } 556 581 }
Note:
See TracChangeset
for help on using the changeset viewer.