Hey, me again... On Fri, Nov 21, 2008 at 07:03:05PM +0200, Eddy Petrișor wrote: > *Functionally* wouldn't only this part (and the code for the added > option) be enough? > > - $trunkdir = "$package/trunk"; > + # NB: no :) > + $workingdir="$package/trunk"; > + $workingdir="$package/branches/$opt_branch" if ($opt_branch); > withecho "svn up";
If I cut out all comments and stuff and don't change "trunkdir" to "workingdir" etc. it seems to lead to the attached patch (which is btw now based on the latest trunk of svn-buildpackage in collab-maint). It's obviously a lot shorter and better readable, although I may say that I still don't think it makes sense to leave "trunk" in variables which actually mean something different, but that's to be thought about when addressing #365116. Well, and now it's your turn again... :) Cheers, Hauke
Index: svn-inject =================================================================== --- svn-inject (revision 11842) +++ svn-inject (working copy) @@ -61,6 +61,7 @@ my $opt_nobranches; my $opt_savecfg; my $opt_dbgsdcommon; +my $opt_branch; #my $opt_trackmode; # parse Command line @@ -77,6 +78,7 @@ "c=i" => \$opt_checkout, "O|no-branches" => \$opt_nobranches, "s" => \$opt_savecfg, + "b=s" => \$opt_branch, "dbgsdcommon" => \$opt_dbgsdcommon ); @@ -161,6 +163,8 @@ die "Dsc file $opt_dsc not readable!\n" if (! -r $opt_dsc); +die "A new branch must not be in \"branches/upstream\"!" if ($opt_branch =~ /upstream/); + chomp(my $tempdir=`mktemp -d`); $opt_dsc = long_path($opt_dsc); @@ -260,12 +264,14 @@ $subupsVersion="$package/branches/upstream/$upsVersion"; $subupsTags="$package/branches/upstream"; $subtrunk="$package/trunk"; + $subtrunk="$package/branches/$opt_branch" if ($opt_branch); $subtags="$package/tags"; } else { $subupsCurrent="branches/upstream/$package/current"; $subupsVersion="branches/upstream/$package/$upsVersion"; $subupsTags="branches/upstream/$package"; $subtrunk="trunk/$package"; + $subtrunk="branches/$package/$opt_branch" if ($opt_branch); $subtags="tags/$package"; } @@ -293,13 +299,14 @@ if($folder_needed) { # my favorite cruft, orig tarballs without the single top level # directory. Create an extra directory for them rather then renaming - # the dir into "current" - mkdir "current"; + # the dir into $upsVersion (not current anymore, because a new injected + # branch should not overwrite current by default) + mkdir "$upsVersion"; } - withecho("mv",@filesInside, "current"); + withecho("mv",@filesInside, "$upsVersion"); if($opt_onlychanged) { - chdir "current" || die "Internal operation error, unable to create local import directory\n"; # code 42, stop before unlinking anything + chdir "$upsVersion" || die "Internal operation error, unable to create local import directory\n"; # code 42, stop before unlinking anything del_unreferenced(".", %ourfiles); } @@ -324,6 +331,8 @@ &printImportDetails; + my $tempwork; + # for non-native packages the source is in uptream/current if ($dscOrig) { withecho ("svn", $opt_svnquiet, "import", "-m", "$scriptname Installing original source of $package", @@ -345,14 +354,15 @@ if($changed_non_debian>0 || !$opt_onlychanged) { + # ONLY if not for a new branch withecho("svn", "-m", "$scriptname Tagging upstream source version of $package", "copy", - "$opt_svnurl/$subupsCurrent", - "$opt_svnurl/$subupsVersion", $opt_svnquiet); + "$opt_svnurl/$subupsVersion", + "$opt_svnurl/$subupsCurrent", $opt_svnquiet) unless($opt_branch); # the destination directory must not exist, but all up to the last level must be there SDCommon::svnMkdirP ( dirname("$opt_svnurl/$subtrunk") ) ; withecho("svn", "-m", "$scriptname Forking $package source to Trunk", "copy", - "$opt_svnurl/$subupsCurrent", + "$opt_svnurl/$subupsVersion", "$opt_svnurl/$subtrunk", $opt_svnquiet); } @@ -366,14 +376,16 @@ chdir $dirname; withecho "fakeroot debian/rules clean || debian/rules clean"; del_unreferenced(".", %ourfiles) if $opt_onlychanged; - load_dirs( "$opt_svnurl/$subtrunk", "$tempdir/trunk", "$tempdir/unpdir/$dirname"); + $tempwork="$tempdir/trunk"; + $tempwork="$tempdir/branches/$opt_branch" if ($opt_branch); + load_dirs( "$opt_svnurl/$subtrunk", "$tempwork", "$tempdir/unpdir/$dirname") if ($opt_onlychanged) { - withecho "svn", "propset", "mergeWithUpstream", 1, "$tempdir/trunk/debian"; + withecho "svn", "propset", "mergeWithUpstream", 1, "$tempwork/debian"; } &printImportDetails; - withecho("svn", "commit", "-m", "$scriptname Applying Debian modifications to trunk", "$tempdir/trunk"); + withecho("svn", "commit", "-m", "$scriptname Applying Debian modifications to trunk", "$tempwork"); } chdir $basedir; @@ -383,6 +395,7 @@ if($use_this_repo) { # FIXME: this doesn't take layout into account, does it? $trunkdir = "$package/trunk"; + $trunkdir = "$package/branches/$opt_branch" if($opt_branch); withecho "svn up"; } else { @@ -390,6 +403,7 @@ # checkout everything if ($opt_layout==1) { $trunkdir = "$basedir/$package/trunk"; + $trunkdir = "$basedir/$package/branches/$opt_branch" if($opt_branch); print "Storing copy of your repository tree in $basedir/$package.\n"; withecho "svn", "checkout", "$opt_svnurl/$package", "$basedir/$package", $opt_svnquiet; } Index: SDCommon.pm =================================================================== --- SDCommon.pm (revision 11842) +++ SDCommon.pm (working copy) @@ -534,7 +534,10 @@ # yourself with appropriate message. sub load_dirs { my $url=shift; - my $tmpdir=Cwd::abs_path(shift); + $url .= "/trunk" unless ($url =~ /(trunk|branches\/\w+)/); + my $tmpdir=shift; + # XXX Doesn't work with the new branches; don't know why yet + #my $tmpdir=Cwd::abs_path(shift); my @src; while(@_) { push(@src, Cwd::abs_path(shift)); } Index: svn-upgrade =================================================================== --- svn-upgrade (revision 11842) +++ svn-upgrade (working copy) @@ -50,6 +50,7 @@ my $opt_noninteractive; my $opt_ignoreerrors; my $opt_dbgsdcommon; +my $opt_branch; my %options = ( "h|help" => \$opt_help, @@ -62,6 +63,7 @@ "N|noautodch" => \$opt_noautodch, "noninteractive" => \$opt_noninteractive, "ignoreerrors" => \$opt_ignoreerrors, + "b=s" => \$opt_branch, "dbgsdcommon" => \&opt_dbgsdcommon );
signature.asc
Description: Digital signature