[ditz-talk] [PATCH] Allow ditz claim abcd oprah
Thomas Nichols
nichols7 at googlemail.com
Fri Nov 7 09:11:36 EST 2008
Hi,
Not sure whether these are better as email patches for discussion, or
merge requests (from f3423e0 on thomasns-clone) on Gitorious?
This patch supports a list of devs with nicknames in project.yaml and
extends ditz claim to take an optional dev param. This allows one person
(perhaps during a daily standup) to assign issues to anyone in the devs
list:
ditz claim abcd oprah
The 'claimer' field in the issue-abcd*.yaml file is set to Oprah's full
email from a project.yaml setting. You can see from the log who actually
did the 'claim' operation.
TODO:
* extend `ditz mine` to take an optional dev param too
* allow setting of project.devs hash with ditz init/reconfigure
WDYT? Is this a change that's useful to others?
BTW I'm a bit nervous of continuing with the current implementation of
'mine' since it depends AFAICT on a string comparison of the
human-readable email address. Would it be better to store the nickname
in the issue-*.yaml 'claimer:' field, instead of the expanded email
address, so that emails can change without breaking the output of 'mine'?
-- Thomas
diff --git a/lib/ditz/plugins/issue-claiming.rb
b/lib/ditz/plugins/issue-claiming.rb
index d5240a1..e934e73 100644
--- a/lib/ditz/plugins/issue-claiming.rb
+++ b/lib/ditz/plugins/issue-claiming.rb
@@ -6,7 +6,7 @@
## you're working on.
##
## Commands added:
-## ditz claim: claim an issue for yourself
+## ditz claim: claim an issue for yourself or a dev specified in
project.yaml
## ditz unclaim: unclaim a claimed issue
## ditz mine: show all issues claimed by you
## ditz claimed: show all claimed issues, by developer
@@ -15,9 +15,20 @@
## Usage:
## 1. add a line "- issue-claiming" to the .ditz-plugins file in the
project
## root
-## 2. use the above commands to abandon
+## 2. (optional:) add a 'devs' key to project.yaml, e.g:
+## devs:
+## :roy: Roy Baty <roy at marsproject.com>
+## :pris: Pris Stratton <pris at marsproject.com>
+
+## 3. use the above commands to abandon
module Ditz
+
+class Project
+ field :devs, :prompt => "Hash of developer nicknames (as symbols) to
email addresses",
+ :default => {:roy => "Roy Baty <roy at marsproject.com>"}
+end
+
class Issue
field :claimer, :ask => false
@@ -33,7 +44,7 @@ class Issue
if claimer == who
log "issue unclaimed", who, comment
else
- log "unassigned from #{claimer}", who, comment
+ log "unclaimed from #{claimer}", who, comment
end
self.claimer = nil
end
@@ -88,14 +99,19 @@ class Operator
end
end
- operation :claim, "Claim an issue for yourself", :issue do
+ operation :claim, "Claim an issue for yourself", :issue, :maybe_dev do
opt :force, "Claim this issue even if someone else has claimed it",
:default => false
end
- def claim project, config, opts, issue
- puts "Claiming issue #{issue.name}: #{issue.title}."
+ def claim project, config, opts, issue, dev = nil
+ if dev
+ dev_full_email = project.devs ? project.devs[dev.to_sym] : nil
+ raise Error, "no nickname :#{dev} has been defined in
project.yaml" unless dev_full_email
+ end
+ dev_full_email ||= config.user
+ puts "Claiming issue #{issue.name}: #{issue.title} for
#{dev_full_email}."
comment = ask_multiline_or_editor "Comments" unless $opts[:no_comment]
- issue.claim config.user, comment, opts[:force]
- puts "Issue #{issue.name} marked as claimed by #{config.user}"
+ issue.claim dev_full_email, comment, opts[:force]
+ puts "Issue #{issue.name} marked as claimed by #{dev_full_email}"
end
operation :unclaim, "Unclaim a claimed issue", :issue do
More information about the ditz-talk
mailing list