MercurialSourceCodeManagementSettingsAppl.st
author Claus Gittinger <cg@exept.de>
Sat, 14 Jan 2012 21:22:15 +0100
changeset 11130 045e06ed380c
child 11132 c5fad2575a88
permissions -rw-r--r--
initial checkin

"
 COPYRIGHT (c) 2012 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ Package: 'stx:libtool' }"

AbstractSourceCodeManagementSettingsAppl subclass:#MercurialSourceCodeManagementSettingsAppl
	instanceVariableNames:'repositoryHolder manager repository listOfModules
		repositoryPrototypeList addPerModuleRepository removeEnabled
		removePerModuleRepository perModuleRepository
		defaultRepositoryHolder selectedPerModuleRepository
		hgBinDirectoryHolder hgExecutableHolder hgCommandTimeoutHolder
		repositoriesPerModule perModuleRepositoryModule'
	classVariableNames:'RecentlyUsedRepositoryURLS'
	poolDictionaries:''
	category:'System-SourceCodeManagement'
!

!MercurialSourceCodeManagementSettingsAppl class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2012 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    Mercurial part of the source code settings. 
    This settings app controls the parameters of the MercurialSourceCodeManager.

    Extrated for pluggability from SourceCodeManagerSettings in the AbstractSettingsApplication.
"
! !

!MercurialSourceCodeManagementSettingsAppl class methodsFor:'defaults'!

defaultRepositoryName

    ^ '/cvs/stx'

    "Created: / 19-04-2011 / 11:00:11 / cg"
! !

!MercurialSourceCodeManagementSettingsAppl class methodsFor:'help specs'!

helpSpec
    "This resource specification was automatically generated
     by the UIHelpTool of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIHelpTool may not be able to read the specification."

    "
     UIHelpTool openOnClass:CVSSourceCodeManagementSettingsAppl    
    "

    <resource: #help>

    ^ super helpSpec addPairsFrom:#(

#addPerModuleRoot
'Add this per-module entry'

#addPerPackageManager
'Add a new per-package manager definition'

#browseSourceCache
'Open a file browser on the source cache directory'

#checkPerPackageManager
'Open a window to show which scm-manager is responsible for which package.'

#condenseSourceCache
'Cleanup old cached versions from the source cache.\Will keep only the current (newest) version in the cache.\Access to older code versions will be slowed down (compare with old version browser function)'

#cvsCommand
'The command to use for cvs operations\(the path to "cvs"/"cvs.exe"-command. Not needed, if already in the shell''s PATH value)'

#cvsCommandTimeout
'The command timeout.\For slow connections (ssl-tunnel), it may make sense to increase this value.'

#cvsLogin
'Perform a "cvs login" operation for the default CVSROOT'

#cvsRootDefault
'The default CVSROOT.\This will be used for all modules which are not listed below.'

#cvsRootPerModule
'Specifies per-module CVSROOTs.\This allows for individual projects to be stored in different cvs repositories.'

#cvsRootPerModuleModule
'The module for which a specific CVSROOT is defined'

#cvsRootPerModuleRoot
'The CVSROOT for which this specific module is defined'

#defaultManagerType
'The default repository type.\This is used for packages for which no entry matches in the list below'

#editPerPackageManager
'Modify the selected per-package manager definition'

#flushSourceCache
'Remove all files from the source cache.\Access to source code will temporarily be slowed down,\until sources have been refetched from the repository'

#loginPerModuleRoot
'Execute a "cvs login" operation for this CVSROOT'

#moveManagerDown
'Move the selected entry down in the list.\(The first matching definition is used to determine which repository type is used.)'

#moveManagerUp
'Move the selected entry up in the list.\(The first matching definition is used to determine which repository type is used.)'

#perPackageConfiguration
'Define per-package repository types here.\For any non-matching package-id, the default repository type is used.'

#removePerModuleRoot
'Remove this per-module entry'

#removePerPackageManager
'Remove the selected per-package manager definition'

#sourceCache
'After checkout, keep the sourcefile in a local file (to avoid repeated checkout of the same file)'

#useLocalSources
'If present, use the local source files (from the development system''s tree).\If checkout fails, these will always be tried as second chance.'

#useManager
'Enable source code management.\If off, all queries for sourcecode are resolved by local files (offline operation)'

#verboseSourceCodeAccess
'Output debugging messages on the Transcript\(mostly traces of the underlying scm mechanism, such as cvs commands)'

)

    "Modified: / 14-01-2012 / 20:23:37 / cg"
! !

!MercurialSourceCodeManagementSettingsAppl class methodsFor:'image specs'!

defaultIcon
    ^ self defaultIcon2

    "Created: / 22-12-2011 / 13:47:11 / cg"
!

defaultIcon1
    "This resource specification was automatically generated
     by the ImageEditor of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the ImageEditor may not be able to read the specification."

    "
     self defaultIcon1 inspect
     ImageEditor openOnClass:self andSelector:#defaultIcon1
     Icon flushCachedIcons
    "

    <resource: #image>

    ^Icon
        constantNamed:'CVSSourceCodeManagementSettingsAppl class defaultIcon1'
        ifAbsentPut:[(Depth8Image new) width: 24; height: 24; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
@@@@@@@@@@DB@@@@@@@@@@@@@@@@@@@@@@@@@@LDAPLFA0 I@@@@@@@@@@@@@@@@@@@@@@(KC@0MC <D@@@@@@@@@@@@@@@@@@@CB04LD@DAA@8C@ D@@@@@
@@@@@@@@@@@OC 4HDP(IBAHND0 @@@@@@@@@@@@@@@@EE@PU@@@@APLV@0@@@@@@@@@@@@@@@@LVC!!\E@@@@@@PXA  Y@@@@@@@@@@@@@@PVEA$Z@@@@@@P[
A!!0]@@@@@@@@@@@@@@@EEAXW@@@@APL[G @@@@@@@@@@@@@@@@@SD!!P_DB@JHQ8FD0 @@@@@@@@@@@@@@@@]BRHTF2L$IRX''D0 @@PH@@@@@@@@@@@@@JBD)
J",,KR$!!@0PE@0XGB@$@@@@@@@@@@B8!!F"4-F"D.B ,LC@4NC0P@@@@@@@@@@@@@@A\]@@LKCP0P@PDDC LB@P@@@@@@@@@@@@@@@@<NCP QB $HD 8SB@@@
@@@@@@@@@@@@@@TTAAT@@@@E@1XC@@@@@@@@@@@@@@@@@1XNE0T@@@@@AA FBA$@@@@@@@@@@@@@AAXTFQ(@@@@@AA,FGA4@@@@@@@@@@@@@@@TTE!!\@@@@E
@1,^@@@@@@@@@@@@@@@@@ALREA<PH@(!!G XSB@@@@@@@@@@@@@@@@A4IH!!P[H2P%I"\SB@@@@@@@@@@@@@@@@@@(HR$*J20-JRD@@@@@@@@@@@@@@@@@@@@@
K"DZKR4ZHR8@@@@@@@@@@@@@@@@@@@@@@@@@E14@@@@@@@@@') ; colorMapFromArray:#[0 0 0 160 176 200 176 192 210 176 200 220 192 208 220 224 232 240 176 208 220 208 224 220 144 168 180 192 200 220 208 216 220 208 224 240 224 232 250 224 240 250 208 232 240 160 192 210 176 184 180 128 136 140 192 216 220 160 184 210 208 240 250 144 144 160 192 224 240 160 168 180 192 232 240 160 176 180 224 224 220 192 232 250 144 168 200 176 184 200 160 200 220 192 216 240 176 192 200 160 184 200 192 224 220 176 224 250 176 216 250 160 208 240 144 192 250 144 176 210 255 248 250 160 192 220 144 184 210 160 200 240 160 192 240 128 160 180 128 152 180]; mask:((Depth1Image new) width: 24; height: 24; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@X@@C?@@C?@@O?0@O?0@OG @_C8@_C8@OG @O?0@O?6@G??0C??0@[?<@C?<@C18@G0>@G0>@C18@C?<@C?<@A?0@@?0@@F@') ; yourself); yourself]
!

defaultIcon2
    "This resource specification was automatically generated
     by the ImageEditor of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the ImageEditor may not be able to read the specification."

    "
     self defaultIcon2 inspect
     ImageEditor openOnClass:self andSelector:#defaultIcon2
     Icon flushCachedIcons
    "

    <resource: #image>

    ^Icon
        constantNamed:'CVSSourceCodeManagementSettingsAppl class defaultIcon2'
        ifAbsentPut:[(Depth8Image new) width: 24; height: 24; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
@@@@@@@@@@DB@@@@@@@@@@@@@@@@@@@@@@@@@@LDAPLFA0 I@@@@@@@@@@@@@@@@@@@@@@(KC@0MC <D@@@@@@@@@@@@@@@@@@@CB04LD@DAA@8C@ D@@@@@
@@@@@@@@@@@OC 4HDP(IBAHND0 @@@@@@@@@@@@@@@@EE@PU@@@@APLV@0@@@@@@@@@@@@@@@@LVC!!\E@@@@@@PXA  Y@@@@@@@@@@@@@@PVEA$Z@@@@@@P[
A!!0]@@@@@@@@@@@@@@@EEAXW@@@@APL[G @@@@@@@@@@@@@@@@@SD!!P_DB@JHQ8FD0 @@@@@@@@@@@@@@@@]BRHTF2L$IRX''D0 @@PH@@@@@@@@@@@@@JBD)
J",,KR$!!@0PE@0XGB@$@@@@@@@@@@B83L3@0F"D.B ,LC@4NC0P@@@@@@@@@@C@3L3L3L@LKCP0P@PDDC LB@P@@@@@@K3L3@@@@@C@NCP QB $HD 8SB@@@
@@@@LCD0@@@@@@TTAAT@@@@E@1XC@@@@@C@0L3H3M@@@MQXNE0T@@@@@AA FBA$@@@@0L#L0@@@5MSTTFQ(@@@@@AA,FGA4@@@@@LC$@@CT8NC\5E!!\@@@@E
@1,^@@@@@@@@@@@@MST6MST5EA<PH@(!!G XSB@@@@@@5@@@@@@@5MQ4IH!!P[H2P%I"\SB@@@@@@@MST5MST5@@@(HR$*J20-JRD@@@@@@@@@@CX5MST@@@@@
K"DZKR4ZHR8@@@@@@@@@@@@@@@@@@@@@@@@@E14@@@@@@@@@') ; colorMapFromArray:#[0 0 0 160 176 200 176 192 210 176 200 220 192 208 220 224 232 240 176 208 220 208 224 220 144 168 180 192 200 220 208 216 220 208 224 240 224 232 250 224 240 250 208 232 240 160 192 210 176 184 180 128 136 140 192 216 220 160 184 210 208 240 250 144 144 160 192 224 240 160 168 180 192 232 240 160 176 180 224 224 220 192 232 250 144 168 200 176 184 200 160 200 220 192 216 240 176 192 200 160 184 200 192 224 220 176 224 250 176 216 250 160 208 240 144 192 250 144 176 210 255 248 250 160 192 220 144 184 210 160 200 240 160 192 240 128 160 180 128 152 180 0 64 0 32 96 32 96 192 128 32 128 64 32 160 64 32 128 32 64 64 64 96 96 96 128 128 128 32 32 32 32 64 32]; mask:((Depth1Image new) width: 24; height: 24; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@X@@C?@@C?@@O?0@O?0@OG @_C8@_C8@OG @O?0@O?6@G??0C??0C??<GC?<GC18_''0>OO0>F_18@??<HO?<G=?0C8?0@@F@') ; yourself); yourself]
! !

!MercurialSourceCodeManagementSettingsAppl class methodsFor:'interface specs'!

windowSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:MercurialSourceCodeManagementSettingsAppl andSelector:#windowSpec
     MercurialSourceCodeManagementSettingsAppl new openInterface:#windowSpec
     MercurialSourceCodeManagementSettingsAppl open
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: windowSpec
        window: 
       (WindowSpec
          label: 'Mercurial Settings'
          name: 'Mercurial Settings'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 800 497)
        )
        component: 
       (SpecCollection
          collection: (
           (VerticalPanelViewSpec
              name: 'VerticalPanel3'
              layout: (LayoutFrame 0 0 0 0 0 1 0 1)
              horizontalLayout: fit
              verticalLayout: topSpace
              horizontalSpace: 3
              verticalSpace: 4
              component: 
             (SpecCollection
                collection: (
                 (ViewSpec
                    name: 'ManagerSetupBoxx'
                    component: 
                   (SpecCollection
                      collection: (
                       (FramedBoxSpec
                          label: 'Mercurial Sourcecode Manager Settings'
                          name: 'HGSetupBox'
                          layout: (LayoutFrame 0 0 0 0 0 1 0 1)
                          labelPosition: topLeft
                          translateLabel: true
                          component: 
                         (SpecCollection
                            collection: (
                             (CheckBoxSpec
                                label: 'Show in Browser Menus'
                                name: 'CheckBox1'
                                layout: (LayoutFrame 0 0 5 0 0 1 27 0)
                                activeHelpKey: shownInBrowserMenus
                                model: shownInBrowserMenusHolder
                                translateLabel: true
                              )
                             (ViewSpec
                                name: 'Box1'
                                layout: (LayoutFrame 0 0 35 0 0 1 60 0)
                                component: 
                               (SpecCollection
                                  collection: (
                                   (LabelSpec
                                      label: 'HG Command or Path:'
                                      name: 'Label1'
                                      layout: (LayoutFrame 0 0.0 0 0 60 0.25 22 0)
                                      activeHelpKey: cvsCommand
                                      level: 0
                                      translateLabel: true
                                      adjust: right
                                    )
                                   (InputFieldSpec
                                      name: 'HGExecutableField'
                                      layout: (LayoutFrame 64 0.25 0 0 0 1 22 0)
                                      activeHelpKey: cvsCommand
                                      tabable: true
                                      model: gExecutableHolder
                                      acceptChannel: acceptChannel
                                      acceptOnPointerLeave: true
                                    )
                                   )
                                 
                                )
                              )
                             (ViewSpec
                                name: 'Box12'
                                layout: (LayoutFrame 0 0 61 0 0 1 86 0)
                                component: 
                               (SpecCollection
                                  collection: (
                                   (LabelSpec
                                      label: 'HG Command Timeout:'
                                      name: 'Label2'
                                      layout: (LayoutFrame 0 0.0 0 0 60 0.25 22 0)
                                      activeHelpKey: cvsCommandTimeout
                                      level: 0
                                      translateLabel: true
                                      adjust: right
                                    )
                                   (InputFieldSpec
                                      name: 'EntryField1'
                                      layout: (LayoutFrame 64 0.25 0 0 120 0.25 22 0)
                                      activeHelpKey: cvsCommandTimeout
                                      tabable: true
                                      model: hgCommandTimeoutHolder
                                      type: integerInRange
                                      minValue: 5
                                      maxValue: 3600
                                      acceptChannel: acceptChannel
                                      acceptOnPointerLeave: true
                                    )
                                   )
                                 
                                )
                              )
                             (ViewSpec
                                name: 'Box7'
                                layout: (LayoutFrame 0 0.0 92 0 0 1 117 0)
                                component: 
                               (SpecCollection
                                  collection: (
                                   (LabelSpec
                                      label: 'Default Repository:'
                                      name: 'defaultCvsRootLabel'
                                      layout: (LayoutFrame 0 0.0 2 0 60 0.25 24 0)
                                      activeHelpKey: cvsRootDefault
                                      level: 0
                                      translateLabel: true
                                      adjust: right
                                    )
                                   (ComboBoxSpec
                                      name: 'cvsRootComboBox'
                                      layout: (LayoutFrame 64 0.25 2 0 0 1 24 0)
                                      activeHelpKey: cvsRootDefault
                                      tabable: true
                                      model: hgRepository
                                      immediateAccept: true
                                      acceptOnLeave: true
                                      acceptOnReturn: true
                                      acceptOnTab: true
                                      acceptOnLostFocus: true
                                      acceptChannel: acceptChannel
                                      acceptOnPointerLeave: true
                                      comboList: hgRepositoryPrototypeList
                                    )
                                   )
                                 
                                )
                              )
                             (ActionButtonSpec
                                label: 'Check Access'
                                name: 'Button1'
                                layout: (LayoutFrame -117 1 122 0 0 1 144 0)
                                activeHelpKey: cvsLogin
                                translateLabel: true
                                tabable: true
                                model: checkAccess
                                enableChannel: cvsLoginEnabled
                              )
                             (LabelSpec
                                label: 'Repository per Module:'
                                name: 'knownModulesLabel'
                                layout: (LayoutFrame 0 0.0 150 0 60 0.25 172 0)
                                activeHelpKey: cvsRootPerModule
                                translateLabel: true
                                adjust: right
                              )
                             (SequenceViewSpec
                                name: 'List1'
                                layout: (LayoutFrame 64 0.25 150 0 0 1 269 0)
                                activeHelpKey: cvsRootPerModule
                                tabable: true
                                model: selectedPerModuleRepository
                                hasHorizontalScrollBar: true
                                hasVerticalScrollBar: true
                                miniScrollerHorizontal: true
                                useIndex: false
                                sequenceList: listOfModules
                              )
                             (LabelSpec
                                label: 'Module:'
                                name: 'moduleLabel'
                                layout: (LayoutFrame 0 0.0 279 0 60 0.25 296 0)
                                activeHelpKey: cvsRootPerModuleModule
                                translateLabel: true
                                adjust: right
                              )
                             (InputFieldSpec
                                name: 'perModuleRepositoryModuleEntryField'
                                layout: (LayoutFrame 64 0.25 275 0 0 1 297 0)
                                activeHelpKey: cvsRootPerModuleModule
                                tabable: true
                                model: perModuleRepositoryModule
                                acceptChannel: acceptChannel
                                acceptOnPointerLeave: true
                              )
                             (LabelSpec
                                label: 'Mercurial Repository:'
                                name: 'hgRepository'
                                layout: (LayoutFrame 0 0.0 304 0 60 0.25 321 0)
                                activeHelpKey: cvsRootPerModuleRoot
                                translateLabel: true
                                adjust: right
                              )
                             (ComboBoxSpec
                                name: 'perModuleRepositoryComboBox'
                                layout: (LayoutFrame 64 0.25 300 0 0 1.0 322 0)
                                activeHelpKey: cvsRootPerModuleRoot
                                tabable: true
                                model: perModuleRoot
                                immediateAccept: true
                                acceptOnLeave: true
                                acceptOnReturn: true
                                acceptOnTab: true
                                acceptOnLostFocus: true
                                acceptChannel: acceptChannel
                                acceptOnPointerLeave: true
                                comboList: hgRepositoryPrototypeList
                              )
                             (HorizontalPanelViewSpec
                                name: 'HorizontalPanel2'
                                layout: (LayoutFrame 64 0.25 327 0 -1 1 352 0)
                                horizontalLayout: fitSpace
                                verticalLayout: center
                                horizontalSpace: 3
                                verticalSpace: 3
                                component: 
                               (SpecCollection
                                  collection: (
                                   (ActionButtonSpec
                                      label: 'Add/Apply'
                                      name: 'addButton'
                                      activeHelpKey: addPerModuleRoot
                                      translateLabel: true
                                      tabable: true
                                      model: addPerModuleRoot
                                      extent: (Point 123 22)
                                    )
                                   (ActionButtonSpec
                                      label: 'Remove'
                                      name: 'removeButton'
                                      activeHelpKey: removePerModuleRoot
                                      translateLabel: true
                                      tabable: true
                                      model: removePerModuleRoot
                                      enableChannel: removeEnabled
                                      extent: (Point 124 22)
                                    )
                                   (ViewSpec
                                      name: 'Box11'
                                      extent: (Point 124 10)
                                    )
                                   (ActionButtonSpec
                                      label: 'Check Access'
                                      name: 'checkButton2'
                                      activeHelpKey: loginPerModuleRoot
                                      translateLabel: true
                                      tabable: true
                                      model: checkAccessPerModuleRepository
                                      enableChannel: cvsLoginInModuleEnabled
                                      extent: (Point 124 22)
                                    )
                                   )
                                 
                                )
                              )
                             )
                           
                          )
                        )
                       )
                     
                    )
                    extent: (Point 800 389)
                  )
                 (FramedBoxSpec
                    label: 'Source Cache'
                    name: 'FramedBox1'
                    visibilityChannel: false
                    labelPosition: topLeft
                    translateLabel: true
                    component: 
                   (SpecCollection
                      collection: (
                       (ViewSpec
                          name: 'SourceCacheDirBox'
                          layout: (LayoutFrame 0 0 0 0 0 1 30 0)
                          component: 
                         (SpecCollection
                            collection: (
                             (LabelSpec
                                label: 'Source Cache Dir:'
                                name: 'SourceCacheDirLabel'
                                layout: (LayoutFrame 0 0.0 0 0 60 0.25 22 0)
                                translateLabel: true
                                adjust: right
                              )
                             (InputFieldSpec
                                name: 'SourceCacheDirEntryField'
                                layout: (LayoutFrame 64 0.25 0 0 0 1 22 0)
                                model: sourceCacheDir
                                immediateAccept: false
                                acceptOnReturn: true
                                acceptOnTab: true
                                acceptOnLostFocus: true
                                acceptOnPointerLeave: true
                              )
                             )
                           
                          )
                        )
                       (HorizontalPanelViewSpec
                          name: 'CacheActionsHorizontalPanel'
                          layout: (LayoutFrame 44 0.25 33 0 0 1 67 0)
                          horizontalLayout: fitSpace
                          verticalLayout: center
                          horizontalSpace: 3
                          verticalSpace: 3
                          component: 
                         (SpecCollection
                            collection: (
                             (ActionButtonSpec
                                label: 'Flush Cache now'
                                name: 'FlushCacheNowButton'
                                translateLabel: true
                                tabable: true
                                model: flushSourceCache
                                extent: (Point 261 22)
                              )
                             (ActionButtonSpec
                                label: 'Condense Cache now'
                                name: 'CondenseCacheNowButton'
                                translateLabel: true
                                tabable: true
                                model: condenseSourceCache
                                extent: (Point 261 22)
                              )
                             )
                           
                          )
                        )
                       )
                     
                    )
                    extent: (Point 800 95)
                  )
                 )
               
              )
            )
           )
         
        )
      )
! !

!MercurialSourceCodeManagementSettingsAppl class methodsFor:'queries'!

managerClass
    "backlink to my manager class (needed by the settings app)"

    ^ MercurialSourceCodeManager

    "Created: / 19-04-2011 / 12:46:52 / cg"
! !

!MercurialSourceCodeManagementSettingsAppl methodsFor:'actions'!

addModule:module withData:data
    (self listOfModules includes:module) ifFalse:[
        self listOfModules add:module; sort.
    ].
    repositoriesPerModule at:module put:data.

    self updateModifiedChannel.

    "Created: / 08-11-2006 / 19:25:21 / cg"
!

basicReadSettings
    |infoPerModule|

    self initialize.

    self sourceCacheDir value:(MercurialSourceCodeManager cacheDirectoryName).

    repository := MercurialSourceCodeManager repositoryName.
    repositoryHolder := (repository ? '') asValue.

    infoPerModule := MercurialSourceCodeManager repositoryInfoPerModule.
    infoPerModule keysAndValuesDo:[:module :info | 
        repositoriesPerModule at:module put:(Array with:MercurialSourceCodeManager with:info).
    ].

    self repositoryHolder value:MercurialSourceCodeManager repositoryName ? self class defaultRepositoryName.
    self hgExecutableHolder value:MercurialSourceCodeManager hgExecutable.
    self hgCommandTimeoutHolder value:MercurialSourceCodeManager hgCommandTimeout.
    self verboseSourceCodeAccess value:MercurialSourceCodeManager verboseSourceCodeAccess. 
    self shownInBrowserMenusHolder value:MercurialSourceCodeManager shownInBrowserMenus. 

    repositoriesPerModule notNil ifTrue:[
        self listOfModules removeAll.
        listOfModules addAll:repositoriesPerModule keys asList.
    ].
"/    self selectedPerModuleRootChanged.

    "Modified: / 14-01-2012 / 19:57:13 / cg"
!

basicSaveSettings
    |modules nm fn infoPerModule|

    nm := self sourceCacheDir value.
    nm notEmptyOrNil ifTrue:[
        (fn := nm asFilename) exists ifFalse:[
            (self confirm:('Mercurial cache directory ''' , nm , ''' does not exist\create ?' withCRs)) ifTrue:[
                fn recursiveMakeDirectory; 
                   makeReadableForAll;
                   makeWritableForAll;
                   makeExecutableForAll.
            ]
        ].
        (fn isDirectory
        and:[fn isReadable
        and:[fn isWritable]]) ifTrue:[
            MercurialSourceCodeManager cacheDirectoryName:nm.
        ] ifFalse:[
            self warn:'Invalid sourceCache directory.'
        ]
    ].

    MercurialSourceCodeManager hgCommandTimeout:(self hgCommandTimeoutHolder value).

    modules := repositoriesPerModule select:[:entry | entry first == MercurialSourceCodeManager].
    infoPerModule := Dictionary new.
    modules keysAndValuesDo:[:module :entry | 
        entry first == MercurialSourceCodeManager ifTrue:[
            infoPerModule at:module put:(entry second).
        ].
    ].
    MercurialSourceCodeManager repositoryInfoPerModule:infoPerModule.

    self basicSaveMercurialSettings.

    self sourceCacheDir value:(AbstractSourceCodeManager cacheDirectoryName).

    DebugView newDebugger. "/ ???

    self acceptChannel value.

    "Modified: / 14-01-2012 / 19:58:46 / cg"
!

removePerModuleRoot
    |module|

    acceptChannel value:true.    
    module := self perModuleRootModule value.
    self listOfModules remove:module ifAbsent:nil.
    repositoriesPerModule removeKey:module ifAbsent:nil.
    self perModuleRootModule value:nil.
    self perModuleRoot value:nil.
    self updateModifiedChannel.

    "Modified: / 14-01-2012 / 19:59:23 / cg"
! !

!MercurialSourceCodeManagementSettingsAppl methodsFor:'actions - mercurial'!

addPerModuleRoot
    |module cvsRoot|

    acceptChannel value:true.    

    module := self perModuleRootModule value.
    cvsRoot := self perModuleRoot value.

    cvsRoot size > 0 ifTrue:[
        self addModule:module withData:(Array with:MercurialSourceCodeManager with:cvsRoot).
    ].

    "Modified: / 14-01-2012 / 19:59:50 / cg"
!

basicSaveMercurialSettings
    |hgRepository|

    repositoryHolder notNil ifTrue:[
        repositoryHolder value size > 0 ifTrue:[
            manager notNil ifTrue:[
                manager initializeForRepository:repositoryHolder value.
            ]
        ].
    ].
    MercurialSourceCodeManager hgExecutable:((self hgExecutableHolder value ? '') withoutSeparators).
    MercurialSourceCodeManager initializeForRepository:(hgRepository := self repositoryHolder value).
    MercurialSourceCodeManager verboseSourceCodeAccess: verboseSourceCodeAccess value. 
    MercurialSourceCodeManager shownInBrowserMenus:self shownInBrowserMenusHolder value. 

    RecentlyUsedRepositoryURLS isNil ifTrue:[
        RecentlyUsedRepositoryURLS := OrderedCollection new.
    ].
    (RecentlyUsedRepositoryURLS includes:hgRepository) ifFalse:[
        RecentlyUsedRepositoryURLS addFirst:hgRepository.
        RecentlyUsedRepositoryURLS size > 20 ifTrue:[
            RecentlyUsedRepositoryURLS removeLast.
        ].
    ].

    "Modified: / 10-01-2012 / 00:18:15 / cg"
    "Created: / 14-01-2012 / 20:01:47 / cg"
! !

!MercurialSourceCodeManagementSettingsAppl methodsFor:'aspects'!

hgCommandTimeoutHolder
    hgCommandTimeoutHolder isNil ifTrue:[
        hgCommandTimeoutHolder := ValueHolder new.
        hgCommandTimeoutHolder onChangeSend:#updateModifiedChannel to:self
    ].
    ^ hgCommandTimeoutHolder.

    "Created: / 14-01-2012 / 20:02:13 / cg"
!

hgExecutableHolder
    hgExecutableHolder isNil ifTrue:[
        hgExecutableHolder := ValueHolder new.
        hgExecutableHolder onChangeSend:#updateModifiedChannel to:self
    ].
    ^ hgExecutableHolder.

    "Created: / 14-01-2012 / 20:02:22 / cg"
!

listOfModules

    listOfModules isNil ifTrue:[
        repositoriesPerModule notNil ifTrue:[
            listOfModules := repositoriesPerModule keys asList.
        ].
        listOfModules sort.
        listOfModules onChangeSend:#updateModifiedChannel to:self
    ].
    ^ listOfModules.

    "Modified: / 14-01-2012 / 20:18:34 / cg"
!

perModuleRepository
    perModuleRepository isNil ifTrue:[
        perModuleRepository := ValueHolder new.
        perModuleRepository addDependent:self.
    ].
    ^ perModuleRepository.

    "Created: / 14-01-2012 / 20:18:59 / cg"
!

perModuleRepositoryModule
    perModuleRepositoryModule isNil ifTrue:[
        perModuleRepositoryModule := ValueHolder new.
    ].
    ^ perModuleRepositoryModule.

    "Created: / 14-01-2012 / 20:19:51 / cg"
!

removeEnabled

    removeEnabled isNil ifTrue:[
        removeEnabled := false asValue.
    ].
    ^ removeEnabled.
!

repositoryHolder

    repositoryHolder isNil ifTrue:[
        repositoryHolder := '' asValue.
        repositoryHolder addDependent:self.
    ].
    ^ repositoryHolder.

    "Created: / 14-01-2012 / 20:03:00 / cg"
!

repositoryPrototypeList
    |prototypeList|

    repositoryPrototypeList isNil ifTrue:[
        prototypeList := OrderedSet new.

"/        cvsRoot := self cvsRootFromCVSRootFileOrNil.
"/        cvsRoot notNil ifTrue:[
"/            prototypeList add:cvsRoot    
"/        ].

        prototypeList add:('https://inst.kilnhg.com/Repo/Foo/Bar/Baz').
        "/ prototypeList add:('https://inst.kilnhg.com/Repo/Dino-VM/Group/Dino-VM').
        repositoryPrototypeList := prototypeList asOrderedCollection.
    ].
    ^ repositoryPrototypeList.

    "Created: / 14-01-2012 / 20:13:43 / cg"
!

selectedPerModuleRepository
    selectedPerModuleRepository isNil ifTrue:[
        selectedPerModuleRepository := ValueHolder new.
        selectedPerModuleRepository addDependent:self.
    ].
    ^ selectedPerModuleRepository.

    "Created: / 14-01-2012 / 20:14:04 / cg"
!

verboseSourceCodeAccess
    verboseSourceCodeAccess isNil ifTrue:[
        verboseSourceCodeAccess := false asValue.
        verboseSourceCodeAccess onChangeSend:#updateModifiedChannel to:self
    ].
    ^ verboseSourceCodeAccess.
! !

!MercurialSourceCodeManagementSettingsAppl methodsFor:'change & update'!

selectedPerModuleRepositoryChanged
    |module entry|

    self acceptChannel value:true.    
    module := self selectedPerModuleRoot value.
    module isNil ifTrue:[ 
        self removeEnabled value:false.
        self perModuleRepositoryModule value:' '.
        self perModuleRoot value:''.
        ^ self
    ].

    entry := repositoriesPerModule at:module ifAbsent:#().    
    (entry first = MercurialSourceCodeManager) ifTrue:[
        self removeEnabled value:true.
        self perModuleRepositoryModule value:module.
        self perModuleRoot value:(entry at:2).
    ] ifFalse:[
        self removeEnabled value:false.
        self perModuleRepositoryModule value:module , ' ',('<<use ',entry first managerTypeName,'>>') allBold.
        self perModuleRoot value:''.
    ].

    "Created: / 14-01-2012 / 20:24:57 / cg"
!

sourceDirChanged
    |nm fn previousDir|

    manager isNil ifTrue:[^ self].

    previousDir := AbstractSourceCodeManager cacheDirectoryName.

    nm := self sourceCacheDir value.
    nm isEmptyOrNil ifTrue:[^ self].

    (fn := nm asFilename) exists ifFalse:[
        (self confirm:(resources 
                            stringWithCRs:'SourceCache directory "%1" does not exist.\Create ?'
                            with:nm)
        ) ifFalse:[
            self sourceCacheDir value:previousDir.
            ^ self.
        ].
        fn 
            recursiveMakeDirectory; 
            makeReadableForAll;
            makeWritableForAll;
            makeExecutableForAll.
        ^ self.
    ].

    (fn isDirectory) ifFalse:[
        self warn:(resources 
                            stringWithCRs:'Not a directory: "%1"'
                            with:nm).
        self sourceCacheDir value:previousDir.
        ^ self.
    ].

    (fn isReadable and:[fn isWritable]) ifFalse:[
        (self confirm:(resources 
                            stringWithCRs:'SourceCache directory "%1" is not both readable and writable.\Change ?'
                            with:nm)
        ) ifFalse:[
            self sourceCacheDir value:previousDir.
            ^ self.
        ].
        fn
            makeReadableForAll;
            makeWritableForAll;
            makeExecutableForAll.
    ].
"/    (fn isReadableForAll and:[fn isWritableForAll]) ifFalse:[
"/        (self confirm:(resources 
"/                            stringWithCRs:'SourceCache directory "%1" is not both readable and writable for other users.\Change ?'
"/                            with:nm)
"/        ) ifTrue:[
"/            fn
"/                makeReadableForAll;
"/                makeWritableForAll;
"/                makeExecutableForAll.
"/        ]
"/    ].
!

update:something with:aParameter from:changedObject 
    "/ common    
    changedObject == sourceCacheDir ifTrue:[
        self sourceDirChanged.
        self updateModifiedChannel.
        ^ self
    ].

    "/ cvs
    changedObject == repositoryHolder ifTrue:[
        self updateModifiedChannel.
        "/ self updateLoginEnableHolders.
        ^ self
    ].
"/    changedObject == perModuleRepository ifTrue:[
"/        self updateLoginEnableHolders.
"/        ^ self
"/    ].
    changedObject == selectedPerModuleRepository ifTrue:[
        self selectedPerModuleRepositoryChanged.
        ^ self
    ].

    super update:something with:aParameter from:changedObject

    "Modified: / 14-01-2012 / 20:26:51 / cg"
! !

!MercurialSourceCodeManagementSettingsAppl methodsFor:'help'!

helpFilename
    ^ 'Launcher/mercurialSetup.html'

    "Modified: / 14-01-2012 / 20:27:00 / cg"
! !

!MercurialSourceCodeManagementSettingsAppl methodsFor:'initialization & release'!

initialize
    (AbstractSourceCodeManager notNil) ifTrue:[ AbstractSourceCodeManager autoload ].

    sourceCacheDir := nil asValue.
    sourceCacheDir addDependent:self.

    repositoryHolder := '' asValue.
    repositoriesPerModule := Dictionary new.

    MercurialSourceCodeManager repositoryInfoPerModule 
        keysAndValuesDo:[:module :info |
            module withoutSeparators ~= module ifTrue:[
                self halt:'should not happen any longer'
            ].
            repositoriesPerModule at:module put:(Array with:MercurialSourceCodeManager with:info)
        ].

    super initialize.

    "Modified: / 14-01-2012 / 20:27:37 / cg"
! !

!MercurialSourceCodeManagementSettingsAppl methodsFor:'queries'!

hasUnsavedChanges
    |modules|

    ((MercurialSourceCodeManager cacheDirectoryName ? '') ~= (self sourceCacheDir value ? '')) ifTrue:[^ true].

    modules := repositoriesPerModule select:[:entry | entry first == MercurialSourceCodeManager].

    CVSSourceCodeManager repositoryInfoPerModule keysAndValuesDo:[:module :info |
        ((modules includesKey:module) and:[info = (modules at:module) second])
        ifFalse:[^ true].
    ].
    modules keysAndValuesDo:[:module :info|
        ((MercurialSourceCodeManager repositoryInfoPerModule includesKey:module) 
            and:[(MercurialSourceCodeManager repositoryInfoPerModule at:module) = info second])
        ifFalse:[^ true].
    ].
    (MercurialSourceCodeManager hgCommandTimeout ~= hgCommandTimeoutHolder value)
        ifTrue:[^ true].

    ((MercurialSourceCodeManager hgExecutable ? '') ~= (self hgExecutableHolder value ? '') withoutSeparators)  
        ifTrue:[^ true].

    (MercurialSourceCodeManager repositoryName ? self class defaultRepositoryName ~= self repositoryHolder value)    
        ifTrue:[^ true].

    (MercurialSourceCodeManager verboseSourceCodeAccess ~= self verboseSourceCodeAccess value) 
        ifTrue:[^ true].

    (MercurialSourceCodeManager shownInBrowserMenus ~= self shownInBrowserMenusHolder value)
        ifTrue:[^ true].

    ^ false

    "Modified: / 14-01-2012 / 20:30:19 / cg"
! !

!MercurialSourceCodeManagementSettingsAppl class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libtool/MercurialSourceCodeManagementSettingsAppl.st,v 1.1 2012-01-14 20:22:15 cg Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/libtool/MercurialSourceCodeManagementSettingsAppl.st,v 1.1 2012-01-14 20:22:15 cg Exp $'
! !