[ditz-talk] new in git: one file per issue

William Morgan wmorgan-ditz at masanjin.net
Tue Apr 8 10:33:53 EDT 2008

Reformatted excerpts from nicolas.pouillard's message of 2008-04-08:
> In  assign_issue_names! you iterate over project.issues in order,
> however if I read  well @issues is defined once in bin/ditz
>   project.issues = Dir[fn].map { |fn| Ditz::Issue.from fn }
> which seems to follow the directory order and not creation times.

You're right. That worked when the issues were in the YAML file in
creation order, but doesn't in the file-based world.  What about this

diff --git a/lib/model-objects.rb b/lib/model-objects.rb
index 1c4f311..5cd3156 100644
--- a/lib/model-objects.rb
+++ b/lib/model-objects.rb
@@ -86,7 +86,7 @@ EOS
   def assign_issue_names!
     prefixes = components.map { |c| [c.name, c.name.gsub(/^\s+/, "-").downcase]
     ids = components.map { |c| [c.name, 0] }.to_h
-    issues.each do |i|
+    issues.sort_by { |i| i.creation_time }.each do |i|
       i.name = "#{prefixes[i.component]}-#{ids[i.component] += 1}"

> Moreover  I think I've hit the relating bug where adding a bug and
> there after wanted  to  close  it  but  it's name was not as intended
> the last + 1 but has been inserted between others that I made before.

Yeah, that's exactly the behavior the above bug would cause. Good catch.

William <wmorgan-ditz at masanjin.net>

More information about the ditz-talk mailing list