]> git.mjollnir.org Git - cil.git/commitdiff
Added the 'track' command (closes #768d9434).
authorAndrew Chilton <andychilton@gmail.com>
Sat, 5 Jul 2008 03:22:33 +0000 (15:22 +1200)
committerAndrew Chilton <andychilton@gmail.com>
Sat, 5 Jul 2008 03:22:33 +0000 (15:22 +1200)
.cil
bin/cil
issues/c_70533ec8.cil [new file with mode: 0644]
issues/i_768d9434.cil
lib/CIL.pm

diff --git a/.cil b/.cil
index 022596190fa78cec4e74f5de8ce102713bf82d49..645e44968268059ba97ceb7dcf09c309dae773bf 100644 (file)
--- 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 64c5a4f7148401988e29284b12ecd241a2a56a12..f302087e3441983b8dea59dbe9b55821783a3627 100755 (executable)
--- 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 (file)
index 0000000..bca6d44
--- /dev/null
@@ -0,0 +1,7 @@
+Issue: 768d9434
+CreatedBy: Andrew Chilton <andychilton@gmail.com>
+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.
index 28afb5b609693b1764fa83323bb375819d4a876f..16d9919f3ef2b713ac84821262aed860c345ee35 100644 (file)
@@ -1,11 +1,12 @@
 Summary: Add a command 'track'
-Status: New
+Status: Finished
 CreatedBy: Andrew Chilton <andychilton@gmail.com>
 AssignedTo: Andrew Chilton <andychilton@gmail.com>
 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
index e2aee9d27fa07172f703d6ecad0cd1207cb00953..9a87bf91a253abb772c12ecc2a9ec914bca7ac8e 100644 (file)
@@ -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} );
 }
 
 ## ----------------------------------------------------------------------------