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