Hi, I've just found ditz yesterday and it looks like It could fit my needs better than traditional centralized systems. I love the clean CLI interface and the html outputs is pretty nice as well. But I didn't found an easy way to reopen issues though so I made this little patch. It's my first attempt to code in ruby so let me know if I'm doing something stupid. So far, it's working for me :)
Saludos,
--
Oscar Morante
"Self-education is, I firmly believe, the only kind of education there is."
-- Isaac Asimov.
From 90250554863d35e3d3a38543e768917109072aa1 Mon Sep 17 00:00:00 2001 From: Oscar Morante <[email protected]> Date: Sun, 1 Aug 2010 16:43:41 +0200 Subject: [PATCH] add "reopen issue" functionality Signed-off-by: Oscar Morante <[email protected]> --- lib/ditz/model-objects.rb | 12 ++++++++++-- lib/ditz/operator.rb | 10 ++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/ditz/model-objects.rb b/lib/ditz/model-objects.rb index 7b3298d..c463a5c 100644 --- a/lib/ditz/model-objects.rb +++ b/lib/ditz/model-objects.rb @@ -168,8 +168,8 @@ class Issue < ModelObject ## these are the fields we interpolate issue names on INTERPOLATED_FIELDS = [:title, :desc, :log_events] - STATUS_SORT_ORDER = { :unstarted => 2, :paused => 1, :in_progress => 0, :closed => 3 } - STATUS_WIDGET = { :unstarted => "_", :in_progress => ">", :paused => "=", :closed => "x" } + STATUS_SORT_ORDER = { :unstarted => 3, :paused => 2, :in_progress => 1, :closed => 4, :reopened => 0 } + STATUS_WIDGET = { :unstarted => "_", :in_progress => ">", :paused => "=", :closed => "x", :reopened => "!" } DISPOSITIONS = [ :fixed, :wontfix, :reorg ] TYPES = [ :bugfix, :feature, :task ] TYPE_ORDER = { :bugfix => 0, :feature => 1, :task => 2 } @@ -247,6 +247,14 @@ class Issue < ModelObject self.disposition = disp end + def reopen who, comment + log "reopened", who, comment + self.status = :reopened + if self.assigned? && self.project.release_for(self.release).released? + self.unassign who, nil + end + end + def change_status to, who, comment raise Error, "unknown status #{to}" unless STATUSES.member? to raise Error, "already marked as #{to}" if status == to diff --git a/lib/ditz/operator.rb b/lib/ditz/operator.rb index ff7d466..2b11749 100644 --- a/lib/ditz/operator.rb +++ b/lib/ditz/operator.rb @@ -396,6 +396,16 @@ EOS puts "Closed issue #{issue.name} with disposition #{issue.disposition_string}." end + operation :reopen, "Reopen an issue", :issue do + opt :comment, "Specify a comment", :short => 'm', :type => String + opt :no_comment, "Skip asking for a comment", :default => false + end + def reopen project, config, opts, issue + puts "Reopening issue #{issue.name}: #{issue.title}." + issue.reopen config.user, get_comment(opts) + puts "Reopened issue #{issue.name}." + end + operation :assign, "Assign an issue to a release", :issue, :maybe_release do opt :comment, "Specify a comment", :short => 'm', :type => String opt :no_comment, "Skip asking for a comment", :default => false -- 1.7.1
signature.asc
Description: Digital signature
_______________________________________________ ditz-talk mailing list [email protected] http://rubyforge.org/mailman/listinfo/ditz-talk
