Issue 5278 in pharo: bullet proof infoFromDictionary:cache:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Issue 5278 in pharo: bullet proof infoFromDictionary:cache:

pharo
Status: Accepted
Owner: [hidden email]

New issue 5278 by [hidden email]: bullet proof  
infoFromDictionary:cache:
http://code.google.com/p/pharo/issues/detail?id=5278

Bert Freudenberg uploaded a new version of Monticello to project The Trunk:
http://source.squeak.org/trunk/Monticello-bf.388.mcz

==================== Summary ====================

Name: Monticello-bf.388
Author: bf
Time: 18 April 2010, 7:11:28.649 pm
UUID: 22c87ccc-e851-4d07-a3e8-a5413d3006b7
Ancestors: Monticello-bp.387

- bullet-proof #infoFromDictionary:cache: and re-use it in #extractInfoFrom:

=============== Diff against Monticello-bp.387 ===============

Item was changed:
  ----- Method: MCMczReader>>extractInfoFrom: (in category 'as yet  
unclassified') -----
  extractInfoFrom: dict
+ ^MCWorkingCopy infoFromDictionary: dict cache: self infoCache!
- ^ self infoCache at: (dict at: #id) ifAbsentPut:
- [MCVersionInfo
- name: (dict at: #name ifAbsent: [''])
- id: (UUID fromString: (dict at: #id))
- message: (dict at: #message ifAbsent: [''])
- date: ([Date fromString: (dict at: #date) ] on: Error do: [ :ex | ex  
return: nil ])
- time: ([ Time fromString:(dict at: #time)] on: Error do: [ :ex | ex  
return: nil ])
- author: (dict at: #author ifAbsent: [''])
- ancestors: ((dict at: #ancestors) collect: [:ea | self  
extractInfoFrom: ea])
- stepChildren: ((dict at: #stepChildren ifAbsent: [#()]) collect: [:ea  
| self extractInfoFrom: ea])]!

Item was changed:
  ----- Method: MCWorkingCopy class>>infoFromDictionary:cache: (in  
category 'as yet unclassified') -----
  infoFromDictionary: aDictionary cache: cache
  | id |
  id := aDictionary at: #id.
  ^ cache at: id ifAbsentPut:
  [MCVersionInfo
+ name: (aDictionary at: #name ifAbsent: [''])
+ id: (UUID fromString: id)
+ message: (aDictionary at: #message ifAbsent: [''])
+ date: ([Date fromString: (aDictionary at: #date)] ifError: [nil])
+ time: ([Time fromString: (aDictionary at: #time)] ifError: [nil])
+ author: (aDictionary at: #author ifAbsent: [''])
+ ancestors: (self ancestorsFromArray: (aDictionary at: #ancestors  
ifAbsent: []) cache: cache)
+ stepChildren: (self ancestorsFromArray: (aDictionary at: #stepChildren  
ifAbsent: []) cache: cache)]!
- name: (aDictionary at: #name)
- id: (aDictionary at: #id)
- message: (aDictionary at: #message)
- date: (aDictionary at: #date)
- time: (aDictionary at: #time)
- author: (aDictionary at: #author)
- ancestors: (self ancestorsFromArray: (aDictionary at: #ancestors)  
cache: cache)]!



Now I do not know about stepChildren: so we should check that


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker