Index: /devel/pb/lib/ProjectBuilder/Env.pm
===================================================================
--- /devel/pb/lib/ProjectBuilder/Env.pm	(revision 430)
+++ /devel/pb/lib/ProjectBuilder/Env.pm	(revision 452)
@@ -168,4 +168,13 @@
 
 pb_log(2,"PBDEFDIR: $ENV{'PBDEFDIR'}\n");
+
+# Put under CMS the PBPROJ dir
+if (defined $pbinit) {
+	if (! -d "$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}") {
+		pb_mkdir_p("$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}") || die "Unable to recursively create $ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}";
+	}
+	pb_cms_add($pbconf{$ENV{'PBPROJ'}},"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}");
+}
+
 #
 # Set delivery directory
@@ -212,5 +221,5 @@
 # return values in that case are useless
 #
-if (($action =~ /^cms2/) || ($action =~ /^newver$/) || ($action =~ /^pbinit$/)) {
+if (($action =~ /^cms2/) || ($action =~ /^newver$/) || ($action =~ /pbinit/) || ($action =~ /^newproj$/)) {
 
 	#
@@ -240,7 +249,7 @@
 			}
 			closedir(DIR);
-			die "No directory found under $ENV{'PBCONFDIR'}" if (not defined $ENV{'PBROOTDIR'});
 			pb_log(1,"WARNING: no pbroot defined, using $ENV{'PBROOTDIR'}\n");
 			pb_log(1,"         Please use -r release if you want to use another release\n");
+			die "No directory found under $ENV{'PBCONFDIR'}" if (not defined $ENV{'PBROOTDIR'});
 		} else {
 			my ($pbroot) = pb_conf_read_if("$ENV{'PBDESTDIR'}/pbrc","pbroot");
@@ -318,6 +327,5 @@
 	} else {
 		if (defined $pbinit) {
-			my $ptr = pb_get_pkg();
-			my @pkgs = @$ptr;
+			my @pkgs = @ARGV;
 			@pkgs = ("pkg1") if (not @pkgs);
 	
@@ -837,6 +845,7 @@
 				pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/pbfilter") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/pbfilter";
 	
-				pb_log(0,"\nDo not to forget to commit the pbconf directory in your CMS if needed\n");
 			}
+			pb_cms_add($pbconf{$ENV{'PBPROJ'}},$ENV{'PBCONFDIR'});
+			pb_cms_checkin($pbconf{$ENV{'PBPROJ'}},"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}",$pbinit);
 		} else {
 			die "Unable to open $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
Index: /devel/pb/lib/ProjectBuilder/CMS.pm
===================================================================
--- /devel/pb/lib/ProjectBuilder/CMS.pm	(revision 448)
+++ /devel/pb/lib/ProjectBuilder/CMS.pm	(revision 452)
@@ -29,5 +29,5 @@
  
 our @ISA = qw(Exporter);
-our @EXPORT = qw(pb_cms_init pb_cms_export pb_cms_get_uri pb_cms_copy pb_cms_checkout pb_cms_up pb_cms_checkin pb_cms_isdiff pb_cms_get_pkg pb_cms_compliant pb_cms_log);
+our @EXPORT = qw(pb_cms_init pb_cms_export pb_cms_get_uri pb_cms_copy pb_cms_checkout pb_cms_up pb_cms_checkin pb_cms_isdiff pb_cms_get_pkg pb_cms_compliant pb_cms_log pb_cms_add);
 
 =pod
@@ -336,4 +336,5 @@
 The first parameter is the schema of the CMS systems (svn, cvs, svn+ssh, ...)
 The second parameter is the directory to update from.
+The third parameter indicates if we are in a new version creation (undef) or in a new project creation (1)
 
 =cut
@@ -342,15 +343,42 @@
 my $scheme = shift;
 my $dir = shift;
+my $pbinit = shift || undef;
 
 my $ver = basename($dir);
-if ($scheme =~ /^svn/) {
-	pb_system("svn ci -m \"updated to $ver\" $dir","Checking in $dir");
+my $msg = "updated to $ver";
+$msg = "Project $ENV{PBPROJ} creation" if (defined $pbinit);
+
+if ($scheme =~ /^svn/) {
+	pb_system("svn ci -m \"$msg\" $dir","Checking in $dir");
 } elsif ($scheme eq "flat") {
 } elsif ($scheme =~ /^cvs/) {
-	pb_system("cvs ci -m \"updated to $ver\" $dir","Checking in $dir");
+	pb_system("cvs ci -m \"$msg\" $dir","Checking in $dir");
 } else {
 	die "cms $scheme unknown";
 }
 pb_cms_up($scheme,$dir);
+}
+
+=item B<pb_cms_add>
+
+This function adds to a CMS content from a local directory.
+The first parameter is the schema of the CMS systems (svn, cvs, svn+ssh, ...)
+The second parameter is the directory/file to add.
+
+=cut
+
+sub pb_cms_add {
+my $scheme = shift;
+my $f = shift;
+
+if ($scheme =~ /^svn/) {
+	pb_system("svn add $f","Adding $f to SVN");
+} elsif ($scheme eq "flat") {
+} elsif ($scheme =~ /^cvs/) {
+	pb_system("cvs add $f","Adding $f to CVS");
+} else {
+	die "cms $scheme unknown";
+}
+pb_cms_up($scheme,$f);
 }
 
Index: /devel/pb/bin/pb
===================================================================
--- /devel/pb/bin/pb	(revision 450)
+++ /devel/pb/bin/pb	(revision 452)
@@ -1331,5 +1331,5 @@
 
 	pb_log(2,"Checkin $ENV{'PBROOTDIR'}/../$newver\n");
-	pb_cms_checkin($scheme,"$ENV{'PBROOTDIR'}/../$newver");
+	pb_cms_checkin($scheme,"$ENV{'PBROOTDIR'}/../$newver",undef);
 }
 
