svn commit: r207313 - user/des/fmerge

Dag-Erling Smorgrav des at FreeBSD.org
Wed Apr 28 08:58:23 UTC 2010


Author: des
Date: Wed Apr 28 08:58:22 2010
New Revision: 207313
URL: http://svn.freebsd.org/changeset/base/207313

Log:
  Add support for merging vendor / user / project branches into head:
  instead of setting $src_branch to head by default, leave it undefined
  and try to guess it from existing mergeinfo.

Modified:
  user/des/fmerge/fmerge.pl

Modified: user/des/fmerge/fmerge.pl
==============================================================================
--- user/des/fmerge/fmerge.pl	Wed Apr 28 08:39:12 2010	(r207312)
+++ user/des/fmerge/fmerge.pl	Wed Apr 28 08:58:22 2010	(r207313)
@@ -35,7 +35,7 @@ our $already;
 our $debug;
 our $pretend;
 
-our $src_branch = "head";	# where we merge from
+our $src_branch;		# where we merge from
 our $src_path;			# path relative to source branch
 our $src_url;			# source URL
 our $tgt_branch;		# where we merge to
@@ -58,11 +58,15 @@ sub debug(@) {
 	if $debug;
 }
 
+sub error(@) {
+    info(@_);
+    exit(1);
+}
+
 sub svn_check($@) {
     my ($cond, @msg) = @_;
     if (!$cond) {
-	info(@msg);
-	exit(1);
+	error(@msg);
     }
 }
 
@@ -126,9 +130,19 @@ sub examine() {
     $fh = svn_catch('propget', 'svn:mergeinfo', $tgt_dir);
     while (<$fh>) {
 	chomp();
-	debug("'$_' =~ m\@^\Q/$src_branch\E((?:/[\\w.-]+)*):\@");
-	next unless m@^\Q/$src_branch\E((?:/[\w.-]+)*):@;
-	my $subdir = $1;
+	my $subdir;
+	if ($src_branch) {
+	    debug("have src_branch = $src_branch");
+	    debug("'$_' =~ m\@^\Q/$src_branch\E((?:/[\\w.-]+)*):\@");
+	    next unless m@^\Q/$src_branch\E((?:/[\w.-]+)*):@;
+	    $subdir = 1;
+	} else {
+	    debug("no src_branch");
+	    next unless m@^((?:/[\w.-]+)*):@;
+	    $src_branch = $1;
+	    $subdir = "";
+	}
+	debug("subdir = $subdir");
 	debug("'$svn_path' =~ m\@^((?:/[\\w.-]+)+)\Q$subdir\E\$\@");
 	next unless $svn_path =~ m@^((?:/[\w.-]+)+)\Q$subdir\E$@;
 	$svn_path = $subdir;
@@ -137,6 +151,10 @@ sub examine() {
     }
     close($fh);
 
+    if (!$src_branch) {
+	error("not enough information to deduce source or target");
+    }
+
     if (!$tgt_branch) {
 	# try to guess a stable / releng / release branch
 	debug("guessing target branch");


More information about the svn-src-user mailing list