Diff3Hunk.st
author Claus Gittinger <cg@exept.de>
Wed, 05 Feb 2014 20:08:23 +0100
changeset 13865 f9662607a6e4
child 14008 289b26a46d64
permissions -rw-r--r--
initial checkin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13865
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 Copyright (c) 2007-2012 Tony Garnock-Jones
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
 This code is based on Squeak's DiffMerge package
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 written by Tony Garnock-Jones. Original project's web site:
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 http://www.squeaksource.com/DiffMerge
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 Permission is hereby granted, free of charge, to any person
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 obtaining a copy of this software and associated documentation
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
 files (the 'Software'), to deal in the Software without
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
 restriction, including without limitation the rights to use,
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
 copy, modify, merge, publish, distribute, sublicense, and/or sell
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
 copies of the Software, and to permit persons to whom the
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
 Software is furnished to do so, subject to the following
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
 conditions:
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
 The above copyright notice and this permission notice shall be
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
 included in all copies or substantial portions of the Software.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
 OTHER DEALINGS IN THE SOFTWARE.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
"
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
"{ Package: 'stx:libtool' }"
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
Object subclass:#Diff3Hunk
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
	instanceVariableNames:'side oldChunk newChunk'
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
	classVariableNames:''
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
	poolDictionaries:''
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
	category:'Collections-Sequenceable-Diff3'
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
Diff3Hunk comment:'A Diff3Hunk represents a change from the ancestor to either the left or the right branch as part of a three-way merge.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
Instance Variables
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
	newChunk:	<DiffChunk> The new content chunk
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
	oldChunk:	<DiffChunk> The old (ancestral) content chunk
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
	side:		<Symbol> Either #left or #right
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
'
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
!Diff3Hunk class methodsFor:'documentation'!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
copyright
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
"
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
 Copyright (c) 2007-2012 Tony Garnock-Jones
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
 This code is based on Squeak's DiffMerge package
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
 written by Tony Garnock-Jones. Original project's web site:
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
 http://www.squeaksource.com/DiffMerge
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
 Permission is hereby granted, free of charge, to any person
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
 obtaining a copy of this software and associated documentation
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
 files (the 'Software'), to deal in the Software without
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
 restriction, including without limitation the rights to use,
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
 copy, modify, merge, publish, distribute, sublicense, and/or sell
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
 copies of the Software, and to permit persons to whom the
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
 Software is furnished to do so, subject to the following
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
 conditions:
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
 The above copyright notice and this permission notice shall be
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
 included in all copies or substantial portions of the Software.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
 OTHER DEALINGS IN THE SOFTWARE.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
"
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
documentation
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
"
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
A Diff3Hunk represents a change from the ancestor to either the left or the right branch as part of a three-way merge.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
Instance Variables
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
        newChunk:       <DiffChunk> The new content chunk
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
        oldChunk:       <DiffChunk> The old (ancestral) content chunk
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
        side:           <Symbol> Either #left or #right
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
    [author:]
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
        Tony Garnock-Jones <tonyg@lshift.com>
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
    [instance variables:]
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    [class variables:]
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
    [see also:]
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
"
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
! !
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
!Diff3Hunk class methodsFor:'as yet unclassified'!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
side: aSelector entry: anAssociation
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
	^ self new side: aSelector; oldChunk: anAssociation key; newChunk: anAssociation value
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
! !
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
!Diff3Hunk methodsFor:'accessing'!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
newChunk
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
	^ newChunk
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
newChunk: anObject
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
	newChunk := anObject
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
oldChunk
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
	^ oldChunk
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
oldChunk: anObject
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
	oldChunk := anObject
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
side
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
	^ side
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
side: anObject
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
	side := anObject
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
! !
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
!Diff3Hunk methodsFor:'comparing'!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
<= otherHunk
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
	^ (oldChunk < otherHunk oldChunk) or:
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
		[(otherHunk oldChunk = oldChunk) and: [side = #left]]
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
! !
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
!Diff3Hunk methodsFor:'printing & storing'!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
printOn:aStream
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
    "append a printed representation if the receiver to the argument, aStream"
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
    super printOn:aStream.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
    aStream nextPutAll:' side: '.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
    side printOn:aStream.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
    aStream nextPutAll:' old: '.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
    oldChunk printOn:aStream.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
    aStream nextPutAll:' new: '.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
    newChunk printOn:aStream.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
    "Modified: / 20-03-2012 / 17:56:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
! !
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
!Diff3Hunk class methodsFor:'documentation'!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
version
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
    ^ '$Header: /cvs/stx/stx/libtool/Diff3Hunk.st,v 1.1 2014-02-05 19:08:23 cg Exp $'
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
version_CVS
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
    ^ '$Header: /cvs/stx/stx/libtool/Diff3Hunk.st,v 1.1 2014-02-05 19:08:23 cg Exp $'
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
! !
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167