--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MCConflict.st Wed Nov 22 14:08:15 2006 +0100
@@ -0,0 +1,121 @@
+"{ Package: 'stx:goodies/monticello' }"
+
+Object subclass:#MCConflict
+ instanceVariableNames:'operation chooseRemote'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Monticello-Merging'
+!
+
+
+!MCConflict class methodsFor:'as yet unclassified'!
+
+operation: anOperation
+ ^ self new operation: anOperation
+! !
+
+!MCConflict methodsFor:'as yet unclassified'!
+
+annotations
+ ^operation ifNotNilDo: [ :op | op annotations ]
+!
+
+applyTo: anObject
+ self isResolved ifFalse: [self error: 'Cannot continue until this conflict has been resolved'].
+ self remoteChosen ifTrue: [operation applyTo: anObject].
+!
+
+chooseLocal
+ chooseRemote _ false
+!
+
+chooseNewer
+ self isLocalNewer ifTrue: [ self chooseLocal ]
+ ifFalse: [ self isRemoteNewer ifTrue: [ self chooseRemote ]]
+!
+
+chooseOlder
+ self isRemoteNewer ifTrue: [ self chooseLocal ]
+ ifFalse: [ self isLocalNewer ifTrue: [ self chooseRemote ]]
+!
+
+chooseRemote
+ chooseRemote _ true
+!
+
+clearChoice
+ chooseRemote _ nil
+!
+
+definition
+ ^operation ifNotNilDo: [ :op | op definition ]
+!
+
+isConflict
+ ^true
+!
+
+isLocalNewer
+ ^ self localDefinition fullTimeStamp > self remoteDefinition fullTimeStamp
+!
+
+isRemoteNewer
+ ^ self localDefinition fullTimeStamp < self remoteDefinition fullTimeStamp
+!
+
+isResolved
+ ^ chooseRemote notNil
+!
+
+localChosen
+ ^ chooseRemote notNil and: [chooseRemote not]
+!
+
+localDefinition
+ ^ operation baseDefinition
+!
+
+operation
+ ^ operation
+!
+
+operation: anOperation
+ operation _ anOperation
+!
+
+remoteChosen
+ ^ chooseRemote notNil and: [chooseRemote]
+!
+
+remoteDefinition
+ ^ operation targetDefinition
+!
+
+source
+ ^ self localChosen
+ ifTrue: [operation fromSource]
+ ifFalse: [operation source]
+!
+
+status
+ ^ self isResolved
+ ifFalse: ['']
+ ifTrue: [self remoteChosen
+ ifFalse: ['L']
+ ifTrue: ['R']]
+!
+
+summary
+ | attribute |
+ attribute _
+ self isResolved
+ ifTrue: [self remoteChosen ifTrue: [#underlined] ifFalse: [#struckOut]]
+ ifFalse: [#bold].
+ ^ Text string: operation summary attribute: (TextEmphasis perform: attribute)
+! !
+
+!MCConflict class methodsFor:'documentation'!
+
+version
+ ^ '$Header: /cvs/stx/stx/goodies/monticello/MCConflict.st,v 1.1 2006-11-22 13:08:15 cg Exp $'
+! !