X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;ds=sidebyside;f=tb-create.pl;h=a3fd1b37e6c86d23288d19ee84616eece18a8692;hb=83d7f96819431734fc09891439ffdcc27b67aa3b;hp=2b456807d23fc2633925d04d169476b2568cc46e;hpb=faf0b5afe4a557285034a0230bb294ee49b34cdb;p=topbloke.git diff --git a/tb-create.pl b/tb-create.pl index 2b45680..a3fd1b3 100755 --- a/tb-create.pl +++ b/tb-create.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -# usage: tb-create +# usage: tb-create use warnings; use strict; @@ -11,14 +11,14 @@ Getopt::Long::Configure(qw(bundling)); die "bad usage\n" unless @ARGV==1; -our $spec = parse_branch_spec($ARGV[0]); +our $spec = parse_patch_spec($ARGV[0]); our $current = current_branch(); -die "cannot make branch starting at base of another;". - " check out a real branch\n" if $current->{Kind} eq 'base'; +die "cannot make patch starting at base of another;". + " check out a real branch or patch\n" if $current->{Kind} eq 'base'; die "strange branch ref $current->{Kind} $current->{Ref},\n". - " making new branch with this as dep is unwise\n" + " making new patch with this as dep is unwise\n" unless ($current->{Kind} eq 'foreign' || $current->{Kind} eq 'tip'); @@ -40,6 +40,8 @@ if (!defined $spec->{Date}) { chomp $spec->{Date} or die $!; } +defined $spec->{Nick} or die "no patch nickname specified\n"; + length($spec->{Date})==18 or die "partial date specified, not supported\n"; chdir_toplevel(); @@ -47,10 +49,10 @@ chdir_toplevel(); check_no_unwanted_metadata('HEAD') if $current->{Kind} ne 'tip'; -run_git_check_nooutput("cannot create new topbloke branch with staged file(s)", +run_git_check_nooutput("cannot create new patch with staged file(s)", qw(diff --cached --name-only HEAD --)); -run_git_check_nooutput("cannot create new topbloke branch with". +run_git_check_nooutput("cannot create new patch with". " modified metadata file(s)", qw(diff --name-only HEAD -- .topbloke)); @@ -60,16 +62,16 @@ run_git_check_nooutput("cannot create new topbloke branch with". # For .topbloke/msg, if it's modified by the user (ie, if working # version differs from HEAD) we keep that and stage it. -my $newbranch = "$spec->{Email}\@$spec->{Domain}/$spec->{Date}/$spec->{Nick}"; +my $newpatch = "$spec->{Email}\@$spec->{Domain}/$spec->{Date}/$spec->{Nick}"; -$newbranch = run_git_1line(qw(check-ref-format --print), $newbranch); +$newpatch = run_git_1line(qw(check-ref-format --print), $newpatch); my $author = run_git_1line(qw(var GIT_AUTHOR_IDENT)); $author =~ s/ \d+ [-+]\d+$// or die $!; my $subjprefix = git_config('topbloke.subjectprefix', ''); -printf "creating %s\n", $newbranch; +printf "creating %s\n", $newpatch; setup_config(); @@ -100,10 +102,10 @@ if (lstat '.topbloke') { mkdir('.topbloke') or die "create .topbloke: $!\n"; } -my $baseref = "refs/topbloke-bases/$newbranch"; +my $baseref = "refs/topbloke-bases/$newpatch"; create_and_switch($baseref); -run_git(qw(update-ref -m), "tb-create base $newbranch", $baseref, 'HEAD'); +run_git(qw(update-ref -m), "tb-create base $newpatch", $baseref, 'HEAD'); run_git(qw(symbolic-ref HEAD), $baseref); meta_and_stage('msg', "# not applicable\n"); @@ -115,11 +117,11 @@ if ($current->{Kind} eq 'foreign') { meta_and_stage('pflags', ''); } -run_git(qw(commit -q -m), "create base branch $newbranch"); +run_git(qw(commit -q -m), "tb-create base $newpatch"); #----- create the tip branch -my $tipref = "refs/topbloke-tips/$newbranch"; +my $tipref = "refs/topbloke-tips/$newpatch"; create_and_switch($tipref); my $nm = wf_start('.topbloke/msg'); @@ -143,7 +145,7 @@ stage_meta('msg'); meta_and_stage('deps', "$current->{DepSpec}\n"); # we inherit empty flags from the base branch -flagsfile_add_flag('included',$newbranch); +flagsfile_add_flag('included',$newpatch); stage_meta('included'); -run_git(qw(commit -q -m), "create branch $spec->{Nick}\n$newbranch\n"); +run_git(qw(commit -q -m), "tb-create tip $spec->{Nick}\n$newpatch\n");