Diff3TextView.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 04 Apr 2013 19:06:16 +0100
branchjv
changeset 12650 e0f607754b9a
parent 12401 4714b9640528
child 15566 184cea584be5
permissions -rw-r--r--
Merged 18d06283743d and ff31bac2fd1b (branch default - CVS HEAD)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
277
b4b2782bc733 documentation
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
b4b2782bc733 documentation
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
     3
              All Rights Reserved
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
2851
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
    12
"{ Package: 'stx:libtool' }"
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
    13
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
ThreeColumnTextView subclass:#Diff3TextView
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	instanceVariableNames:'useColors showSeparators addedColor addedBgColor removedColor
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
		removedBgColor changedColor changedBgColor'
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	classVariableNames:''
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	poolDictionaries:''
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	category:'Views-Text'
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
!
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
2245
0d94b4d7d4bc comment
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    22
!Diff3TextView class methodsFor:'documentation'!
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
copyright
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
"
277
b4b2782bc733 documentation
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
    26
 COPYRIGHT (c) 1995 by Claus Gittinger
b4b2782bc733 documentation
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
    27
              All Rights Reserved
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 This software is furnished under a license and may be used
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 only in accordance with the terms of that license and with the
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 be provided or otherwise made available to, or used by, any
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 other person.  No title to or ownership of the software is
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 hereby transferred.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
"
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
!
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
documentation
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
"
277
b4b2782bc733 documentation
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
    40
    a view showing merged diff3 (see rcsmerge / merge unix manual pages) output in a 
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    user-friendly form.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    The view is created and opened with:
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
277
b4b2782bc733 documentation
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
    44
       d := Diff3TextView openOn:text label:l1 label:l2 label:l3.
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
277
b4b2782bc733 documentation
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
    46
    and it will show the 3 versions side-by-side
b4b2782bc733 documentation
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
    47
    Its main use is for the SourceCodeManager, to show merged sources after
b4b2782bc733 documentation
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
    48
    a failed checkin.
2245
0d94b4d7d4bc comment
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    49
0d94b4d7d4bc comment
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    50
    Notice:
0d94b4d7d4bc comment
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    51
        This has diff3 output (or cvs diff output) hardwired into it.
0d94b4d7d4bc comment
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    52
        Needs to be adapted, if that format ever changes.
0d94b4d7d4bc comment
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    53
0d94b4d7d4bc comment
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    54
    [see also:]
0d94b4d7d4bc comment
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    55
        TextView EditTextView DiffTextView
0d94b4d7d4bc comment
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    56
0d94b4d7d4bc comment
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    57
    [author:]
0d94b4d7d4bc comment
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    58
        Claus Gittinger
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
"
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
! !
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
2245
0d94b4d7d4bc comment
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    62
!Diff3TextView class methodsFor:'instance creation'!
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
openOnMergedText:text label:firstLabel label:secondLabel label:thirdLabel
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
    "open up a view showing firstText, secondText and thirdText side-by-side,
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
     and labels for all views."
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
    |top v l1 l2 l3|
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
    top := StandardSystemView label:'three texts'.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    l1 := Label label:firstLabel in:top.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
    l1 origin:0.0@0.0 corner:0.33@(l1 height).
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    l2 := Label label:secondLabel in:top.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
    l2 origin:0.33@0.0 corner:0.67@(l1 height).
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
    l3 := Label label:thirdLabel in:top.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
    l3 origin:0.67@0.0 corner:1.0@(l1 height).
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
    v := HVScrollableView 
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
               for:self 
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
               miniScrollerH:true miniScrollerV:false
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
               in:top.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
    v origin:0.0 @ (l1 height + ViewSpacing) corner:1.0 @ 1.0.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
    v scrolledView updateListsFromMergedText:text.
2245
0d94b4d7d4bc comment
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    85
0d94b4d7d4bc comment
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    86
"/    self addNextPreviousButtons.
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
    ^ top open
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
    "
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
     ThreeColumnTextView
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
        openOn:('smalltalk.rc' asFilename contentsOfEntireFile)
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
        label:'smalltalk.rc'
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
        and:('display.rc' asFilename contentsOfEntireFile)
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
        label:'display.rc'
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
        and:('private.rc' asFilename contentsOfEntireFile)
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
        label:'private.rc'
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
    "
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
    "Modified: 12.12.1995 / 13:09:13 / cg"
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
! !
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
2245
0d94b4d7d4bc comment
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   102
!Diff3TextView class methodsFor:'public helpers'!
713
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   103
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   104
emphasizeMergedDiff3Text:mergedText emphasize1:e1 emphasize2:e2 emphasizeSep:e3
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   105
    "given the merge()/rcsmerge() merged output (as created by 'cvs update'),
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   106
     create & return a text object which contains the conflicts 
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   107
     highlighted.
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   108
     CAVEAT: this is a highly specialized method - probably not the right place
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   109
     for it here ..."
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   110
3703
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   111
    |dIdx dEnd state entry list skip l1 l2 buffer
2851
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   112
     sameAtStart sameAtEnd sepYourVersion sepOtherVersion sepLine|
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   113
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   114
    sepYourVersion  := '----- your version -----'.
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   115
    sepOtherVersion := '----- other version ----'.
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   116
    sepLine := '------------------------'.
713
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   117
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   118
    list := OrderedCollection new.
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   119
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   120
    dIdx := 1.
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   121
    dEnd := mergedText size + 1.
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   122
    state := #initial.
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   123
    [dIdx < dEnd] whileTrue:[
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   124
        dIdx == dEnd ifTrue:[
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   125
            "dummy cleanup entry"
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   126
            entry := nil.
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   127
            state := #initial.
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   128
        ] ifFalse:[
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   129
            entry := mergedText at:dIdx.
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   130
            dIdx := dIdx + 1.
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   131
        ].
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   132
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   133
        skip := false.
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   134
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   135
        entry notNil ifTrue:[
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   136
            (entry startsWith:'<<<<<<<') ifTrue:[
2851
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   137
                state := 1. skip := true. 
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   138
                l1 := OrderedCollection new.
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   139
                buffer := l1.
713
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   140
            ] ifFalse:[
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   141
                (entry startsWith:'|||||||') ifTrue:[
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   142
                    state := 2. skip := true.
2851
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   143
                    buffer := nil.
713
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   144
                ] ifFalse:[
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   145
                    (entry startsWith:'=======') ifTrue:[
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   146
                        state == 2 ifFalse:[
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   147
                            state := 23        "/ on both 2 and 3
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   148
                        ] ifTrue:[
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   149
                            state := 3         "/ only in 3
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   150
                        ].
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   151
                        skip := true.
2851
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   152
                        l2 := OrderedCollection new.
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   153
                        buffer := l2.
713
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   154
                    ] ifFalse:[
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   155
                        (entry startsWith:'>>>>>>>') ifTrue:[
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   156
                            state := #initial.
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   157
                            skip := true.
2851
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   158
                            buffer := nil.
713
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   159
                        ]
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   160
                    ]
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   161
                ]
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   162
            ].
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   163
2851
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   164
            state == #initial ifTrue:[
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   165
                l1 notNil ifTrue:[
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   166
                    "/ diff3-output is sometimes stupid; fix some here
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   167
                    sameAtStart := OrderedCollection new.
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   168
                    [l1 notEmpty and:[l2 notEmpty and:[l1 first = l2 first or:[l1 first withTabsExpanded = l2 first withTabsExpanded]]]] whileTrue:[
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   169
                        sameAtStart addLast:l1 removeFirst.
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   170
                        l2 removeFirst
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   171
                    ].
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   172
                    sameAtEnd := OrderedCollection new.
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   173
                    [l1 notEmpty and:[l2 notEmpty and:[l1 last = l2 last or:[l1 last withTabsExpanded = l2 last withTabsExpanded]]]] whileTrue:[
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   174
                        sameAtEnd addFirst:l1 removeLast.
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   175
                        l2 removeLast
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   176
                    ].
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   177
                    sameAtStart do:[:eachEntry | list add:eachEntry].
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   178
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   179
                    (l1 notEmpty or:[l2 notEmpty]) ifTrue:[
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   180
                        list add:(e3 isNil ifTrue:[sepYourVersion] ifFalse:[Text string:sepYourVersion emphasis:e3]).
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   181
                        l1 do:[:eachEntry | list add:(e1 isNil ifTrue:[eachEntry] ifFalse:[Text string:eachEntry emphasis:e1])].
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   182
                        list add:(e3 isNil ifTrue:[sepOtherVersion] ifFalse:[Text string:sepOtherVersion emphasis:e3]).
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   183
                        l2 do:[:eachEntry | list add:(e2 isNil ifTrue:[eachEntry] ifFalse:[Text string:eachEntry emphasis:e2])].
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   184
                        list add:(e3 isNil ifTrue:[sepLine] ifFalse:[Text string:sepLine emphasis:e3]).
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   185
                    ].
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   186
                    sameAtEnd do:[:eachEntry | list add:eachEntry].
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   187
                    l1 := l2 := nil.
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   188
                ].
713
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   189
            ].
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   190
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   191
            skip ifFalse:[
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   192
                state == #initial ifTrue:[
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   193
                    list add:entry
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   194
                ].
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   195
                state == 1 ifTrue:[
2851
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   196
                    l1 add:entry.
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   197
"/                    e1 notNil ifTrue:[
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   198
"/                        list add:(Text string:entry emphasis:e1)
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   199
"/                    ] ifFalse:[
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   200
"/                        list add:entry
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   201
"/                    ]
713
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   202
                ].
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   203
                (state == 3 or:[state == 23]) ifTrue:[
2851
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   204
                    l2 add:entry
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   205
"/                    e2 notNil ifTrue:[
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   206
"/                        list add:(Text string:entry emphasis:e2)
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   207
"/                    ] ifFalse:[
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   208
"/                        list add:entry
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   209
"/                    ]
713
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   210
                ].
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   211
            ].
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   212
        ].
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   213
    ].
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   214
2851
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   215
    l1 notNil ifTrue:[
3703
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   216
        state ~~ #initial ifTrue:[self error:'oops - bad state should not happen ...'].
2851
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   217
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   218
        "/ diff3-output is sometimes stupid; fix some here
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   219
        [l1 notEmpty and:[l2 notEmpty and:[l1 first = l2 first or:[l1 first withTabsExpanded = l2 first withTabsExpanded]]]] whileTrue:[l1 removeFirst. l2 removeFirst].
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   220
        [l1 notEmpty and:[l2 notEmpty and:[l1 last = l2 last or:[l1 last withTabsExpanded = l2 last withTabsExpanded]]]] whileTrue:[l1 removeLast. l2 removeLast].
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   221
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   222
        (l1 notEmpty or:[l2 notEmpty]) ifTrue:[
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   223
            list add:(e3 isNil ifTrue:[sepYourVersion] ifFalse:[Text string:sepYourVersion emphasis:e3]).
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   224
            l1 do:[:eachEntry | list add:(e1 isNil ifTrue:[eachEntry] ifFalse:[Text string:eachEntry emphasis:e1])].
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   225
            list add:(e3 isNil ifTrue:[sepOtherVersion] ifFalse:[Text string:sepOtherVersion emphasis:e3]).
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   226
            l2 do:[:eachEntry | list add:(e2 isNil ifTrue:[eachEntry] ifFalse:[Text string:eachEntry emphasis:e2])].
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   227
            list add:(e3 isNil ifTrue:[sepLine] ifFalse:[Text string:sepLine emphasis:e3]).
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   228
        ].
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   229
        l1 := l2 := nil.
1d2fabb348d2 better diff3-output processing
Claus Gittinger <cg@exept.de>
parents: 2245
diff changeset
   230
    ].
713
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   231
    ^ list
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   232
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   233
    "Created: 9.9.1996 / 19:54:00 / cg"
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   234
    "Modified: 9.9.1996 / 20:41:40 / cg"
11537
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   235
!
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   236
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   237
emphasizeMergedDiff3TextFromPerforce:mergedText origEmphasis:origEmphasize otherEmphasis:otherEmphasize yourEmphasis:yourEmphasize separatorEmphasis:separatorEmphasize
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   238
    "given the merge()/rcsmerge() merged output (as created by 'cvs update'),
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   239
     create & return a text object which contains the conflicts 
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   240
     highlighted.
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   241
     CAVEAT: this is a highly specialized method - probably not the right place
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   242
     for it here ..."
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   243
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   244
    |list origSeparator otherSeparator yourSeparator endSeparator line currentEmphasis nextEmphasis|
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   245
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   246
    list := StringCollection new.
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   247
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   248
    origSeparator := '>>>> ORIGINAL //'.
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   249
    otherSeparator := '==== THEIRS //'.
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   250
    yourSeparator := '==== YOURS //'.
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   251
    endSeparator := '<<<<'.
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   252
    mergedText do:[:aLine|
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   253
        line := aLine withoutTrailingSeparators.
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   254
        (aLine startsWith:origSeparator) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   255
            currentEmphasis := separatorEmphasize.
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   256
            nextEmphasis := origEmphasize.
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   257
        ] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   258
            (aLine startsWith:otherSeparator) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   259
                currentEmphasis := separatorEmphasize.
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   260
                nextEmphasis := otherEmphasize.
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   261
            ] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   262
                (aLine startsWith:yourSeparator) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   263
                    currentEmphasis := separatorEmphasize.
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   264
                    nextEmphasis := yourEmphasize.
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   265
                ] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   266
                    (aLine startsWith:endSeparator) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   267
                        currentEmphasis := separatorEmphasize.
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   268
                        nextEmphasis := nil.
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   269
                    ] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   270
                        nextEmphasis := currentEmphasis.        
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   271
                    ].
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   272
                ].
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   273
            ].
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   274
        ].
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   275
        list add:(currentEmphasis isNil ifTrue:[aLine] ifFalse:[Text string:aLine emphasis:currentEmphasis]).
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   276
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   277
        currentEmphasis := nextEmphasis.        
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   278
    ].
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   279
    ^ list
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   280
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   281
    "Created: / 01-06-2012 / 10:44:31 / cg"
713
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   282
! !
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   283
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
!Diff3TextView methodsFor:'initialization'!
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
initStyle
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
    super initStyle.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
    showSeparators := false.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
3703
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   291
    useColors := true.
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
    useColors ifTrue:[
3703
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   293
        device hasColors ifTrue:[
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   294
            addedColor := Color black.
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   295
            addedBgColor := Color green.
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
3703
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   297
            removedColor := Color white.
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   298
            removedBgColor := Color red.
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
3703
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   300
            changedColor := Color white.
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   301
            changedBgColor := Color blue.
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   302
        ] ifFalse:[
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   303
            addedBgColor := removedBgColor := changedBgColor := Color black.
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   304
            addedColor := removedColor := changedColor := Color white.
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   305
        ]
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
    ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
    "Created: 16.11.1995 / 16:59:48 / cg"
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
    "Modified: 12.12.1995 / 12:25:55 / cg"
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
! !
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
!Diff3TextView methodsFor:'private'!
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
updateListsFromMergedText:mergedText
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
    "given the merge()/rcsmerge() merged output (as created by 'cvs update'),
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
     update my views contents"
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
3703
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   318
    |idx1 idx2 idx3 dIdx dEnd state entry l1 l2 l3  
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
     textView1 textView2 textView3 skip max|
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
    textView1 := textViews at:1.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
    textView2 := textViews at:2.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   323
    textView3 := textViews at:3.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
    l1 := OrderedCollection new.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
    l2 := OrderedCollection new.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
    l3 := OrderedCollection new.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
    idx1 := 1.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
    idx2 := 1.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
    idx3 := 1.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   332
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   333
    dIdx := 1.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
    dEnd := mergedText size + 1.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
    state := #initial.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   336
    [dIdx < dEnd] whileTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   337
        dIdx == dEnd ifTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
            "dummy cleanup entry"
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
            entry := nil.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   340
            state := #initial.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   341
        ] ifFalse:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
            entry := mergedText at:dIdx.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
            dIdx := dIdx + 1.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   344
        ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
        state == #initial ifTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
            "
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
             fill up to size difference from previous change
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
            "
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
            max := (l1 size max:l2 size) max:l3 size.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
            [l1 size < max] whileTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
                l1 add:nil
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
            ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
            [l2 size < max] whileTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
                l2 add:nil
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
            ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
            [l3 size < max] whileTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
                l3 add:nil
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
            ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
        
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
            "
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
             except for the first chunk, add a separating line
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
            "
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
            l1 size ~~ 0 ifTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
                showSeparators ifTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
                    l1 add:'--------'.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
                    l2 add:'--------'.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   368
                    l3 add:'--------'.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
                ]
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
            ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
        ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   372
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   373
        skip := false.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   374
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   375
        entry notNil ifTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   376
            (entry startsWith:'<<<<<<<') ifTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   377
                state := 1. skip := true.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   378
            ] ifFalse:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   379
                (entry startsWith:'|||||||') ifTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   380
                    state := 2. skip := true.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   381
                ] ifFalse:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
                    (entry startsWith:'=======') ifTrue:[
290
5b9361cfa7b8 oops - merge output is different than expected sometimes
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   383
                        state == 2 ifFalse:[
5b9361cfa7b8 oops - merge output is different than expected sometimes
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   384
                            state := 23        "/ on both 2 and 3
5b9361cfa7b8 oops - merge output is different than expected sometimes
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   385
                        ] ifTrue:[
5b9361cfa7b8 oops - merge output is different than expected sometimes
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   386
                            state := 3         "/ only in 3
5b9361cfa7b8 oops - merge output is different than expected sometimes
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   387
                        ].
5b9361cfa7b8 oops - merge output is different than expected sometimes
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   388
                        skip := true.
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
                    ] ifFalse:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
                        (entry startsWith:'>>>>>>>') ifTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
                            state := #initial.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
                            skip := true.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   393
                        ]
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   394
                    ]
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   395
                ]
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   396
            ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
            skip ifFalse:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   399
                (state == #initial or:[state == 1]) ifTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   400
                    (useColors and:[state == 1]) ifTrue:[
3703
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   401
                        l1 add:(Text string:entry 
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   402
                                     emphasis:(Array with:(#color->changedColor)
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   403
                                                     with:(#backgroundColor->changedBgColor))).
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   404
                    ] ifFalse:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
                        l1 add:entry
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   406
                    ]
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   407
                ].
290
5b9361cfa7b8 oops - merge output is different than expected sometimes
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   408
                (state == #initial or:[state == 2 or:[state == 23]]) ifTrue:[
5b9361cfa7b8 oops - merge output is different than expected sometimes
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   409
                    (useColors and:[state == 2 or:[state == 23]]) ifTrue:[
3703
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   410
                        l2 add:(Text string:entry 
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   411
                                     emphasis:(Array with:(#color->changedColor)
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   412
                                                     with:(#backgroundColor->changedBgColor))).
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   413
                    ] ifFalse:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   414
                        l2 add:entry
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   415
                    ]
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   416
                ].
290
5b9361cfa7b8 oops - merge output is different than expected sometimes
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   417
                (state == #initial or:[state == 3 or:[state == 23]]) ifTrue:[
5b9361cfa7b8 oops - merge output is different than expected sometimes
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   418
                    (useColors and:[state == 3 or:[state == 23]]) ifTrue:[
3703
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   419
                        l3 add:(Text string:entry 
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   420
                                     emphasis:(Array with:(#color->changedColor)
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   421
                                                     with:(#backgroundColor->changedBgColor))).
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   422
                    ] ifFalse:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   423
                        l3 add:entry
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   424
                    ]
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   425
                ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   426
            ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   427
        ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
    ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   429
        
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   430
    textView1 list:l1.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   431
    textView2 list:l2.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   432
    textView3 list:l3.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   433
290
5b9361cfa7b8 oops - merge output is different than expected sometimes
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   434
    "Modified: 13.12.1995 / 19:56:32 / cg"
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   435
! !
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   436
2245
0d94b4d7d4bc comment
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   437
!Diff3TextView class methodsFor:'documentation'!
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   438
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   439
version
11537
Claus Gittinger <cg@exept.de>
parents: 3703
diff changeset
   440
    ^ '$Header: /cvs/stx/stx/libtool/Diff3TextView.st,v 1.9 2012-06-01 10:44:15 cg Exp $'
12179
47f98e7d6de1 Improvments towards merge tool
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12125
diff changeset
   441
!
47f98e7d6de1 Improvments towards merge tool
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12125
diff changeset
   442
12650
e0f607754b9a Merged 18d06283743d and ff31bac2fd1b (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12401
diff changeset
   443
version_HG
e0f607754b9a Merged 18d06283743d and ff31bac2fd1b (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12401
diff changeset
   444
e0f607754b9a Merged 18d06283743d and ff31bac2fd1b (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12401
diff changeset
   445
    ^ '$Changeset: <not expanded> $'
e0f607754b9a Merged 18d06283743d and ff31bac2fd1b (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12401
diff changeset
   446
!
e0f607754b9a Merged 18d06283743d and ff31bac2fd1b (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12401
diff changeset
   447
12179
47f98e7d6de1 Improvments towards merge tool
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12125
diff changeset
   448
version_SVN
12261
b2a507f45d87 - Tools::ChangeSetBrowser2
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12254
diff changeset
   449
    ^ '$Id: Diff3TextView.st 8016 2012-07-18 09:57:46Z vranyj1 $'
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   450
! !
12401
4714b9640528 Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12261 11537
diff changeset
   451