author | Claus Gittinger <cg@exept.de> |
Mon, 14 May 2018 02:21:18 +0200 | |
changeset 1048 | 582b3a028cbc |
parent 664 | 99444b312701 |
child 1095 | 87f223484bc3 |
permissions | -rw-r--r-- |
65 | 1 |
"{ Package: 'stx:goodies/monticello' }" |
2 |
||
3 |
Object subclass:#MCPatch |
|
4 |
instanceVariableNames:'operations' |
|
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
664 | 7 |
category:'SCM-Monticello-Patching' |
65 | 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 |
||
278 | 70 |
version |
664 | 71 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCPatch.st,v 1.5 2012-09-11 21:25:17 cg Exp $' |
278 | 72 |
! |
73 |
||
193 | 74 |
version_CVS |
664 | 75 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCPatch.st,v 1.5 2012-09-11 21:25:17 cg Exp $' |
155
c7a154a5ff3e
changed: #initializeWithBase:target:
Claus Gittinger <cg@exept.de>
parents:
65
diff
changeset
|
76 |
! |
c7a154a5ff3e
changed: #initializeWithBase:target:
Claus Gittinger <cg@exept.de>
parents:
65
diff
changeset
|
77 |
|
193 | 78 |
version_SVN |
79 |
^ '§Id: MCPatch.st 5 2010-08-29 07:30:29Z vranyj1 §' |
|
65 | 80 |
! ! |