MCMergeRecord.st
changeset 75 9fbce249331e
child 640 9b0140e0627b
equal deleted inserted replaced
74:aa598691f9aa 75:9fbce249331e
       
     1 "{ Package: 'stx:goodies/monticello' }"
       
     2 
       
     3 Object subclass:#MCMergeRecord
       
     4 	instanceVariableNames:'version packageSnapshot ancestorInfo ancestor ancestorSnapshot
       
     5 		imagePatch mergePatch'
       
     6 	classVariableNames:''
       
     7 	poolDictionaries:''
       
     8 	category:'Monticello-Versioning'
       
     9 !
       
    10 
       
    11 
       
    12 !MCMergeRecord class methodsFor:'as yet unclassified'!
       
    13 
       
    14 version: aVersion
       
    15 	^ self basicNew initializeWithVersion: aVersion
       
    16 ! !
       
    17 
       
    18 !MCMergeRecord methodsFor:'as yet unclassified'!
       
    19 
       
    20 ancestorInfo
       
    21 	^ ancestorInfo ifNil: [ancestorInfo _ version info commonAncestorWith: version workingCopy ancestry]
       
    22 !
       
    23 
       
    24 ancestorSnapshot
       
    25 	^ ancestorSnapshot ifNil: [ancestorSnapshot _ version workingCopy findSnapshotWithVersionInfo: self ancestorInfo]
       
    26 !
       
    27 
       
    28 imageIsClean
       
    29 	| ancestors |
       
    30 	ancestors _ version workingCopy ancestors.
       
    31 	^ ancestors size = 1
       
    32 		and: [ancestors first = self ancestorInfo]	
       
    33 		and: [self imagePatch isEmpty]
       
    34 !
       
    35 
       
    36 imagePatch
       
    37 	^ imagePatch ifNil: [imagePatch _ self packageSnapshot patchRelativeToBase: self ancestorSnapshot]
       
    38 !
       
    39 
       
    40 initializeWithVersion: aVersion
       
    41 	version _ aVersion
       
    42 !
       
    43 
       
    44 isAncestorMerge
       
    45 	^ version workingCopy ancestry hasAncestor: version info
       
    46 !
       
    47 
       
    48 mergePatch
       
    49 	^ mergePatch ifNil: [mergePatch _ version snapshot patchRelativeToBase: self ancestorSnapshot]
       
    50 !
       
    51 
       
    52 packageSnapshot
       
    53 	^ packageSnapshot ifNil: [packageSnapshot _ version package snapshot]
       
    54 !
       
    55 
       
    56 updateWorkingCopy
       
    57 	self isAncestorMerge ifFalse:
       
    58 		[self imageIsClean
       
    59 			ifTrue: [version workingCopy loaded: version]
       
    60 			ifFalse: [version workingCopy merged: version]]
       
    61 !
       
    62 
       
    63 version
       
    64 	^ version
       
    65 ! !
       
    66 
       
    67 !MCMergeRecord class methodsFor:'documentation'!
       
    68 
       
    69 version
       
    70     ^ '$Header: /cvs/stx/stx/goodies/monticello/MCMergeRecord.st,v 1.1 2006-11-22 13:15:36 cg Exp $'
       
    71 ! !