From 68c0b1e19dd90db236a5b9dd862ab3251c0817a0 Mon Sep 17 00:00:00 2001 From: Andrew Chilton Date: Sat, 5 Jul 2008 15:52:40 +1200 Subject: Imported Upstream version 0.5.0 --- .cil | 1 + Changes | 44 +++++++++++++++++++++ INSTALLATION | 2 +- README | 10 +++++ bin/cil | 103 ++++++++++++++++++++++++++++++++++++++++++++----- debian-etch/changelog | 10 ++++- debian-lenny/changelog | 8 ++++ issues/c_3da3fd2f.cil | 6 +++ issues/c_70533ec8.cil | 7 ++++ issues/c_a8edef8d.cil | 7 ++++ issues/i_6b087805.cil | 13 +++++++ issues/i_768d9434.cil | 28 ++++++++++++++ issues/i_a90ad11f.cil | 5 ++- lib/CIL.pm | 26 +++++++++---- lib/CIL/Utils.pm | 2 +- 15 files changed, 249 insertions(+), 23 deletions(-) create mode 100644 Changes create mode 100644 issues/c_3da3fd2f.cil create mode 100644 issues/c_70533ec8.cil create mode 100644 issues/c_a8edef8d.cil create mode 100644 issues/i_6b087805.cil create mode 100644 issues/i_768d9434.cil 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/Changes b/Changes new file mode 100644 index 0000000..67e92c6 --- /dev/null +++ b/Changes @@ -0,0 +1,44 @@ +0.5.0 (Unreleased) + + * 'steal' command added + * 'track' command added + +0.4.2 (2008-07-04) + + * Fix bug where new issues are assigned to the reporter + * Fix bug where only one item in a config list breaks listings + +0.4.1 (2008-07-03) + + * Fix dependency on libemail-date-perl + +0.4.0 (2008-07-02) + + * Can now read a ~/.cilrc file for user defined options + * 'am' added - which applies a mailbox + * Can now use shortened hash names to the commands + * Allows dependencies between issues + * New filter called --is-mine + +0.3.0 (2008-06-29) + + * Added filters for the listing commands + * Added ability to read .cil config file + * Can now set which Statuses are valid + * Can set which Labels are valid + * Added 'fsck' command + * Added bash completion for options, commands and entities + +0.2.1 (2008-06-24) + + * Bug fix + +0.2.0 (2008-06-22) + + * Change to newer format for saving all issue + * Addition of attachments + * 'status' command added + +0.1.0 (2008-05-05) + + * Initial release diff --git a/INSTALLATION b/INSTALLATION index e46413c..eb5e0f3 100644 --- a/INSTALLATION +++ b/INSTALLATION @@ -43,7 +43,7 @@ Debian paackage: which can then be installed with: - $ sudo dpkg -i ../cil_0.4.2_all.deb + $ sudo dpkg -i ../cil_0.5.0_all.deb or added to a repository you are using for easier installation with apt-get or aptitude. diff --git a/README b/README index bceb623..27404a5 100644 --- a/README +++ b/README @@ -100,4 +100,14 @@ run this to do checks regarding the whole issue list: That's it for now. As you can see, if you've played with any kind of bug/issue tracker before, 'cil' is straightforward. +Sometimes, you might add someone else repository from which you want to fetch +both code and issues. If you merge a new issue and you want to assign it to +yourself, instead of editing the issue and having to type in your name and +email, just use 'cil steal'. This will assign the issue to yourself and save it +back out: + + $ cil steal cafebabe + +Then just commit it to your VCS. + =============================================================================== diff --git a/bin/cil b/bin/cil index 5aaa020..1727a09 100755 --- a/bin/cil +++ b/bin/cil @@ -39,7 +39,7 @@ use CIL::Attachment; my $y = 'y'; -use constant VERSION => '0.4.2'; +use constant VERSION => '0.5.0'; my @IN_OPTS = ( # strings @@ -57,6 +57,7 @@ my @IN_OPTS = ( 'assigned-to>a',# for 'summary', 'list' # booleans + 'bare', # for 'init' 'is-open', # for 'summary', 'list' 'is-closed', # for 'summary', 'list' 'is-mine', # for 'summary', 'list' @@ -67,6 +68,7 @@ my @IN_OPTS = ( my %BOOLEAN_ARGS = ( 'help' => 1, 'version' => 1, + 'bare' => 1, 'is-open' => 1, 'is-closed' => 1, 'is-mine' => 1, @@ -138,9 +140,29 @@ sub cmd_init { } # create a .cil file here also - unless ( touch $config ) { - rmdir $issues_dir; - fatal("couldn't create a '$config' file"); + if ( $args->{bare} ) { + unless ( touch $config ) { + rmdir $issues_dir; + fatal("couldn't create a '$config' file"); + } + } + else { + # write a default .cil file + write_file($config, <<'CONFIG'); +StatusStrict: 1 +StatusAllowedList: New +StatusAllowedList: InProgress +StatusAllowedList: Finished +StatusOpenList: New +StatusOpenList: InProgress +StatusClosedList: Finished +LabelStrict: 1 +LabelAllowedList: Type-Enhancement +LabelAllowedList: Type-Defect +LabelAllowedList: Priority-High +LabelAllowedList: Priority-Medium +LabelAllowedList: Priority-Low +CONFIG } # add a README.txt so people know what this is about @@ -221,6 +243,19 @@ sub cmd_status { display_issue($cil, $issue); } +sub cmd_steal { + my ($cil, undef, $issue_name) = @_; + + # firstly, read the issue in + my $issue = load_issue_fuzzy( $cil, $issue_name ); + + # set the AssignedTo for this issue to you (because you're stealing it) + $issue->AssignedTo( user($cil) ); + $issue->save($cil); + + display_issue($cil, $issue); +} + sub cmd_add { my ($cil, undef, $issue_name) = @_; @@ -345,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) = @_; @@ -1021,10 +1076,13 @@ Commands: list [FILTERS...] show ISSUE status ISSUE NEW_STATUS + steal ISSUE edit ISSUE comment ISSUE attach ISSUE FILENAME extract ATTACHMENT [--filename=FILENAME] + am EMAIL.TXT + track ISSUE fsck Filters: @@ -1072,6 +1130,7 @@ cil - the command-line issue list $ cil am email.txt + $ cil track $ cil fsck =head1 DESCRIPTION @@ -1081,11 +1140,15 @@ and attachments as local files which you can check in to your repository. =over -=item init [--path=PATH] +=item init [--path=PATH] [--bare] Creates a local '.cil' file and an 'issues' directory. If PATH is specified, the config file and directory will be created in the destination directory. +Usually, cil will write a small C<.cil> file such that you can use various +filter commands immediately and can also serve as an example config file. Using +C<--bare> just touches the C<.cil> config file ready for your own manipulation. + =item summary [filters] Displays a one line summary for each issue. You may filter on both the Status @@ -1124,6 +1187,12 @@ completeness. ie. issue 1 has to be completed before issue 2. Shortcut so that you can set a new status on an issue without having to edit it. +=item steal ISSUE + +Shortcut to assign this issue to yourself. It reads your C<~/.cilrc> file for +your UserName and UserEmail and uses this to populate the C field +in the issue. + =item edit ISSUE Edits the issue. If it changes, set the updates time to now. @@ -1141,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 @@ -1156,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 @@ -1204,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 @@ -1220,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/debian-etch/changelog b/debian-etch/changelog index 6218950..fdbe53a 100644 --- a/debian-etch/changelog +++ b/debian-etch/changelog @@ -1,10 +1,18 @@ +cil (0.5.0) unstable; urgency=low + + * Fix bug when running certain commands (inc. init) + * Added command 'steal' + * Added command 'track' + + -- Andrew Chilton Sat, 05 Jul 2008 15:36:22 +1200 + cil (0.4.2) unstable; urgency=low * Fix bug where new issues are assigned to the reporter * Fix bug where only one item in a config list breaks listings * Ready for 0.4.2 release - -- Andrew Chilton Thu, 03 Jul 2008 00:09:21 +1200 + -- Andrew Chilton Thu, 03 Jul 2008 22:22:22 +1200 cil (0.4.1) unstable; urgency=low diff --git a/debian-lenny/changelog b/debian-lenny/changelog index fa918b5..fdbe53a 100644 --- a/debian-lenny/changelog +++ b/debian-lenny/changelog @@ -1,3 +1,11 @@ +cil (0.5.0) unstable; urgency=low + + * Fix bug when running certain commands (inc. init) + * Added command 'steal' + * Added command 'track' + + -- Andrew Chilton Sat, 05 Jul 2008 15:36:22 +1200 + cil (0.4.2) unstable; urgency=low * Fix bug where new issues are assigned to the reporter diff --git a/issues/c_3da3fd2f.cil b/issues/c_3da3fd2f.cil new file mode 100644 index 0000000..323073e --- /dev/null +++ b/issues/c_3da3fd2f.cil @@ -0,0 +1,6 @@ +Issue: 6b087805 +CreatedBy: Andrew Chilton +Inserted: 2008-07-03T11:15:33 +Updated: 2008-07-03T11:16:26 + +Done. Pretty easy eh! 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/c_a8edef8d.cil b/issues/c_a8edef8d.cil new file mode 100644 index 0000000..d395555 --- /dev/null +++ b/issues/c_a8edef8d.cil @@ -0,0 +1,7 @@ +Issue: a90ad11f +CreatedBy: Andrew Chilton +Inserted: 2008-07-03T10:48:45 +Updated: 2008-07-03T10:49:42 + +Added a default .cil file when creating a repo. Also allows the '--bare' option +so that advanced users can do what they like. diff --git a/issues/i_6b087805.cil b/issues/i_6b087805.cil new file mode 100644 index 0000000..186f86d --- /dev/null +++ b/issues/i_6b087805.cil @@ -0,0 +1,13 @@ +Summary: Add a 'steal' command +Status: Finished +CreatedBy: Andrew Chilton +AssignedTo: Andrew Chilton +Label: Milestone-v0.5 +Label: Type-Enhancement +Comment: 3da3fd2f +Inserted: 2008-07-03T10:10:50 +Updated: 2008-07-03T11:23:03 + +A 'cil steal ' command would be helpful to assign issues to yourself. +This is just shorthabe for editing an issue and putting your "UserName +" into the 'AssignedTo' field. diff --git a/issues/i_768d9434.cil b/issues/i_768d9434.cil new file mode 100644 index 0000000..16d9919 --- /dev/null +++ b/issues/i_768d9434.cil @@ -0,0 +1,28 @@ +Summary: Add a command 'track' +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: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 +those issues and/or comments to your repo manually and all the dependecies are +done. + +e.g. + + $ cil track cafebabe + git add issues/i_cafebabe.cil + git add issues/c_decaf7ea.cil + git add issues/a_deadbeaf.cil + +Maybe for now it should just print those lines out, but in the future a command +line option means to actually do it. In the this state, you could always do: + + $ cil track cafebabe | sh + +which would then do it for you. diff --git a/issues/i_a90ad11f.cil b/issues/i_a90ad11f.cil index e02b869..ae4c429 100644 --- a/issues/i_a90ad11f.cil +++ b/issues/i_a90ad11f.cil @@ -1,10 +1,11 @@ Summary: Write a default .cil file so --commands work -Status: New +Status: Finished CreatedBy: Nigel McNie AssignedTo: Andrew Chilton +Comment: a8edef8d Comment: d6ee2369 Inserted: 2008-07-02T12:22:45 -Updated: 2008-07-02T12:42:18 +Updated: 2008-07-03T10:52:32 When I tried to use cil for the first time, I did: diff --git a/lib/CIL.pm b/lib/CIL.pm index ee85064..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 )); @@ -217,19 +218,26 @@ sub read_config_file { } # set some defaults if we don't have any of these - foreach my $key ( keys %$defaults ) { - $cfg->{$key} ||= $defaults->{$key}; - } + %$cfg = (%$defaults, %$cfg); # for some things, make a hash out of them foreach my $hash_name ( @config_hashes ) { - my $h = {}; - my @list = ref $cfg->{"${hash_name}List"} eq 'ARRAY' ? @{$cfg->{"${hash_name}List"}} : $cfg->{"${hash_name}List"}; - foreach my $thing ( @list ) { - $h->{$thing} = 1; + # if we have nothing in the cfg hash already, set it to empty and move on + unless ( exists $cfg->{"${hash_name}List"} ) { + $cfg->{$hash_name} = {}; + next; } + + # if we only have a single item, turn it into an array first + my $key = "${hash_name}List"; + $cfg->{$key} = [ $cfg->{$key} ] unless ref $cfg->{$key} eq 'ARRAY'; + + # loop through all the items making up the hash + my $h = {}; + $h->{$_} = 1 + for @{ $cfg->{$key} }; $cfg->{$hash_name} = $h; - undef $cfg->{"${hash_name}List"}; + undef $cfg->{$key}; } # set each config item @@ -242,6 +250,8 @@ sub read_config_file { $self->LabelStrict( $cfg->{LabelStrict} ); $self->LabelAllowed( $cfg->{LabelAllowed} ); + + $self->VCS( $cfg->{VCS} ); } ## ---------------------------------------------------------------------------- diff --git a/lib/CIL/Utils.pm b/lib/CIL/Utils.pm index e9611cf..47f7ada 100644 --- a/lib/CIL/Utils.pm +++ b/lib/CIL/Utils.pm @@ -41,7 +41,7 @@ sub parse_cil_file { my ($class, $filename, $last_field) = @_; my @lines = read_file($filename); - return unless @lines; + return {} unless @lines; return $class->parse_from_lines( $last_field, @lines ); } -- cgit v1.2.3