mercurial/HGCommitDialog.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sat, 01 Dec 2012 01:00:13 +0000
changeset 118 5a8b78ad48ae
parent 115 b1ed2d29054b
child 142 67e8c5ab8db2
permissions -rw-r--r--
Refactoring (part 2): Rename SCMAbstractPackageModel>>workingCopy to temporaryWorkingCopy

"{ 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 temporaryWorkingCopyRoot.
    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: / 01-12-2012 / 00:48:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!HGCommitDialog methodsFor:'private'!

doUpdateWorkingCopy
    | heads changeset |

    super doUpdateWorkingCopy.
    heads := self task package temporaryWorkingCopy heads.
    changeset := self task package temporaryWorkingCopy 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>"
    "Modified: / 01-12-2012 / 00:49:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!HGCommitDialog class methodsFor:'documentation'!

version_HG

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

version_SVN
    ^ '§Id::                                                                                                                        §'
! !