From: Andrew Chilton Date: Sat, 5 Jul 2008 03:22:33 +0000 (+1200) Subject: Added the 'track' command (closes #768d9434). X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=931c619d37bfd6c3d121c5409f4f4cbf77b8789d;p=cil.git Added the 'track' command (closes #768d9434). --- diff --git a/.cil b/.cil index 0225961..645e449 100644 --- a/.cil +++ b/.cil @@ -1,3 +1,4 @@ +VCS: Git StatusStrict: 1 StatusAllowedList: New StatusAllowedList: InProgress diff --git a/bin/cil b/bin/cil index 64c5a4f..f302087 100755 --- a/bin/cil +++ b/bin/cil @@ -380,6 +380,26 @@ sub cmd_extract { write_file( $filename, $attachment->as_binary ); } +sub cmd_track { + my ($cil, $args, $issue_name) = @_; + + fatal("the 'VCS' option in your .cil file is not set") + unless defined $cil->VCS; + + fatal("the 'VCS' option currently only supports values of 'Git'") + unless $cil->VCS eq 'Git'; + + my $issue = load_issue_fuzzy($cil, $issue_name); + + # add the issue to Git + my $issue_dir = $cil->IssueDir(); + my @files; + push @files, "$issue_dir/i_" . $issue->name . '.cil'; + push @files, map { "$issue_dir/c_${_}.cil" } @{ $issue->CommentList }; + push @files, map { "$issue_dir/a_${_}.cil" } @{ $issue->AttachmentList }; + msg("git add @files"); +} + sub cmd_fsck { my ($cil, $args) = @_; @@ -1061,6 +1081,8 @@ Commands: comment ISSUE attach ISSUE FILENAME extract ATTACHMENT [--filename=FILENAME] + am EMAIL.TXT + track ISSUE fsck Filters: @@ -1108,6 +1130,7 @@ cil - the command-line issue list $ cil am email.txt + $ cil track $ cil fsck =head1 DESCRIPTION @@ -1187,11 +1210,6 @@ Adds that particular filename to an existing issue. Extracts the file from the attachment number. If filename if given uses that, otherwise it will use the original one saved along with the attachment. -=item fsck - -Tries to help you organise your issues if any aren't valid or have broken -relationships. - =item am Applies an email message to the issue list. It tries to figure out the type of @@ -1202,6 +1220,17 @@ issue names, it presumes it's a new issue and adds that. Note: this command will deal with Mailbox format files later on. +=item track ISSUE + +This command outputs one or more command which you should run so that your VCS +knows about your issue. It makes sure all the comments and attachments are done +too. + +=item fsck + +Tries to help you organise your issues if any aren't valid or have broken +relationships. + =back =head1 FILTERS @@ -1250,6 +1279,7 @@ may be declared multiple times: The C<.cil> file is fairly simple and an example can be seen here: + VCS: Git StatusStrict: 1 StatusAllowedList: New StatusAllowedList: InProgress @@ -1266,6 +1296,13 @@ The C<.cil> file is fairly simple and an example can be seen here: =over +=item VCS + +Default: empty, Type: Enum(Git) + +Currently this option only supports Git. This enables you to use the 'track' +command. + =item StatusStrict Default: 0, Type: Boolean (0/1) diff --git a/issues/c_70533ec8.cil b/issues/c_70533ec8.cil new file mode 100644 index 0000000..bca6d44 --- /dev/null +++ b/issues/c_70533ec8.cil @@ -0,0 +1,7 @@ +Issue: 768d9434 +CreatedBy: Andrew Chilton +Inserted: 2008-07-05T03:08:49 +Updated: 2008-07-05T03:09:11 + +Done. For now it just loops through the comments and attachments, though there +is no checking done. diff --git a/issues/i_768d9434.cil b/issues/i_768d9434.cil index 28afb5b..16d9919 100644 --- a/issues/i_768d9434.cil +++ b/issues/i_768d9434.cil @@ -1,11 +1,12 @@ Summary: Add a command 'track' -Status: New +Status: Finished CreatedBy: Andrew Chilton AssignedTo: Andrew Chilton Label: Milestone-v0.5 Label: Type-Enhancement +Comment: 70533ec8 Inserted: 2008-07-05T02:58:20 -Updated: 2008-07-05T03:04:11 +Updated: 2008-07-05T03:09:11 A new command called 'track' would be good so that you can tell 'cil' to tell your CVS which files to track. This means you don't have to keep adding all diff --git a/lib/CIL.pm b/lib/CIL.pm index e2aee9d..9a87bf9 100644 --- a/lib/CIL.pm +++ b/lib/CIL.pm @@ -30,6 +30,7 @@ __PACKAGE__->mk_accessors(qw( IssueDir StatusStrict StatusAllowed StatusOpen StatusClosed LabelStrict LabelAllowed + VCS UserName UserEmail )); @@ -249,6 +250,8 @@ sub read_config_file { $self->LabelStrict( $cfg->{LabelStrict} ); $self->LabelAllowed( $cfg->{LabelAllowed} ); + + $self->VCS( $cfg->{VCS} ); } ## ----------------------------------------------------------------------------