SourceCodeManagerUtilitiesForWorkspaceBasedManagers.st
author Claus Gittinger <cg@exept.de>
Mon, 20 Aug 2018 10:11:25 +0200
changeset 4346 6604af2f1554
parent 4278 ad6965e30ee9
child 4535 06f65b219477
permissions -rw-r--r--
#OTHER by cg class: FileBasedSourceCodeManager class removed: #version_FileRepository
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2849
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 2012 eXept Software AG
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libbasic3' }"
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
4278
ad6965e30ee9 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3142
diff changeset
    14
"{ NameSpace: Smalltalk }"
ad6965e30ee9 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3142
diff changeset
    15
2849
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
SourceCodeManagerUtilities subclass:#SourceCodeManagerUtilitiesForWorkspaceBasedManagers
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:''
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	classVariableNames:''
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	category:'System-SourceCodeManagement'
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!SourceCodeManagerUtilitiesForWorkspaceBasedManagers class methodsFor:'documentation'!
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
copyright
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
"
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
 COPYRIGHT (c) 2012 eXept Software AG
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
              All Rights Reserved
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 This software is furnished under a license and may be used
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 only in accordance with the terms of that license and with the
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 be provided or otherwise made available to, or used by, any
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 other person.  No title to or ownership of the software is
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 hereby transferred.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
"
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
! !
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
!SourceCodeManagerUtilitiesForWorkspaceBasedManagers methodsFor:'utilities-cvs'!
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
4278
ad6965e30ee9 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3142
diff changeset
    41
checkinPackage:packageToCheckIn classes:doClasses extensions:doExtensions buildSupport:doBuild askForMethodsInOtherPackages:askForMethodsInOtherPackages onBranch:branchNameOrNil
2849
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    |mgr classesToCheckIn methodsToCheckIn
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
     methodsInOtherPackages looseMethods otherPackages
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
     msg classesInChangeSet checkinInfo repos pkgDir extensionsSource defClass
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
     path fileIsNew|
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    mgr := self sourceCodeManagerFor: packageToCheckIn.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    repos := (mgr repositoryNameForPackage:packageToCheckIn) ifNil:[mgr repositoryName].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
2917
9efb40fbb7e9 changed: #checkinPackage:classes:extensions:buildSupport:askForMethodsInOtherPackages:
Claus Gittinger <cg@exept.de>
parents: 2905
diff changeset
    51
    pkgDir := packageToCheckIn asPackageId pathRelativeToTopDirectory:(mgr workDirectory). 
2849
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
    pkgDir recursiveMakeDirectory.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
    "/ containerFileName := self nameOfExtensionsContainer.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    methodsToCheckIn := IdentitySet new.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
    methodsInOtherPackages := IdentitySet new.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    looseMethods := IdentitySet new.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    classesToCheckIn := Smalltalk allClassesInPackage: packageToCheckIn.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
    "/ cg: O(n^2) algorithm
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
    "/  classesInChangeSet := classesToCheckIn select:[:cls | cls hasUnsavedChanges].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
    "/ replaced by: O(n) algorithm
2905
83aff4beafc7 method renamed for clarity
Claus Gittinger <cg@exept.de>
parents: 2849
diff changeset
    65
    classesInChangeSet := ChangeSet current selectClassesForWhichIncludesChangeForClassOrMetaclassOrPrivateClassFrom:classesToCheckIn. 
2849
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
    "/ individual methods ...
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
    Smalltalk allClassesDo:[:aClass |
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
        aClass isMeta ifFalse:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
            methodsToCheckIn addAll:(aClass extensionsFrom:packageToCheckIn).
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
        ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    self assert:doExtensions.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
    self assert:doClasses.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
    self assert:doBuild.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
    msg := '%1 classes (%4 changed) '.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
    methodsToCheckIn notEmpty ifTrue:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
        msg := msg , 'and %2 extensions '.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
    ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
    msg := msg , 'of project "%3"'.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
    checkinInfo := self
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
                getCheckinInfoFor:(msg
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
                                        bindWith:classesToCheckIn size
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
                                        with:methodsToCheckIn size
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
                                        with:packageToCheckIn allBold
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
                                        with:classesInChangeSet size)
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
                initialAnswer:nil
3142
c84a79e49811 class: SourceCodeManagerUtilitiesForWorkspaceBasedManagers
Claus Gittinger <cg@exept.de>
parents: 3132
diff changeset
    91
                withQuickOption:false
c84a79e49811 class: SourceCodeManagerUtilitiesForWorkspaceBasedManagers
Claus Gittinger <cg@exept.de>
parents: 3132
diff changeset
    92
                withValidateConsistencyOption:true.
2849
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
    checkinInfo isNil ifTrue:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
        ^ self.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
    ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
3142
c84a79e49811 class: SourceCodeManagerUtilitiesForWorkspaceBasedManagers
Claus Gittinger <cg@exept.de>
parents: 3132
diff changeset
    97
    checkinInfo validateConsistency ifTrue:[
c84a79e49811 class: SourceCodeManagerUtilitiesForWorkspaceBasedManagers
Claus Gittinger <cg@exept.de>
parents: 3132
diff changeset
    98
        self validateConsistencyOfPackage:packageToCheckIn.
c84a79e49811 class: SourceCodeManagerUtilitiesForWorkspaceBasedManagers
Claus Gittinger <cg@exept.de>
parents: 3132
diff changeset
    99
    ].
c84a79e49811 class: SourceCodeManagerUtilitiesForWorkspaceBasedManagers
Claus Gittinger <cg@exept.de>
parents: 3132
diff changeset
   100
2849
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
    "/ check if any of the classes contains methods for other packages ...
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
    classesToCheckIn do:[:eachClass |
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
        eachClass instAndClassMethodsDo:[:eachMethod |
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
            |mPgk|
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
            mPgk := eachMethod package.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
            (mPgk = packageToCheckIn) ifFalse:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
                mPgk == PackageId noProjectID ifTrue:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
                    looseMethods add:eachMethod
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
                ] ifFalse:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
                    methodsInOtherPackages add:eachMethod
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
                ]
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
            ]
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
        ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
    ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
    askForMethodsInOtherPackages ifTrue:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
        methodsInOtherPackages notEmpty ifTrue:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
            otherPackages := Set new.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
            methodsInOtherPackages do:[:eachMethod | otherPackages add:eachMethod package].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
            methodsInOtherPackages size == 1 ifTrue:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
                msg := 'The ''%4'' method in ''%5'' is contained in the ''%2'' package.'.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
                msg := msg , '\\This method will remain in its package.'.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
            ] ifFalse:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
                otherPackages size == 1 ifTrue:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
                    msg := 'The %1 methods from the %2 package will remain in its package.'
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
                ] ifFalse:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
                    msg := 'The %1 methods from %3 other packages will remain in their packages.'
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
                ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
                msg := msg , '\\Hint: if these are meant to belong to this package,'.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
                msg := msg , '\move them first, then repeat the checkin operation.'.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
            ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
            msg := msg withCRs.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
            msg := msg bindWith:methodsInOtherPackages size
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
                           with:otherPackages first allBold
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
                           with:otherPackages size
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
                           with:methodsInOtherPackages first selector allBold
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
                           with:methodsInOtherPackages first mclass name allBold.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
            (Dialog confirm:msg noLabel:(resources string:'Cancel')) ifFalse:[^ self].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
        ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
    ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
    classesToCheckIn notEmpty ifTrue:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
        looseMethods notEmpty ifTrue:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
            looseMethods size == 1 ifTrue:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
                msg := 'The ''%2'' method in ''%3'' is unassigned (loose).'.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
                msg := msg , '\\If you proceed, this method will be moved to the ''%4'' package'.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
                msg := msg , '\\Hint: if this is meant to be an extension of another package,'.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
                msg := msg , '\cancel and move it to the appropriate package first.'.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
            ] ifFalse:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
                msg := 'There are %1 unassigned (loose) methods in classes from this project.'.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
                msg := msg , '\\If you proceed, those will be moved to the ''%4'' package ?'.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
                msg := msg , '\\Hint: if these are meant to be extensions of another package,'.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
                msg := msg , '\cancel and move them to the appropriate package first.'.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
            ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
            msg := msg withCRs.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
            msg := msg bindWith:looseMethods size
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
                           with:(looseMethods isEmpty ifTrue:[''] ifFalse:[looseMethods first selector allBold])
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
                           with:(looseMethods isEmpty ifTrue:[''] ifFalse:[looseMethods first mclass name allBold])
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
                           with:packageToCheckIn allBold.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
            (Dialog confirm:msg noLabel:(resources string:'Cancel')) ifFalse:[^ self].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
            looseMethods do:[:mthd |
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
                mthd package:packageToCheckIn
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
            ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
        ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
        classesToCheckIn do:[:eachClass |
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
            |classFileName|
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
            classFileName := (Smalltalk fileNameForClass:eachClass) , '.st'.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
            mgr
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
                withClass:eachClass 
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
                classFileName:classFileName 
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
                filedOutToTemporaryFileDo:[:tempFile |
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
                    path := pkgDir construct:classFileName.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
                    fileIsNew := path exists not.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
                    tempFile moveTo:path.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
                    fileIsNew ifTrue:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
                        mgr addFile:path baseName inDirectory:path directory.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
                    ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
                ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
        ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
    ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
    path := pkgDir construct:self nameOfExtensionsContainer.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
    methodsToCheckIn notEmpty ifTrue:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
        extensionsSource := self sourceCodeForExtensions:methodsToCheckIn package:packageToCheckIn forManager:mgr.
3132
23fd7d727582 extensions with utf8
Claus Gittinger <cg@exept.de>
parents: 2917
diff changeset
   190
        "Care for non-ASCII/non-ISO-8859 characters in extension methods"
23fd7d727582 extensions with utf8
Claus Gittinger <cg@exept.de>
parents: 2917
diff changeset
   191
        extensionsSource isWideString ifTrue:[
23fd7d727582 extensions with utf8
Claus Gittinger <cg@exept.de>
parents: 2917
diff changeset
   192
            extensionsSource := '"{ Encoding: utf8 }"' , Character cr asString , Character cr asString , extensionsSource.                
23fd7d727582 extensions with utf8
Claus Gittinger <cg@exept.de>
parents: 2917
diff changeset
   193
            extensionsSource := extensionsSource utf8Encoded.
23fd7d727582 extensions with utf8
Claus Gittinger <cg@exept.de>
parents: 2917
diff changeset
   194
        ].
2849
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
        fileIsNew := path exists not.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
        path contents:extensionsSource.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
        fileIsNew ifTrue:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
            mgr addFile:path baseName inDirectory:path directory.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
        ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
   ] ifFalse:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
        "/ there may have been extension-methods previously - if so, remove them
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
        path remove
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
    ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
    defClass := ProjectDefinition definitionClassForPackage: packageToCheckIn.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
    defClass forEachFileNameAndGeneratedContentsDo:[:fileName :fileContents |
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
        path := pkgDir construct:fileName.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
        fileIsNew := path exists not.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
        path directory exists ifFalse:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
            path directory recursiveMakeDirectory. "/ for autopackage
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
            mgr addFile:path directory baseName inDirectory:path directory directory.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
        ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
        path contents:fileContents.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
        fileIsNew ifTrue:[
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
            mgr addFile:fileName inDirectory:path directory.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
        ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
    ].
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
    mgr commitRepository:repos logMessage:checkinInfo logMessage.
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
4278
ad6965e30ee9 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3142
diff changeset
   221
    "Created: / 05-12-2017 / 20:03:10 / cg"
2849
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
! !
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
!SourceCodeManagerUtilitiesForWorkspaceBasedManagers class methodsFor:'documentation'!
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
version
4278
ad6965e30ee9 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3142
diff changeset
   227
    ^ '$Header$'
2849
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
!
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
version_CVS
4278
ad6965e30ee9 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3142
diff changeset
   231
    ^ '$Header$'
2849
b793485151c4 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
! !
3132
23fd7d727582 extensions with utf8
Claus Gittinger <cg@exept.de>
parents: 2917
diff changeset
   233