common/SCMCommonSourceCodeManagerUtilities.st
author Claus Gittinger <cg@exept.de>
Wed, 01 Aug 2018 13:24:07 +0200
branchcvs_MAIN
changeset 853 4e41a616ceca
parent 803 73291d6b935a
child 894 dbd87ace9c74
permissions -rw-r--r--
#DOCUMENTATION by cg class: HGRepositoryObject comment/format in: #synchronizationSemaphore:

"
stx:libscm - a new source code management library for Smalltalk/X
Copyright (C) 2012-2015 Jan Vrany

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License. 

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
"
"{ Package: 'stx:libscm/common' }"

"{ NameSpace: Smalltalk }"

SourceCodeManagerUtilities subclass:#SCMCommonSourceCodeManagerUtilities
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'SCM-Common-StX'
!

!SCMCommonSourceCodeManagerUtilities class methodsFor:'documentation'!

copyright
"
stx:libscm - a new source code management library for Smalltalk/X
Copyright (C) 2012-2015 Jan Vrany

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License. 

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
"
! !

!SCMCommonSourceCodeManagerUtilities methodsFor:'utilities-cvs'!

checkinClass:aClass withInfo:aLogInfoOrNil withCheck:doCheckClass usingManager:aManagerOrNil
    "check a class into the source repository.
     If the argument, aLogInfoOrNil isNil, ask interactively for log-message.
     If doCheckClass is true, the class is checked for send of halts etc."

   ^self checkinClasses:(Array with: aClass) withInfo:aLogInfoOrNil withCheck:doCheckClass usingManager:aManagerOrNil

    "Created: / 25-12-2011 / 23:45:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

checkinClasses:classes withInfo:aLogInfoOrNil withCheck:doCheckClass usingManager:aManagerOrNil onBranch:branchNameOrNil
    | classesPerPackage |

    branchNameOrNil notNil ifTrue:[self error:'branches not yet supported'].

    classesPerPackage := Dictionary new.
    classes do:[:class|
        (classesPerPackage at:(class theNonMetaclass package) ifAbsentPut:[Set new])
            add:(class theNonMetaclass)
    ].
    classesPerPackage keysAndValuesDo:[:packageId :classes| 
        | package |
        
        package := manager packageRegistryClass packageNamed: packageId.
        manager commitDialogClass new
            task: (package commitTask
                    classes: classes;
                    message: aLogInfoOrNil;
                    extensionMethods: #()
                    yourself);
            open
    ].
    ^ true

    "Created: / 05-12-2017 / 20:17:09 / cg"
!

checkinPackage:packageToCheckIn classes:doClasses extensions:doExtensions buildSupport:doBuild askForMethodsInOtherPackages:askForMethodsInOtherPackages onBranch:branchNameOrNil
    | package task |

    branchNameOrNil notNil ifTrue:[self error:'branches not yet supported'].
    
    package := manager packageRegistryClass packageNamed: packageToCheckIn.
    package isNil ifTrue:[
        Dialog warn: (resources string: 'No repository for package %1' with: packageToCheckIn).
        ^self
    ].
    task := package commitTask.
    task suppressClasses: doClasses not.
    task suppressExtensions: doExtensions not.
    task suppresBuildSupportFiles: doBuild not.

    package commitDialog
            task: task;
            open

    "Created: / 05-12-2017 / 20:03:14 / cg"
!

compareProject:aProject withRepositoryVersionFrom:aDateOrNilForNewest extensionsOnly:extensionsOnly
    |diffSet|

    diffSet := self diffSetOfProject:aProject againstRepositoryVersionFrom:aDateOrNilForNewest extensionsOnly:extensionsOnly.

    (Tools::ChangeSetDiffTool new)
        diffset:diffSet;
        title:('Differences of %1' bindWith:aProject);
        open.

    "Created: / 18-01-2012 / 16:04:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

diffSetOfProject: package againstRepositoryVersionFrom:dateOrNil extensionsOnly:extensionsOnly

    self shouldImplement

    "Created: / 15-10-2011 / 23:26:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 14-11-2012 / 01:07:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

tagClass:aClass as:tag
    "/ TODO: remove this - its the manager to decide
    Dialog warn: 'Individual class tagging not supported by this SCM. Tag whole package instead'.

    "Created: / 15-10-2011 / 22:48:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified (comment): / 05-12-2017 / 22:57:17 / cg"
!

tagClasses:classes as:tag revision:revision
    "/ TODO: remove this - its the manager to decide
    Dialog warn: 'Individual class tagging not supported by this SCM. Tag whole package instead'.

    "Created: / 05-12-2017 / 22:54:31 / cg"
!

tagPackage: package as:tag
    "/ TODO: remove this - its the manager to decide
    Dialog warn: 'Not yet implemented'

    "Created: / 12-09-2006 / 13:04:29 / cg"
    "Created: / 15-10-2011 / 22:49:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified (comment): / 05-12-2017 / 22:57:45 / cg"
! !

!SCMCommonSourceCodeManagerUtilities class methodsFor:'documentation'!

version
    ^ '$Header$'
!

version_CVS
    ^ '$Header$'
!

version_HG

    ^ '$Changeset: <not expanded> $'
!

version_SVN
    ^ '$Id$'
! !