author | Claus Gittinger <cg@exept.de> |
Sat, 20 Aug 2011 13:41:27 +0200 | |
changeset 193 | 910cb9414852 |
parent 155 | c7a154a5ff3e |
child 278 | c2a9ae7cc695 |
permissions | -rw-r--r-- |
65 | 1 |
"{ Package: 'stx:goodies/monticello' }" |
2 |
||
3 |
Object subclass:#MCPatch |
|
4 |
instanceVariableNames:'operations' |
|
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
7 |
category:'Monticello-Patching' |
|
8 |
! |
|
9 |
||
10 |
||
11 |
!MCPatch class methodsFor:'as yet unclassified'! |
|
12 |
||
13 |
fromBase: baseSnapshot target: targetSnapshot |
|
14 |
^ self new initializeWithBase: baseSnapshot target: targetSnapshot |
|
15 |
! |
|
16 |
||
17 |
operations: aCollection |
|
18 |
^ self basicNew initializeWithOperations: aCollection |
|
19 |
! ! |
|
20 |
||
21 |
!MCPatch methodsFor:'accessing'! |
|
22 |
||
23 |
operations |
|
24 |
^ operations |
|
25 |
! ! |
|
26 |
||
27 |
!MCPatch methodsFor:'applying'! |
|
28 |
||
29 |
applyTo: anObject |
|
30 |
operations do: [:ea | ea applyTo: anObject]. |
|
193 | 31 |
|
65 | 32 |
! ! |
33 |
||
34 |
!MCPatch methodsFor:'intializing'! |
|
35 |
||
36 |
initializeWithBase: baseSnapshot target: targetSnapshot |
|
193 | 37 |
| base target | |
38 |
operations := OrderedCollection new. |
|
39 |
base := MCDefinitionIndex definitions: baseSnapshot definitions. |
|
40 |
target := MCDefinitionIndex definitions: targetSnapshot definitions. |
|
41 |
||
42 |
target definitions do: |
|
43 |
[:t | |
|
44 |
base |
|
45 |
definitionLike: t |
|
46 |
ifPresent: [:b | (b isSameRevisionAs: t) ifFalse: [operations add: (MCModification of: b to: t)]] |
|
47 |
ifAbsent: [operations add: (MCAddition of: t)]] |
|
48 |
displayingProgress: 'Diffing...'. |
|
49 |
||
50 |
base definitions do: |
|
51 |
[:b | |
|
52 |
target |
|
53 |
definitionLike: b |
|
54 |
ifPresent: [:t] |
|
55 |
ifAbsent: [operations add: (MCRemoval of: b)]] |
|
65 | 56 |
! |
57 |
||
58 |
initializeWithOperations: aCollection |
|
193 | 59 |
operations := aCollection |
65 | 60 |
! ! |
61 |
||
62 |
!MCPatch methodsFor:'querying'! |
|
63 |
||
64 |
isEmpty |
|
65 |
^ operations isEmpty |
|
66 |
! ! |
|
67 |
||
68 |
!MCPatch class methodsFor:'documentation'! |
|
69 |
||
193 | 70 |
version_CVS |
71 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCPatch.st,v 1.3 2011-08-20 11:41:27 cg Exp $' |
|
155
c7a154a5ff3e
changed: #initializeWithBase:target:
Claus Gittinger <cg@exept.de>
parents:
65
diff
changeset
|
72 |
! |
c7a154a5ff3e
changed: #initializeWithBase:target:
Claus Gittinger <cg@exept.de>
parents:
65
diff
changeset
|
73 |
|
193 | 74 |
version_SVN |
75 |
^ '§Id: MCPatch.st 5 2010-08-29 07:30:29Z vranyj1 §' |
|
65 | 76 |
! ! |