mercurial/HGCommitDialog.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 30 Nov 2012 21:42:46 +0000
changeset 115 b1ed2d29054b
parent 109 08c6eca6df25
child 118 5a8b78ad48ae
permissions -rw-r--r--
version_HG changed to return string. Bu default, there is no real changeset id in the string (unless KeywordsExtension is enabled). However, there is no need for stc itself now embeds changeset id into binary revision.

"{ Package: 'stx:libscm/mercurial' }"

SCMAbstractCommitDialog subclass:#HGCommitDialog
	instanceVariableNames:'defaultLogo'
	classVariableNames:''
	poolDictionaries:''
	category:'SCM-Mercurial-StX-Interface'
!


!HGCommitDialog class methodsFor:'image specs'!

dialogIcon
    ^ HGIconLibrary hgLogo2

    "Created: / 14-11-2012 / 00:14:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 16-11-2012 / 11:01:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!HGCommitDialog class methodsFor:'interface specs'!

fileListColumnSpec
    "This resource specification was automatically generated
     by the DataSetBuilder of ST/X."

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

    "
     DataSetBuilder new openOnClass:SVN::CommitDialog2 andSelector:#fileListColumnSpec
    "

    <resource: #tableColumns>

    ^#(
      (DataSetColumnSpec
         label: ''
         activeHelpKey: ''
         activeHelpKeyForLabel: ''
         labelButtonType: None
         width: 22
         minWidth: 22
         editorType: CheckToggle
         rendererType: CheckToggle
         model: include
         menuFromApplication: false
         printSelector: include
         showRowSeparator: false
         showColSeparator: false
       )
      (DataSetColumnSpec
         label: ''
         activeHelpKey: ''
         activeHelpKeyForLabel: ''
         labelButtonType: Button
         width: 22
         minWidth: 22
         menuFromApplication: false
         printSelector: statusIcon
         canSelect: false
         showRowSeparator: false
         showColSeparator: false
       )
      (DataSetColumnSpec
         label: 'Container'
         labelAlignment: left
         activeHelpKey: ''
         activeHelpKeyForLabel: ''
         labelButtonType: Button
         menuFromApplication: false
         printSelector: pathText
         canSelect: false
         showRowSeparator: false
         showColSeparator: false
       )
    "
      (DataSetColumnSpec
         label: 'Rev'
         activeHelpKey: ''
         activeHelpKeyForLabel: ''
         labelButtonType: Button
         usePreferredWidth: true
         menuFromApplication: false
         printSelector: revision
         canSelect: false
         showRowSeparator: false
         showColSeparator: false
       )
      (DataSetColumnSpec
         label: 'Author'
         labelAlignment: left
         activeHelpKey: ''
         activeHelpKeyForLabel: ''
         labelButtonType: Button
         usePreferredWidth: true
         menuFromApplication: false
         printSelector: author
         canSelect: false
         showRowSeparator: false
         showColSeparator: false
       )
      (DataSetColumnSpec
         label: 'Date'
         activeHelpKey: ''
         activeHelpKeyForLabel: ''
         labelButtonType: Button
         usePreferredWidth: true
         menuFromApplication: false
         printSelector: date
         canSelect: false
         showRowSeparator: false
         showColSeparator: false
       )
        "
      )

    "Created: / 15-11-2012 / 09:28:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!HGCommitDialog methodsFor:'change & update'!

updateFileList
    | wcroot statuses entries showOnlyModified wcrootPathNameRelative wcrootPathNameRelativeLen |

    showOnlyModified := fileListShowOnlyModifiedHolder value.
    "HACK..."

    wcroot := self model package root.
    wcrootPathNameRelative := wcroot pathNameRelative.
    wcrootPathNameRelativeLen := wcrootPathNameRelative size.

    statuses := HGCommand status
                    workingDirectory: wcroot pathName;
                    execute.
    entries := OrderedCollection new: statuses size.
    statuses do:[:statusAndPath|
        (fileListShowOnlyModifiedHolder value not
            or:[statusAndPath first isCleanOrIgnored not]) ifTrue:[
            | nm entry |

            (statusAndPath second startsWith: wcrootPathNameRelative) ifTrue:[
                nm := statusAndPath second.
                wcrootPathNameRelativeLen ~~ 0 ifTrue:[
                    nm := nm copyFrom:wcrootPathNameRelativeLen + 2.
                ].
                entry := SCMAbstractCommitDialog::FileEntry application: self entry: wcroot / nm name: nm.
                entries add: entry
            ].
        ].
    ].
    self fileListHolder value: entries

    "Created: / 08-02-2012 / 18:05:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 16-11-2012 / 11:27:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!HGCommitDialog methodsFor:'private'!

doUpdateWorkingCopy
    | heads changeset |

    super doUpdateWorkingCopy.
    heads := self task package workingCopy heads.
    changeset := self task package workingCopy changeset.
    (heads includes: changeset) ifFalse:[
        self infoPanel 
            reset;
            beInformation;
            message: (self resources string:'Comitting a new head.');
            addButtonWithLabel: (self resources string:'Proceed') action: [self infoPanel hide];
            addButtonWithLabel: (self resources string:'Cancel') action:[self doCancel];
            show.
    ]

    "Created: / 27-11-2012 / 23:36:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!HGCommitDialog class methodsFor:'documentation'!

version_HG

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

version_SVN
    ^ '§Id::                                                                                                                        §'
! !