--- a/Diff3.st Fri Mar 16 20:24:01 2012 +0000
+++ b/Diff3.st Fri Mar 16 22:44:50 2012 +0000
@@ -113,7 +113,9 @@
!Diff3 methodsFor:'accessing'!
diffClass
- ^ diffClass
+ ^ diffClass ? Diff2::HuntMcilroy
+
+ "Modified (format): / 16-03-2012 / 20:27:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
diffClass: anObject
@@ -147,13 +149,26 @@
!Diff3 methodsFor:'merging'!
merge
- "Returns an Array of (#ok -> {...}) or (#conflict -> Diff3Conflict of collections) instances representing the results of a three-way merge between file1/file0/file2. Does not optimistically treat 'false conflicts' as clean merges (see the class comment for Diff3InclusiveVisitor)."
- ^ self merge: false
+ "Returns an Array of (#ok -> {...}) or (#conflict -> Diff3Conflict
+ of collections) instances representing the results of a three-way
+ merge between file1/file0/file2. Does not optimistically treat
+ 'false conflicts' as clean merges (see the class comment for
+ Diff3InclusiveVisitor)."
+
+ ^ self merge: false
+
+ "Modified (comment): / 16-03-2012 / 20:26:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
mergeClean
- "Returns an Array of (#ok -> {...}) or (#conflict -> Diff3Conflict of collections) instances representing the results of a three-way merge between file1/file0/file2. Optimistically treats 'false conflicts' as clean merges (see the class comment for Diff3ExclusiveVisitor)."
- ^ self merge: true
+ "Returns an Array of (#ok -> {...}) or (#conflict -> Diff3Conflict of
+ collections) instances representing the results of a three-way merge
+ between file1/file0/file2. Optimistically treats 'false conflicts'
+ as clean merges (see the class comment for Diff3ExclusiveVisitor)."
+
+ ^ self merge: true
+
+ "Modified (format): / 16-03-2012 / 20:26:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
mergeIndices
@@ -226,14 +241,14 @@
computeHunks
| diff2 diff1 hunks |
- diff1 := diffClass new file1: file0; file2: file1; diffIndices.
- diff2 := diffClass new file1: file0; file2: file2; diffIndices.
+ diff1 := self diffClass new file1: file0; file2: file1; diffIndices.
+ diff2 := self diffClass new file1: file0; file2: file2; diffIndices.
hunks := OrderedCollection new.
diff1 do: [ :entry | hunks add: (Diff3Hunk side: #left entry: entry) ].
diff2 do: [ :entry | hunks add: (Diff3Hunk side: #right entry: entry) ].
^ hunks asSortedCollection:[:a :b|a <= b].
- "Modified: / 16-03-2012 / 18:28:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 16-03-2012 / 20:29:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
fileMap
@@ -417,6 +432,20 @@
^ self offset < aDiffChunk offset
! !
+!Diff3::Chunk methodsFor:'testing'!
+
+isChunk
+ ^true
+
+ "Created: / 16-03-2012 / 22:02:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isConflict
+ ^false
+
+ "Created: / 16-03-2012 / 22:02:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!Diff3::Conflict class methodsFor:'documentation'!
copyright
@@ -483,6 +512,13 @@
left := anObject
!
+length
+
+ ^left length max: (original length max: right length)
+
+ "Created: / 16-03-2012 / 22:02:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
original
^ original
!
@@ -527,8 +563,22 @@
aStream nextPut: $).
! !
+!Diff3::Conflict methodsFor:'testing'!
+
+isChunk
+ ^false
+
+ "Created: / 16-03-2012 / 22:03:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isConflict
+ ^true
+
+ "Created: / 16-03-2012 / 22:03:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!Diff3 class methodsFor:'documentation'!
version_SVN
- ^ '$Id: Diff3.st 7927 2012-03-16 19:30:50Z vranyj1 $'
+ ^ '$Id: Diff3.st 7936 2012-03-16 22:44:50Z vranyj1 $'
! !