author | Claus Gittinger <cg@exept.de> |
Sun, 01 Feb 2015 15:14:51 +0100 | |
changeset 964 | bba71a28671f |
parent 890 | 30748ea1b6e9 |
child 1120 | e0ec9591b6e8 |
permissions | -rw-r--r-- |
86 | 1 |
"{ Package: 'stx:goodies/monticello' }" |
2 |
||
3 |
MCVersion subclass:#MCDiffyVersion |
|
4 |
instanceVariableNames:'base patch' |
|
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
622 | 7 |
category:'SCM-Monticello-Versioning' |
86 | 8 |
! |
9 |
||
10 |
||
11 |
!MCDiffyVersion class methodsFor:'instance creation'! |
|
12 |
||
13 |
package: aPackage info: aVersionInfo dependencies: aCollection baseInfo: baseVersionInfo patch: |
|
14 |
aPatch |
|
15 |
^ self basicNew initializeWithPackage: aPackage info: aVersionInfo dependencies: aCollection baseInfo: baseVersionInfo patch: |
|
16 |
aPatch |
|
17 |
! |
|
18 |
||
19 |
package: aPackage info: aVersionInfo snapshot: aSnapshot dependencies: aCollection baseVersion: aVersion |
|
890
30748ea1b6e9
wether -> whether (lookup what wether is ;-)
Claus Gittinger <cg@exept.de>
parents:
622
diff
changeset
|
20 |
^ self |
86 | 21 |
package: aPackage |
22 |
info: aVersionInfo |
|
23 |
dependencies: aCollection |
|
24 |
baseInfo: aVersion info |
|
25 |
patch: (aSnapshot patchRelativeToBase: aVersion snapshot) |
|
26 |
! ! |
|
27 |
||
28 |
!MCDiffyVersion class methodsFor:'name utilities'! |
|
29 |
||
30 |
baseNameFrom: diffName |
|
31 |
| baseId verName | |
|
32 |
baseId := (diffName copyAfter: $() copyUpTo: $). |
|
33 |
baseId ifEmpty: [^baseId]. |
|
34 |
(baseId beginsWith: '@') |
|
35 |
ifTrue: [^baseId copyAfter: $@]. |
|
36 |
verName := self verNameFrom: diffName. |
|
37 |
^(baseId includes: $.) |
|
38 |
ifTrue: [(verName copyUpToLast: $-), '-', baseId] |
|
39 |
ifFalse: [(verName copyUpToLast: $.), '.', baseId] |
|
40 |
! |
|
41 |
||
42 |
canonicalNameFor: aFileName |
|
43 |
^(self nameForVer: (self verNameFrom: aFileName) |
|
44 |
base: (self baseNameFrom: aFileName)) |
|
45 |
, '.', MCMcdReader extension |
|
46 |
! |
|
47 |
||
48 |
nameForVer: versionName base: baseName |
|
49 |
| baseId | |
|
50 |
baseId := (versionName copyUpToLast: $.) = (baseName copyUpToLast: $.) |
|
51 |
ifTrue: [baseName copyAfterLast: $.] |
|
52 |
ifFalse: [(versionName copyUpToLast: $-) = (baseName copyUpToLast: $-) |
|
53 |
ifTrue: [baseName copyAfterLast: $-] |
|
54 |
ifFalse: ['@', baseName]]. |
|
55 |
^ versionName, '(', baseId, ')' |
|
56 |
! |
|
57 |
||
58 |
verNameFrom: diffName |
|
59 |
^diffName copyUpTo: $( |
|
60 |
! ! |
|
61 |
||
62 |
!MCDiffyVersion methodsFor:'as yet unclassified'! |
|
63 |
||
64 |
baseInfo |
|
65 |
^ base |
|
66 |
! |
|
67 |
||
68 |
baseSnapshot |
|
69 |
^ (self workingCopy repositoryGroup versionWithInfo: base) snapshot |
|
70 |
! |
|
71 |
||
72 |
canOptimizeLoading |
|
890
30748ea1b6e9
wether -> whether (lookup what wether is ;-)
Claus Gittinger <cg@exept.de>
parents:
622
diff
changeset
|
73 |
"Answer whether I can provide a patch for the working copy without the usual diff pass" |
86 | 74 |
^ package hasWorkingCopy |
75 |
and: [package workingCopy modified not |
|
76 |
and: [package workingCopy ancestors includes: self baseInfo]] |
|
77 |
! |
|
78 |
||
79 |
fileName |
|
80 |
^ (self class nameForVer: info name base: base name), '.', self writerClass extension |
|
81 |
! |
|
82 |
||
83 |
initializeWithPackage: aPackage info: aVersionInfo dependencies: aCollection baseInfo: baseVersionInfo patch: aPatch |
|
84 |
patch _ aPatch. |
|
85 |
base _ baseVersionInfo. |
|
86 |
super initializeWithPackage: aPackage info: aVersionInfo snapshot: nil dependencies: aCollection. |
|
87 |
! |
|
88 |
||
89 |
isDiffy |
|
90 |
^ true |
|
91 |
! |
|
92 |
||
93 |
patch |
|
94 |
^ patch |
|
95 |
! |
|
96 |
||
97 |
snapshot |
|
98 |
^ snapshot ifNil: [snapshot _ MCPatcher apply: patch to: self baseSnapshot] |
|
99 |
! |
|
100 |
||
101 |
summary |
|
102 |
^ '(Diff against ', self baseInfo name, ')', String cr, super summary |
|
103 |
! |
|
104 |
||
105 |
writerClass |
|
890
30748ea1b6e9
wether -> whether (lookup what wether is ;-)
Claus Gittinger <cg@exept.de>
parents:
622
diff
changeset
|
106 |
^ MCMcdWriter |
86 | 107 |
! ! |
108 |
||
109 |
!MCDiffyVersion class methodsFor:'documentation'! |
|
110 |
||
111 |
version |
|
890
30748ea1b6e9
wether -> whether (lookup what wether is ;-)
Claus Gittinger <cg@exept.de>
parents:
622
diff
changeset
|
112 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCDiffyVersion.st,v 1.3 2013-07-27 13:50:33 cg Exp $' |
86 | 113 |
! ! |