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

Nicolas Pouillard nicolas.pouillard at gmail.com
Tue Apr 8 10:51:21 EDT 2008


Excerpts from William Morgan's message of Tue Apr 08 16:33:53 +0200 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
> patch?
> 
> 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}"
>      end
>    end
> 
> > 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.

That's  a  good fix however I've committed a similar one in my branch and made
a merge request [1].

[1]: http://gitorious.org/projects/ditz/repos/mainline/merge_requests/42

-- 
Nicolas Pouillard aka Ertai
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/ditz-talk/attachments/20080408/ed899c2d/attachment.bin 


More information about the ditz-talk mailing list