From b627c81178dd32a7bed6d3606633b5210ae15a56 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 22 Jan 2012 18:16:31 +0000 Subject: [PATCH] tb create sort of works --- Topbloke.pm | 17 +++++++++++++++++ tb-create.pl | 9 ++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Topbloke.pm b/Topbloke.pm index b1303e1..0921e9c 100644 --- a/Topbloke.pm +++ b/Topbloke.pm @@ -20,6 +20,7 @@ BEGIN { git_config git_dir chdir_toplevel current_branch parse_branch_spec setup_config check_no_unwanted_metadata + flagsfile_add_flag wf_start wf wf_abort wf_done wf_contents); %EXPORT_TAGS = ( ); @EXPORT_OK = qw(); @@ -264,6 +265,22 @@ sub check_no_unwanted_metadata ($) { qw(.topbloke)); } +sub flagsfile_add_flag ($$) { + # works on "deps" too + my ($flagsfile, $flag) = @_; + my $wf = wf_start(".topbloke/$flagsfile"); + open FI, '<', ".topbloke/$flagsfile" or die $!; + while () { + chomp or die; + die "flag $flag already set in $flagsfile ?!" if $_ eq $flag; + wf($wf, "$_\n"); + } + FI->error and die $!; + close FI or die $!; + wf($wf, "$flag\n"); + wf_done($wf); +} + sub wf_start ($) { my ($path) = @_; my $fh = new IO::File "$path.tmp", '>' or die "create $path.tmp: $!\n"; diff --git a/tb-create.pl b/tb-create.pl index 831fa10..f56764b 100755 --- a/tb-create.pl +++ b/tb-create.pl @@ -110,7 +110,7 @@ meta_and_stage('deps', "# not applicable\n"); meta_and_stage('flags', ''); if ($current->{Kind} eq 'foreign') { - meta_and_stage('included', $current->{DepSpec}); + meta_and_stage('included', $current->{DepSpec}."\n"); meta_and_stage('pflags', ''); } @@ -142,12 +142,7 @@ stage_meta('msg'); meta_and_stage('deps', "$current->{DepSpec}\n"); # we inherit empty flags from the base branch -open I, '>>', ".topbloke/included" or die $!; -print I "$newbranch\n"; -close I or die $!; +flagsfile_add_flag('included',$newbranch); stage_meta('included'); run_git(qw(commit -q -m), "create branch $spec->{Nick}\n$newbranch\n"); - - -INCLUDED IS WRONG MISSING NEWLINE -- 2.30.2