- Timestamp:
- Nov 29, 2013, 7:45:03 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb-modules/lib/ProjectBuilder/VCS.pm
r1678 r1800 16 16 use strict 'vars'; 17 17 use Carp 'confess'; 18 use Cwd 'abs_path'; 18 19 use Data::Dumper; 19 20 use English; … … 184 185 } 185 186 } elsif ($scheme =~ /^git/) { 186 if (defined $source) { 187 if (-d $source) { 188 $tmp = $destdir; 187 if ($scheme =~ /svn/) { 188 if (defined $source) { 189 if (-d $source) { 190 $tmp = $destdir; 191 } else { 192 $tmp = "$destdir/".basename($source); 193 } 194 $source = pb_vcs_mod_htftp($source,"git"); 195 pb_system("$vcscmd clone $source $tmp","Exporting $source from $scheme to $tmp "); 189 196 } else { 190 $tmp = "$destdir/".basename($source); 191 } 192 $source = pb_vcs_mod_htftp($source,"git"); 193 pb_system("cd $source ; $vcscmd archive --format=tar HEAD | (mkdir $tmp && cd $tmp && tar xf -)","Exporting $source/HEAD from GIT to $tmp "); 194 } else { 195 $uri = pb_vcs_mod_htftp($uri,"git"); 196 pb_system("$vcscmd clone $uri $destdir","Exporting $uri from GIT to $destdir "); 197 $uri = pb_vcs_mod_htftp($uri,"git"); 198 pb_system("$vcscmd clone $uri $destdir","Exporting $uri from $scheme to $destdir "); 199 } 200 } else { 201 if (defined $source) { 202 if (-d $source) { 203 $tmp = $destdir; 204 } else { 205 $tmp = "$destdir/".basename($source); 206 } 207 $source = pb_vcs_mod_htftp($source,"git"); 208 pb_system("cd $source ; $vcscmd archive --format=tar HEAD | (mkdir $tmp && cd $tmp && tar xf -)","Exporting $source/HEAD from GIT to $tmp "); 209 } else { 210 $uri = pb_vcs_mod_htftp($uri,"git"); 211 pb_system("$vcscmd clone $uri $destdir","Exporting $uri from GIT to $destdir "); 212 } 197 213 } 198 214 } elsif ($scheme =~ /^cvs/) { … … 267 283 chomp($res); 268 284 } elsif ($scheme =~ /^git/) { 269 open(GIT,"git --git-dir=$dir/.git remote -v 2> /dev/null |") || return(""); 270 while (<GIT>) { 271 next unless (/^origin\s+(\S+) \(push\)$/); 272 return $1; 273 } 274 close(GIT); 275 warn "Unable to find origin remote for $dir"; 276 return ""; 285 if ($scheme =~ /svn/) { 286 my $cwd = abs_path(); 287 chdir($dir) || return("");; 288 open(PIPE,"LANGUAGE=C $vcscmd info . 2> /dev/null |") || return(""); 289 chdir($cwd) || return(""); 290 while (<PIPE>) { 291 ($void,$res) = split(/^URL:/) if (/^URL:/); 292 } 293 $res =~ s/^\s*//; 294 close(PIPE); 295 chomp($res); 296 # We've got an SVN ref so add git in front of it for coherency 297 $res = "git+".$res; 298 } else { 299 # Pure git 300 open(GIT,"LANGUAGE=C $vcscmd --git-dir=$dir/.git remote -v 2> /dev/null |") || return(""); 301 while (<GIT>) { 302 next unless (/^origin\s+(\S+) \(push\)$/); 303 return $1; 304 } 305 close(GIT); 306 warn "Unable to find remote origin for $dir"; 307 return ""; 308 } 277 309 } elsif ($scheme =~ /^cvs/) { 278 310 # This path is always the root path of CVS, but we may be below … … 492 524 =item B<pb_vcs_isdiff> 493 525 494 This function returns a integer indicating the number f differences between the VCS content and the local directory where it's checked out.526 This function returns a integer indicating the number of differences between the VCS content and the local directory where it's checked out. 495 527 The first parameter is the schema of the VCS systems (svn, cvs, svn+ssh, ...) 496 528 The second parameter is the directory to consider. … … 559 591 560 592 if ($scheme =~ /hg/) { 561 return($cmd."hg".$cmdopt)593 $cmd .= "hg".$cmdopt; 562 594 } elsif ($scheme =~ /git/) { 563 return($cmd."git".$cmdopt) 595 if ($scheme =~ /svn/) { 596 $cmd .= "git svn".$cmdopt; 597 } else { 598 $cmd .= "git".$cmdopt; 599 } 564 600 } elsif ($scheme =~ /svn/) { 565 return($cmd."svn".$cmdopt)601 $cmd .= "svn".$cmdopt; 566 602 } elsif ($scheme =~ /svk/) { 567 return($cmd."svk".$cmdopt)603 $cmd .= "svk".$cmdopt; 568 604 } elsif ($scheme =~ /cvs/) { 569 return($cmd."cvs".$cmdopt)605 $cmd .= "cvs".$cmdopt; 570 606 } elsif (($scheme =~ /http/) || ($scheme =~ /ftp/)) { 571 607 my $command = pb_check_req("wget",1); 572 608 if (-x $command) { 573 return($cmd."$command -nv -O ");609 $cmd .= "$command -nv -O "; 574 610 } else { 575 611 $command = pb_check_req("curl",1); 576 612 if (-x $command) { 577 return($cmd."$command -o ");613 $cmd .= "$command -o "; 578 614 } else { 579 615 confess "Unable to handle $scheme.\nNo wget/curl available, please install one of those"; … … 581 617 } 582 618 } else { 583 return($cmd); 584 } 619 $cmd = ""; 620 } 621 pb_log(3,"pb_vcs_cmd returns $cmd\n"); 622 return($cmd); 585 623 } 586 624
Note:
See TracChangeset
for help on using the changeset viewer.