MCDictionaryRepository.st
author Claus Gittinger <cg@exept.de>
Thu, 08 Mar 2018 00:48:11 +0100
changeset 1039 88f5b1106042
parent 902 3b122f8425d9
permissions -rw-r--r--
#BUGFIX by cg class: MCSnapshot changed: #asChangeSet don't loose comment changes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
108
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"{ Package: 'stx:goodies/monticello' }"
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
MCRepository subclass:#MCDictionaryRepository
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
	instanceVariableNames:'description dict'
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
	classVariableNames:''
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
	poolDictionaries:''
621
e64537ed2acc category change
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
     7
	category:'SCM-Monticello-Repositories'
108
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
!
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
242
2dee607da8e4 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 108
diff changeset
    11
!MCDictionaryRepository class methodsFor:'initialization'!
2dee607da8e4 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 108
diff changeset
    12
2dee607da8e4 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 108
diff changeset
    13
new
2dee607da8e4 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 108
diff changeset
    14
    ^self basicNew initialize
2dee607da8e4 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 108
diff changeset
    15
! !
2dee607da8e4 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 108
diff changeset
    16
902
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    17
!MCDictionaryRepository methodsFor:'accessing'!
108
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
description
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	^ description ifNil: ['cache']
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
!
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
description: aString
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
242
2dee607da8e4 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 108
diff changeset
    26
	description := aString 
108
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
!
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
dictionary
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
	^ dict
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
!
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
dictionary: aDictionary
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
242
2dee607da8e4 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 108
diff changeset
    36
	dict := aDictionary
902
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    37
! !
108
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
902
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    39
!MCDictionaryRepository methodsFor:'as yet unclassified'!
108
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
includesVersionWithInfo: aVersionInfo
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
	^ dict includesKey: aVersionInfo
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
!
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
sortedVersionInfos
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
	| sorter |
242
2dee607da8e4 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 108
diff changeset
    47
	sorter := MCVersionSorter new.
108
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
	self allVersionInfos do: [:ea | sorter addVersionInfo: ea].
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
	^ sorter sortedVersionInfos
242
2dee607da8e4 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 108
diff changeset
    50
108
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
!
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
versionWithInfo: aVersionInfo ifAbsent: errorBlock
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
	^ dict at: aVersionInfo ifAbsent: errorBlock
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
! !
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
902
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    57
!MCDictionaryRepository methodsFor:'comparing'!
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    58
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    59
= other
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    60
	^ self == other
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    61
! !
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    62
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    63
!MCDictionaryRepository methodsFor:'initialization'!
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    64
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    65
initialize
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    66
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    67
	super initialize.
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    68
	dict := Dictionary new.
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    69
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    70
! !
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    71
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    72
!MCDictionaryRepository methodsFor:'printing & storing'!
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    73
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    74
basicStoreVersion: aVersion
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    75
	dict at: aVersion info put: aVersion
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    76
! !
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    77
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    78
!MCDictionaryRepository methodsFor:'queries'!
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    79
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    80
allVersionInfos
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    81
	^ dict values collect: [:ea | ea info]
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    82
!
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    83
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    84
closestAncestorVersionFor: anAncestry ifNone: errorBlock
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    85
	| info |
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    86
	info := anAncestry breadthFirstAncestors
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    87
			detect: [:ea | self includesVersionWithInfo: ea]
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    88
			ifNone: [^ errorBlock value].
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    89
	^ self versionWithInfo: info
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    90
!
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    91
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    92
includesVersionNamed: aString
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    93
	^ dict anySatisfy: [:ea | ea info name = aString]
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    94
! !
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    95
108
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
!MCDictionaryRepository class methodsFor:'documentation'!
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
version
902
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
    99
    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCDictionaryRepository.st,v 1.5 2014-02-12 14:53:33 cg Exp $'
242
2dee607da8e4 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 108
diff changeset
   100
!
2dee607da8e4 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 108
diff changeset
   101
2dee607da8e4 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 108
diff changeset
   102
version_CVS
902
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
   103
    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCDictionaryRepository.st,v 1.5 2014-02-12 14:53:33 cg Exp $'
242
2dee607da8e4 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 108
diff changeset
   104
!
2dee607da8e4 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 108
diff changeset
   105
2dee607da8e4 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 108
diff changeset
   106
version_SVN
902
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
   107
    ^ '$Id: MCDictionaryRepository.st,v 1.5 2014-02-12 14:53:33 cg Exp $'
108
266be3c96486 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
! !
902
3b122f8425d9 categories
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
   109