Diff3TextView.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 16 Mar 2012 17:08:17 +0000
branchjv
changeset 12179 47f98e7d6de1
parent 12125 0c49a3b13e43
child 12254 b1237f76f501
permissions -rw-r--r--
Improvments towards merge tool
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"
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   235
! !
bbed5ec2fbeb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   236
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
!Diff3TextView methodsFor:'initialization'!
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
initStyle
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
    super initStyle.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
    showSeparators := false.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
3703
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   244
    useColors := true.
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
    useColors ifTrue:[
3703
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   246
        device hasColors ifTrue:[
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   247
            addedColor := Color black.
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   248
            addedBgColor := Color green.
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
3703
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   250
            removedColor := Color white.
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   251
            removedBgColor := Color red.
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
3703
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   253
            changedColor := Color white.
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   254
            changedBgColor := Color blue.
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   255
        ] ifFalse:[
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   256
            addedBgColor := removedBgColor := changedBgColor := Color black.
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   257
            addedColor := removedColor := changedColor := Color white.
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   258
        ]
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
    ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
    "Created: 16.11.1995 / 16:59:48 / cg"
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
    "Modified: 12.12.1995 / 12:25:55 / cg"
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
! !
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
!Diff3TextView methodsFor:'private'!
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
updateListsFromMergedText:mergedText
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
    "given the merge()/rcsmerge() merged output (as created by 'cvs update'),
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
     update my views contents"
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
3703
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   271
    |idx1 idx2 idx3 dIdx dEnd state entry l1 l2 l3  
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
     textView1 textView2 textView3 skip max|
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
    textView1 := textViews at:1.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
    textView2 := textViews at:2.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
    textView3 := textViews at:3.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
    l1 := OrderedCollection new.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
    l2 := OrderedCollection new.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   280
    l3 := OrderedCollection new.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
    idx1 := 1.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
    idx2 := 1.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
    idx3 := 1.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
    dIdx := 1.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
    dEnd := mergedText size + 1.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
    state := #initial.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
    [dIdx < dEnd] whileTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
        dIdx == dEnd ifTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
            "dummy cleanup entry"
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
            entry := nil.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
            state := #initial.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
        ] ifFalse:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
            entry := mergedText at:dIdx.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
            dIdx := dIdx + 1.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   297
        ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
        state == #initial ifTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
            "
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
             fill up to size difference from previous change
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
            "
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   303
            max := (l1 size max:l2 size) max:l3 size.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   304
            [l1 size < max] whileTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
                l1 add:nil
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
            ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
            [l2 size < max] whileTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
                l2 add:nil
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
            ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
            [l3 size < max] whileTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
                l3 add:nil
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
            ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
        
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
            "
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
             except for the first chunk, add a separating line
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
            "
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
            l1 size ~~ 0 ifTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
                showSeparators ifTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
                    l1 add:'--------'.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
                    l2 add:'--------'.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
                    l3 add:'--------'.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
                ]
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   323
            ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
        ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
        skip := false.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
        entry notNil ifTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
            (entry startsWith:'<<<<<<<') ifTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
                state := 1. skip := true.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
            ] ifFalse:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   332
                (entry startsWith:'|||||||') ifTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   333
                    state := 2. skip := true.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
                ] ifFalse:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
                    (entry startsWith:'=======') ifTrue:[
290
5b9361cfa7b8 oops - merge output is different than expected sometimes
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   336
                        state == 2 ifFalse:[
5b9361cfa7b8 oops - merge output is different than expected sometimes
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   337
                            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
   338
                        ] ifTrue:[
5b9361cfa7b8 oops - merge output is different than expected sometimes
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   339
                            state := 3         "/ only in 3
5b9361cfa7b8 oops - merge output is different than expected sometimes
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   340
                        ].
5b9361cfa7b8 oops - merge output is different than expected sometimes
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   341
                        skip := true.
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
                    ] ifFalse:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
                        (entry startsWith:'>>>>>>>') ifTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   344
                            state := #initial.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
                            skip := true.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
                        ]
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
                    ]
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
                ]
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
            ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
            skip ifFalse:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
                (state == #initial or:[state == 1]) ifTrue:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
                    (useColors and:[state == 1]) ifTrue:[
3703
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   354
                        l1 add:(Text string:entry 
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   355
                                     emphasis:(Array with:(#color->changedColor)
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   356
                                                     with:(#backgroundColor->changedBgColor))).
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
                    ] ifFalse:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
                        l1 add:entry
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
                    ]
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
                ].
290
5b9361cfa7b8 oops - merge output is different than expected sometimes
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   361
                (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
   362
                    (useColors and:[state == 2 or:[state == 23]]) ifTrue:[
3703
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   363
                        l2 add:(Text string:entry 
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   364
                                     emphasis:(Array with:(#color->changedColor)
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   365
                                                     with:(#backgroundColor->changedBgColor))).
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
                    ] ifFalse:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
                        l2 add:entry
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   368
                    ]
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
                ].
290
5b9361cfa7b8 oops - merge output is different than expected sometimes
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   370
                (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
   371
                    (useColors and:[state == 3 or:[state == 23]]) ifTrue:[
3703
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   372
                        l3 add:(Text string:entry 
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   373
                                     emphasis:(Array with:(#color->changedColor)
97c92239e22f Use Text instead of ColoredListEntry
Stefan Vogel <sv@exept.de>
parents: 2852
diff changeset
   374
                                                     with:(#backgroundColor->changedBgColor))).
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   375
                    ] ifFalse:[
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   376
                        l3 add:entry
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   377
                    ]
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   378
                ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   379
            ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   380
        ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   381
    ].
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
        
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
    textView1 list:l1.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   384
    textView2 list:l2.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
    textView3 list:l3.
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   386
290
5b9361cfa7b8 oops - merge output is different than expected sometimes
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   387
    "Modified: 13.12.1995 / 19:56:32 / cg"
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
! !
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
2245
0d94b4d7d4bc comment
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   390
!Diff3TextView class methodsFor:'documentation'!
271
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
16d2d5f9c31c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
version
12179
47f98e7d6de1 Improvments towards merge tool
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12125
diff changeset
   393
    ^ '$Id: Diff3TextView.st 7925 2012-03-16 17:08:17Z vranyj1 $'
47f98e7d6de1 Improvments towards merge tool
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12125
diff changeset
   394
!
47f98e7d6de1 Improvments towards merge tool
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12125
diff changeset
   395
47f98e7d6de1 Improvments towards merge tool
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12125
diff changeset
   396
version_SVN
47f98e7d6de1 Improvments towards merge tool
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12125
diff changeset
   397
    ^ '$Id: Diff3TextView.st 7925 2012-03-16 17:08:17Z vranyj1 $'
12125
0c49a3b13e43 Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12123
diff changeset
   398
! !