Diff3Hunk.st
author Stefan Vogel <sv@exept.de>
Fri, 17 May 2019 17:11:44 +0200
changeset 18767 0478d93cdb75
parent 16782 9eb5bdcd657a
child 16797 4f240085a622
permissions -rw-r--r--
#REFACTORING by stefan Sanitize BlockValues class: Tools::Inspector2 changed: #toolbarBackgroundHolder
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
16782
9eb5bdcd657a #OTHER by mawalch
mawalch
parents: 14008
diff changeset
    32
"{ NameSpace: Smalltalk }"
9eb5bdcd657a #OTHER by mawalch
mawalch
parents: 14008
diff changeset
    33
13865
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
Object subclass:#Diff3Hunk
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
	instanceVariableNames:'side oldChunk newChunk'
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
	classVariableNames:''
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
	poolDictionaries:''
14008
289b26a46d64 documentation
Claus Gittinger <cg@exept.de>
parents: 13865
diff changeset
    38
	category:'Collections-Sequenceable-Diff'
13865
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
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
    42
Instance Variables
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
	newChunk:	<DiffChunk> The new content chunk
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
	oldChunk:	<DiffChunk> The old (ancestral) content chunk
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
	side:		<Symbol> Either #left or #right
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
'
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
!Diff3Hunk class methodsFor:'documentation'!
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
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
"
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
 Copyright (c) 2007-2012 Tony Garnock-Jones
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
 This code is based on Squeak's DiffMerge package
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
 written by Tony Garnock-Jones. Original project's web site:
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
 http://www.squeaksource.com/DiffMerge
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
 Permission is hereby granted, free of charge, to any person
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
 obtaining a copy of this software and associated documentation
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
 files (the 'Software'), to deal in the Software without
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
 restriction, including without limitation the rights to use,
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
 copy, modify, merge, publish, distribute, sublicense, and/or sell
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
 copies of the Software, and to permit persons to whom the
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
 Software is furnished to do so, subject to the following
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
 conditions:
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
 The above copyright notice and this permission notice shall be
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
 included in all copies or substantial portions of the Software.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
 OTHER DEALINGS IN THE SOFTWARE.
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
!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
documentation
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
"
14008
289b26a46d64 documentation
Claus Gittinger <cg@exept.de>
parents: 13865
diff changeset
    86
    A Diff3Hunk represents a change from the ancestor to either the left or the right branch as part of a three-way merge.
13865
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
14008
289b26a46d64 documentation
Claus Gittinger <cg@exept.de>
parents: 13865
diff changeset
    88
    Instance Variables
13865
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
        newChunk:       <DiffChunk> The new content chunk
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
        oldChunk:       <DiffChunk> The old (ancestral) content chunk
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
        side:           <Symbol> Either #left or #right
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
    [author:]
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
        Tony Garnock-Jones <tonyg@lshift.com>
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    [instance 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
    [class variables:]
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    [see also:]
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
! !
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
!Diff3Hunk class methodsFor:'as yet unclassified'!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
side: aSelector entry: anAssociation
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
	^ self new side: aSelector; oldChunk: anAssociation key; newChunk: anAssociation value
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
! !
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
!Diff3Hunk methodsFor:'accessing'!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
newChunk
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
	^ newChunk
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
newChunk: anObject
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
	newChunk := anObject
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
oldChunk
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
	^ oldChunk
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
oldChunk: anObject
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
	oldChunk := anObject
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
side
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
	^ side
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
side: anObject
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
	side := anObject
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
! !
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
!Diff3Hunk methodsFor:'comparing'!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
<= otherHunk
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
	^ (oldChunk < otherHunk oldChunk) or:
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
		[(otherHunk oldChunk = oldChunk) and: [side = #left]]
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
! !
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
!Diff3Hunk methodsFor:'printing & storing'!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
printOn:aStream
16782
9eb5bdcd657a #OTHER by mawalch
mawalch
parents: 14008
diff changeset
   147
    "append a printed representation of the receiver to the argument, aStream"
13865
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
    super printOn:aStream.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
    aStream nextPutAll:' side: '.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
    side printOn:aStream.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
    aStream nextPutAll:' old: '.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
    oldChunk printOn:aStream.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
    aStream nextPutAll:' new: '.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
    newChunk printOn:aStream.
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
    "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
   158
! !
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
!Diff3Hunk class methodsFor:'documentation'!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
version
16782
9eb5bdcd657a #OTHER by mawalch
mawalch
parents: 14008
diff changeset
   163
    ^ '$Header$'
13865
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
!
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
version_CVS
16782
9eb5bdcd657a #OTHER by mawalch
mawalch
parents: 14008
diff changeset
   167
    ^ '$Header$'
13865
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
! !
f9662607a6e4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169