Changeset 612 in ProjectBuilder for devel/pb/lib
- Timestamp:
- Nov 20, 2008, 8:22:22 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/lib/ProjectBuilder/CMS.pm
r600 r612 83 83 pb_cms_compliant(undef,'PBDIR',"$ENV{'PBPROJDIR'}/$tmp",$pburl->{$ENV{'PBPROJ'}},$pbinit); 84 84 85 if ($scheme =~ /^ svn/) {85 if ($scheme =~ /^hg/) { 86 86 # svnversion more precise than svn info 87 $tmp = `(cd "$ENV{'PBDIR'}" ; hg identify )`; 88 chomp($tmp); 89 $tmp =~ s/^.* //; 90 $ENV{'PBREVISION'}=$tmp; 91 $ENV{'PBCMSLOGFILE'}="hg.log"; 92 } elsif (($scheme eq "file") || ($scheme eq "ftp") || ($scheme eq "http")) { 93 $ENV{'PBREVISION'}="flat"; 94 $ENV{'PBCMSLOGFILE'}="flat.log"; 95 } elsif ($scheme =~ /^svn/) { 87 96 $tmp = `(cd "$ENV{'PBDIR'}" ; svnversion .)`; 88 97 chomp($tmp); 89 98 $ENV{'PBREVISION'}=$tmp; 90 99 $ENV{'PBCMSLOGFILE'}="svn.log"; 91 } elsif (($scheme eq "file") || ($scheme eq "ftp") || ($scheme eq "http")) {92 $ENV{'PBREVISION'}="flat";93 $ENV{'PBCMSLOGFILE'}="flat.log";94 100 } elsif ($scheme =~ /^cvs/) { 95 101 # Way too slow … … 194 200 copy($path,$destdir); 195 201 } 202 } elsif ($scheme =~ /^hg/) { 203 if (defined $source) { 204 if (-d $source) { 205 $tmp = $destdir; 206 } else { 207 $tmp = "$destdir/".basename($source); 208 } 209 $source = pb_cms_mod_hg_http($source); 210 pb_system("hg export $source $tmp","Exporting $source from Mercurial to $tmp "); 211 } else { 212 $uri = pb_cms_mod_hg_http($uri); 213 pb_system("hg export $uri $destdir","Exporting $uri from Mercurial to $destdir "); 214 } 196 215 } elsif ($scheme =~ /^cvs/) { 197 216 # CVS needs a relative path ! … … 245 264 $res =~ s/^\s*//; 246 265 close(PIPE); 266 chomp($res); 267 } elsif ($scheme =~ /^hg/) { 268 open(HGRC,".hg/hgrc/") || return(""); 269 while (<HGRC>) { 270 ($void,$res) = split(/^default.*=/) if (/^default.*=/); 271 } 272 close(HGRC); 247 273 chomp($res); 248 274 } elsif ($scheme =~ /^cvs/) { … … 284 310 The third parameter is the URL of the destination CMS content. 285 311 286 Only coded for SVN now .312 Only coded for SVN now as used for pbconf itself not the project 287 313 288 314 =cut … … 321 347 $url = pb_cms_mod_svn_http($url); 322 348 pb_system("svn co $url $destination","Checking out $url to $destination "); 349 } elsif ($scheme =~ /^hg/) { 350 $url = pb_cms_mod_hg_http($url); 351 pb_system("hg clone $url $destination","Checking out $url to $destination "); 323 352 } elsif (($scheme eq "ftp") || ($scheme eq "http")) { 324 353 return; … … 361 390 pb_system("svn up $dir","Updating $dir "); 362 391 } elsif ($scheme eq "flat") { 392 } elsif ($scheme =~ /^hg/) { 393 pb_system("cd $dir ; hg up","Updating $dir "); 363 394 } elsif ($scheme =~ /^cvs/) { 364 395 pb_system("cvs up $dir","Updating $dir "); … … 389 420 pb_system("svn ci -m \"$msg\" $dir","Checking in $dir "); 390 421 } elsif ($scheme eq "flat") { 422 } elsif ($scheme =~ /^hg/) { 423 pb_system("hg ci -m \"$msg\" $dir","Checking in $dir "); 391 424 } elsif ($scheme =~ /^cvs/) { 392 425 pb_system("cvs ci -m \"$msg\" $dir","Checking in $dir "); … … 412 445 pb_system("svn add $f","Adding $f to SVN "); 413 446 } elsif ($scheme eq "flat") { 447 } elsif ($scheme =~ /^hg/) { 448 pb_system("hg add $f","Adding $f to Mercurial "); 414 449 } elsif ($scheme =~ /^cvs/) { 415 450 pb_system("cvs add $f","Adding $f to CVS "); … … 434 469 if ($scheme =~ /^svn/) { 435 470 open(PIPE,"svn diff $dir |") || die "Unable to get svn diff from $dir"; 471 my $l = 0; 472 while (<PIPE>) { 473 $l++; 474 } 475 return($l); 476 } elsif ($scheme =~ /^hg/) { 477 open(PIPE,"hg diff $dir |") || die "Unable to get hg diff from $dir"; 436 478 my $l = 0; 437 479 while (<PIPE>) { … … 570 612 pb_cms_checkout($scheme,$uri,$ENV{$envar}); 571 613 } 572 } elsif (($scheme !~ /^cvs/) || ($scheme !~ /^svn/) ) {614 } elsif (($scheme !~ /^cvs/) || ($scheme !~ /^svn/) || ($scheme !~ /^hg/)) { 573 615 # Do not compare if it's not a real cms 574 616 return; … … 690 732 } 691 733 } 734 } elsif ($scheme =~ /^hg/) { 735 if (! -f "$dest/ChangeLog") { 736 # In case we have no network, just create an empty one before to allow correct build 737 open(CL,"> $dest/ChangeLog") || die "Unable to create $dest/ChangeLog"; 738 close(CL); 739 pb_system("hg log -v $pkgdir > $dest/$ENV{'PBCMSLOGFILE'}","Extracting log info from SVN"); 740 } 741 } 692 742 } elsif (($scheme eq "file") || ($scheme eq "dir") || ($scheme eq "http") || ($scheme eq "ftp")) { 693 743 if (! -f "$dest/ChangeLog") { … … 721 771 } 722 772 773 sub pb_cms_mod_hg_http { 774 775 my $url = shift; 776 777 $url =~ s/^hg\+(http[s]*):/$1:/; 778 return($url); 779 } 780 723 781 =back 724 782
Note:
See TracChangeset
for help on using the changeset viewer.