X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/06886d36cfdcfb94f0d67f8964d22ee7c7872018..98ec67d7860209c5cbbc848769f2ba1a7062ddef:/packaging/branch-from-patch diff --git a/packaging/branch-from-patch b/packaging/branch-from-patch index bf854b17..469f3d60 100755 --- a/packaging/branch-from-patch +++ b/packaging/branch-from-patch @@ -13,10 +13,13 @@ use Getopt::Long; ); &usage if $help_opt; +require 'packaging/git-status.pl'; +check_git_state($master_branch, !$skip_branch_check, 1); + my %local_branch; open PIPE, '-|', 'git branch -l' or die "Unable to fork: $!\n"; while () { - if (m# patch/(.*)#) { + if (m# patch/\Q$master_branch\E/(.*)#o) { $local_branch{$1} = 1; } } @@ -24,18 +27,12 @@ close PIPE; if ($delete_local_branches) { foreach my $name (sort keys %local_branch) { - my $branch = "patch/$name"; + my $branch = "patch/$master_branch/$name"; system 'git', 'branch', '-D', $branch and exit 1; } %local_branch = ( ); } -open IN, '-|', 'git status' or die $!; -my $status = join('', ); -close IN; -die "The checkout is not clean:\n", $status unless $status =~ /\nnothing to commit \(working directory clean\)/; -die "The checkout is not on the $master_branch branch.\n" unless $status =~ /^# On branch $master_branch\n/; - my @patch_list; foreach (@ARGV) { if (!-f $_) { @@ -121,10 +118,10 @@ sub create_branch $parent_branch = $commit if defined $commit; } else { create_branch("$where/$parent.diff"); - $parent_branch = "patch/$parent"; + $parent_branch = "patch/$master_branch/$parent"; } - my $branch = "patch/$name"; + my $branch = "patch/$master_branch/$name"; print "\n", '=' x 64, "\nProcessing $branch ($parent_branch)\n"; if ($local_branch{$name}) { @@ -176,7 +173,7 @@ Options: -b, --branch=BRANCH Create branches relative to BRANCH if no "based-on" header was found in the patch file. --skip-check Skip the check that ensures starting with a clean branch. - --delete Delete all the local patch/* branches, not just the ones + --delete Delete all the local patch/BASE/* branches, not just the ones that are being recreated. -h, --help Output this help message. EOT