mercurial/HGCommitTask.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 10 Dec 2012 02:49:43 +0000
changeset 151 527a1e85aef8
parent 146 1015b8f6dc1c
child 152 9068fe7a5795
permissions -rw-r--r--
Support for 'autopush' in commit dialog. When committing, changes can be automatically propagated to an upstream repository (autopush). Also, global preference exists to turn on/off default behavior. When global autopush is on, then commit behaves much like in centralized SCMs - each commit is immediately visible to other developers. However, autopush is off by default.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     1
"{ Package: 'stx:libscm/mercurial' }"
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     2
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     3
SCMAbstractCommitTask subclass:#HGCommitTask
151
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
     4
	instanceVariableNames:'author remote'
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     5
	classVariableNames:''
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     6
	poolDictionaries:''
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     7
	category:'SCM-Mercurial-StX-Tasks'
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     8
!
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     9
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    10
146
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    11
!HGCommitTask methodsFor:'accessing'!
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    12
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    13
author
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    14
    ^author isNil ifTrue:[
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    15
        | a |     
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    16
        a := HGAuthorQuery query.
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    17
        a isNil ifTrue:[
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    18
            a := package repository config get:#(ui username) default: nil
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    19
        ].
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    20
        a
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    21
    ] ifFalse:[
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    22
        author
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    23
    ]
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    24
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    25
    "Modified: / 07-12-2012 / 16:17:02 / jv"
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    26
!
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    27
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    28
author:aString
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    29
    author := aString.
151
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
    30
!
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
    31
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
    32
remote
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
    33
    ^ remote
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
    34
!
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
    35
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
    36
remote:something
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
    37
    remote := something.
146
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    38
! !
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    39
61
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    40
!HGCommitTask methodsFor:'executing'!
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    41
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    42
doCommit: msg files: containers
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    43
    "Actually commit the changes, To be overridden by subclasses"
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    44
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    45
    self synchronized:[    
151
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
    46
        | wc |
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
    47
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
    48
        wc := self package temporaryWorkingCopy.
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
    49
        wc commit: msg files: containers author: self author.
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
    50
        wc repository push: nil force: true.
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
    51
        remote notNil ifTrue:[
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
    52
            self package repository push: remote force: false.
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
    53
        ]
61
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    54
    ].
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    55
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    56
    "Created: / 15-11-2012 / 16:52:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
146
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    57
    "Modified: / 07-12-2012 / 16:13:16 / jv"
151
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
    58
    "Modified: / 10-12-2012 / 01:44:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
111
6439af30a24b Fix in temporary working copy update.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
    59
!
6439af30a24b Fix in temporary working copy update.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
    60
6439af30a24b Fix in temporary working copy update.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
    61
doPrepareWorkingCopy2
6439af30a24b Fix in temporary working copy update.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
    62
6439af30a24b Fix in temporary working copy update.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
    63
    self isPackageCommit ifTrue:[
6439af30a24b Fix in temporary working copy update.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
    64
        self do:[
118
5a8b78ad48ae Refactoring (part 2): Rename SCMAbstractPackageModel>>workingCopy to temporaryWorkingCopy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 115
diff changeset
    65
            self package ensureTemporaryWorkingCopyAtRevision:self package revision.
111
6439af30a24b Fix in temporary working copy update.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
    66
            self doFileOut
6439af30a24b Fix in temporary working copy update.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
    67
        ]
6439af30a24b Fix in temporary working copy update.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
    68
    ].
6439af30a24b Fix in temporary working copy update.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
    69
6439af30a24b Fix in temporary working copy update.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
    70
    "Created: / 28-11-2012 / 09:42:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
61
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    71
! !
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    72
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    73
!HGCommitTask class methodsFor:'documentation'!
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    74
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    75
version_HG
115
b1ed2d29054b version_HG changed to return string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
    76
b1ed2d29054b version_HG changed to return string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
    77
    ^ '$Changeset: <not expanded> $'
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    78
!
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    79
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    80
version_SVN
61
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    81
    ^ '§Id::                                                                                                                        §'
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    82
! !