[ditz-talk] [PATCH] new plugin - use sha_id.slice(0, 5) instead of ditz-123

Thomas Nichols nichols7 at googlemail.com
Fri Nov 7 11:40:06 EST 2008


Hi,

Miniscule plugin 'sha-names' replaces names of the form 'ditz-123' with
'a1b2c' and similar. These can be used (AFAIK) wherever an issue ID is
required, and avoid problems with issues getting renumbered when an
issue is moved from one component to another, or after merges.

http://gitorious.org/projects/ditz/repos/thomasns-clone/logs/master

I've submitted a merge request on Gitorious too, but as per Ohad's
request here's the patch:



diff --git a/lib/ditz/plugins/sha-names.rb b/lib/ditz/plugins/sha-names.rb
new file mode 100644
index 0000000..1322045
--- /dev/null
+++ b/lib/ditz/plugins/sha-names.rb
@@ -0,0 +1,22 @@
+## sha-names ditz plugin
+##
+## This world's-smallest-ditz-plugin uses the initial characters of the
SHA id instead of
+## an identifier like "ditz-999".
+##
+## Usage:
+##   1. add a line "- sha-names" to the .ditz-plugins file in the
project root
+
+module Ditz
+
+class Project
+
+  SHA_NAME_LENGTH = 5
+
+  def assign_issue_names!
+    issues.sort_by { |i| i.creation_time }.each do |i|
+      i.name = i.id.slice(0,SHA_NAME_LENGTH)
+    end
+  end
+
+end
+end



More information about the ditz-talk mailing list