mercurial/HGCommitTask.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 18 Feb 2014 14:25:20 +0000
changeset 375 6ecd3ade39be
parent 353 456532e0478c
child 381 3dde2b867931
permissions -rw-r--r--
More sanity check in HG settings dialog. When an config error is detected (now only missing username entry), user choose to edit config file and ~/.hgrc does not exists, it is created from template (see HGConfig userConfigFileTemplate)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
210
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 158
diff changeset
     1
"
335
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
     2
stx:libscm - a new source code management library for Smalltalk/X
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
     3
Copyright (C) 2012-2013 Jan Vrany
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
     4
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
     5
This library is free software; you can redistribute it and/or
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
     6
modify it under the terms of the GNU Lesser General Public
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
     7
License as published by the Free Software Foundation; either
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
     8
version 2.1 of the License. 
210
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 158
diff changeset
     9
335
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    10
This library is distributed in the hope that it will be useful,
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    11
but WITHOUT ANY WARRANTY; without even the implied warranty of
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    13
Lesser General Public License for more details.
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    14
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    15
You should have received a copy of the GNU Lesser General Public
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    16
License along with this library; if not, write to the Free Software
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
210
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 158
diff changeset
    18
"
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    19
"{ 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
    20
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    21
SCMAbstractCommitTask subclass:#HGCommitTask
152
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
    22
	instanceVariableNames:'author remote branch'
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    23
	classVariableNames:''
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    24
	poolDictionaries:''
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    25
	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
    26
!
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    27
210
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 158
diff changeset
    28
!HGCommitTask class methodsFor:'documentation'!
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 158
diff changeset
    29
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 158
diff changeset
    30
copyright
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 158
diff changeset
    31
"
335
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    32
stx:libscm - a new source code management library for Smalltalk/X
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    33
Copyright (C) 2012-2013 Jan Vrany
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    34
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    35
This library is free software; you can redistribute it and/or
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    36
modify it under the terms of the GNU Lesser General Public
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    37
License as published by the Free Software Foundation; either
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    38
version 2.1 of the License. 
210
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 158
diff changeset
    39
335
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    40
This library is distributed in the hope that it will be useful,
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    41
but WITHOUT ANY WARRANTY; without even the implied warranty of
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    42
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    43
Lesser General Public License for more details.
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    44
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    45
You should have received a copy of the GNU Lesser General Public
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    46
License along with this library; if not, write to the Free Software
7e19ab19148b Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 288
diff changeset
    47
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
210
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 158
diff changeset
    48
"
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 158
diff changeset
    49
! !
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    50
146
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    51
!HGCommitTask methodsFor:'accessing'!
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    52
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    53
author
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    54
    ^author isNil ifTrue:[
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    55
        | a |     
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    56
        a := HGAuthorQuery query.
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    57
        a isNil ifTrue:[
375
6ecd3ade39be More sanity check in HG settings dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 353
diff changeset
    58
            a := temporaryWorkingCopy repository config ui_username.
146
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    59
        ].
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    60
        a
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    61
    ] ifFalse:[
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    62
        author
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    63
    ]
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    64
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    65
    "Modified: / 07-12-2012 / 16:17:02 / jv"
375
6ecd3ade39be More sanity check in HG settings dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 353
diff changeset
    66
    "Modified: / 18-02-2014 / 11:33:11 / 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
    67
!
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    68
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    69
author:aString
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
    70
    author := aString.
151
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
    71
!
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
    72
152
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
    73
branch
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
    74
    ^ branch
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
    75
!
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
    76
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
    77
branch:aString
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
    78
    branch := aString.
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
    79
!
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
    80
282
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
    81
message
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
    82
    (message isNil and:[self isMergeCommit]) ifTrue:[
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
    83
        message := String streamContents:[:s|
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
    84
            | parent2 |    
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
    85
            s nextPutAll: 'Merged '.
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
    86
            s nextPutAll: temporaryWorkingCopy parent1Id printStringWithoutNumber.
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
    87
            s nextPutAll: ' and '.
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
    88
            s nextPutAll: temporaryWorkingCopy parent2Id printStringWithoutNumber.
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
    89
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
    90
            parent2 := temporaryWorkingCopy parent2.
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
    91
            (parent2 branches includes: temporaryWorkingCopy branch) ifFalse:[
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
    92
                parent2 branches size == 1 ifTrue:[
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
    93
                    s nextPutAll: ' (branch '.
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
    94
                    s nextPutAll: parent2 branches anElement name.
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
    95
                    s nextPutAll: ')'
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
    96
                ]
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
    97
            ]
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
    98
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
    99
        ].
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   100
        ^message.
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   101
    ].
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   102
    ^super message.
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   103
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   104
    "Created: / 01-04-2013 / 13:53:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   105
!
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   106
151
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
   107
remote
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
   108
    ^ remote
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
   109
!
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
   110
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
   111
remote:something
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
   112
    remote := something.
146
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
   113
! !
1015b8f6dc1c Added check for author signature before commit.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 118
diff changeset
   114
61
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   115
!HGCommitTask methodsFor:'executing'!
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   116
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   117
doCommit: msg files: containers
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   118
    "Actually commit the changes, To be overridden by subclasses"
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   119
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   120
    self synchronized:[    
153
442c60f78aec Bugfix HGCommitTask>>doCommit:files: - allow commit into same branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
   121
        | wc createBranch |
151
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 146
diff changeset
   122
282
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   123
        wc := temporaryWorkingCopy.
153
442c60f78aec Bugfix HGCommitTask>>doCommit:files: - allow commit into same branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
   124
        createBranch := branch notNil and:[branch ~= wc branch name].
442c60f78aec Bugfix HGCommitTask>>doCommit:files: - allow commit into same branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
   125
442c60f78aec Bugfix HGCommitTask>>doCommit:files: - allow commit into same branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
   126
        createBranch ifTrue:[
152
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
   127
            (self package repository branches contains:[:b|b name = branch]) ifTrue:[
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
   128
                HGCommitError raiseErrorString: 'Commiting to an existing branch is not allowed'.
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
   129
                ^self.
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
   130
            ].
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
   131
            wc branch: branch.
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
   132
        ].
282
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   133
        "/Cannot commit only some files after merge, in that case, commit everything"
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   134
        self isMergeCommit ifTrue:[
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   135
            wc commit: msg files: nil author: self author.
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   136
        ] ifFalse:[
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   137
            wc commit: msg files: containers author: self author.
152
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
   138
        ].
282
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   139
        self isPackageCommit ifTrue:[
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   140
            wc repository push: nil force: true.
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   141
            remote notNil ifTrue:[
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   142
                self package repository push: remote name force: false.
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   143
            ]. 
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   144
            "/Also, mark original (package) working copy as given branch
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   145
            "/so subsequent 'hg update' will update from that branch
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   146
            createBranch ifTrue:[
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   147
                self package repository workingCopy branch: branch.
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   148
            ].
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   149
        ]
61
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   150
    ].
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   151
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   152
    "Created: / 15-11-2012 / 16:52:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
158
591092ed5641 Bugfix in HGCommitTask>>doCommit:files: (pass remote name as string)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 156
diff changeset
   153
    "Modified: / 10-12-2012 / 10:53:14 / jv"
282
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   154
    "Modified: / 01-04-2013 / 13:41:42 / 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
   155
!
6439af30a24b Fix in temporary working copy update.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
   156
6439af30a24b Fix in temporary working copy update.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
   157
doPrepareWorkingCopy2
6439af30a24b Fix in temporary working copy update.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
   158
6439af30a24b Fix in temporary working copy update.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
   159
    self isPackageCommit ifTrue:[
6439af30a24b Fix in temporary working copy update.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
   160
        self do:[
118
5a8b78ad48ae Refactoring (part 2): Rename SCMAbstractPackageModel>>workingCopy to temporaryWorkingCopy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 115
diff changeset
   161
            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
   162
            self doFileOut
6439af30a24b Fix in temporary working copy update.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
   163
        ]
6439af30a24b Fix in temporary working copy update.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
   164
    ].
6439af30a24b Fix in temporary working copy update.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
   165
6439af30a24b Fix in temporary working copy update.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
   166
    "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
   167
! !
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   168
288
577f8935661d Added ProjectDefinition>>hgRemoveContainesForDeletedClasses config methd.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 282
diff changeset
   169
!HGCommitTask methodsFor:'executing - private'!
577f8935661d Added ProjectDefinition>>hgRemoveContainesForDeletedClasses config methd.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 282
diff changeset
   170
353
456532e0478c Added more support for HG mirrors of CVS repos.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 335
diff changeset
   171
doCompileCopyrightMethods
456532e0478c Added more support for HG mirrors of CVS repos.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 335
diff changeset
   172
456532e0478c Added more support for HG mirrors of CVS repos.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 335
diff changeset
   173
    self packageDefinition hgEnsureCopyrightMethod ifFalse:[ ^ self ].
456532e0478c Added more support for HG mirrors of CVS repos.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 335
diff changeset
   174
    super doCompileCopyrightMethods
456532e0478c Added more support for HG mirrors of CVS repos.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 335
diff changeset
   175
456532e0478c Added more support for HG mirrors of CVS repos.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 335
diff changeset
   176
    "Created: / 09-10-2013 / 11:55:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
456532e0478c Added more support for HG mirrors of CVS repos.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 335
diff changeset
   177
!
456532e0478c Added more support for HG mirrors of CVS repos.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 335
diff changeset
   178
456532e0478c Added more support for HG mirrors of CVS repos.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 335
diff changeset
   179
doCompileVersionMethods
456532e0478c Added more support for HG mirrors of CVS repos.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 335
diff changeset
   180
    | klasses |
456532e0478c Added more support for HG mirrors of CVS repos.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 335
diff changeset
   181
456532e0478c Added more support for HG mirrors of CVS repos.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 335
diff changeset
   182
    klasses := self classesToFileOut asArray.
456532e0478c Added more support for HG mirrors of CVS repos.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 335
diff changeset
   183
    self packageDefinition hgEnsureVersion_HGMethod ifFalse:[ 
456532e0478c Added more support for HG mirrors of CVS repos.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 335
diff changeset
   184
        klasses := klasses select:[:cls| self shouldFileOutClass: cls ].  
456532e0478c Added more support for HG mirrors of CVS repos.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 335
diff changeset
   185
    ].   
456532e0478c Added more support for HG mirrors of CVS repos.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 335
diff changeset
   186
    self doCompileVersionMethodsIn: klasses
456532e0478c Added more support for HG mirrors of CVS repos.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 335
diff changeset
   187
456532e0478c Added more support for HG mirrors of CVS repos.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 335
diff changeset
   188
    "Created: / 09-10-2013 / 11:58:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
456532e0478c Added more support for HG mirrors of CVS repos.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 335
diff changeset
   189
!
456532e0478c Added more support for HG mirrors of CVS repos.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 335
diff changeset
   190
288
577f8935661d Added ProjectDefinition>>hgRemoveContainesForDeletedClasses config methd.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 282
diff changeset
   191
doRemoveOldContainers
577f8935661d Added ProjectDefinition>>hgRemoveContainesForDeletedClasses config methd.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 282
diff changeset
   192
    | def |
577f8935661d Added ProjectDefinition>>hgRemoveContainesForDeletedClasses config methd.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 282
diff changeset
   193
577f8935661d Added ProjectDefinition>>hgRemoveContainesForDeletedClasses config methd.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 282
diff changeset
   194
    def := self package definition.
577f8935661d Added ProjectDefinition>>hgRemoveContainesForDeletedClasses config methd.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 282
diff changeset
   195
    def hgRemoveContainesForDeletedClasses ifFalse:[
577f8935661d Added ProjectDefinition>>hgRemoveContainesForDeletedClasses config methd.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 282
diff changeset
   196
        ^self.
577f8935661d Added ProjectDefinition>>hgRemoveContainesForDeletedClasses config methd.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 282
diff changeset
   197
    ].
577f8935661d Added ProjectDefinition>>hgRemoveContainesForDeletedClasses config methd.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 282
diff changeset
   198
    super doRemoveOldContainers
577f8935661d Added ProjectDefinition>>hgRemoveContainesForDeletedClasses config methd.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 282
diff changeset
   199
577f8935661d Added ProjectDefinition>>hgRemoveContainesForDeletedClasses config methd.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 282
diff changeset
   200
    "Created: / 21-05-2013 / 16:48:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
577f8935661d Added ProjectDefinition>>hgRemoveContainesForDeletedClasses config methd.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 282
diff changeset
   201
! !
577f8935661d Added ProjectDefinition>>hgRemoveContainesForDeletedClasses config methd.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 282
diff changeset
   202
248
b1a6ab0c86a1 Fixes in commit dialog (warning about commiting new head)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   203
!HGCommitTask methodsFor:'queries'!
b1a6ab0c86a1 Fixes in commit dialog (warning about commiting new head)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   204
b1a6ab0c86a1 Fixes in commit dialog (warning about commiting new head)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   205
commitingNewHead
b1a6ab0c86a1 Fixes in commit dialog (warning about commiting new head)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   206
    "Return true, if a new head is to be commited, false otherwise.
b1a6ab0c86a1 Fixes in commit dialog (warning about commiting new head)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   207
b1a6ab0c86a1 Fixes in commit dialog (warning about commiting new head)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   208
     !!!!!!NOTE!!!!!!
b1a6ab0c86a1 Fixes in commit dialog (warning about commiting new head)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   209
     When there is no head at all such as when commiting to a fresh repository
b1a6ab0c86a1 Fixes in commit dialog (warning about commiting new head)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   210
     or into a just-created branch, this method returns FALSE.
b1a6ab0c86a1 Fixes in commit dialog (warning about commiting new head)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   211
     "
b1a6ab0c86a1 Fixes in commit dialog (warning about commiting new head)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   212
b1a6ab0c86a1 Fixes in commit dialog (warning about commiting new head)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   213
    | heads changeset |
b1a6ab0c86a1 Fixes in commit dialog (warning about commiting new head)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   214
282
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   215
    heads := temporaryWorkingCopy heads.
248
b1a6ab0c86a1 Fixes in commit dialog (warning about commiting new head)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   216
    heads isEmpty ifTrue:[ ^ false ].
282
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   217
    changeset := temporaryWorkingCopy changeset.
248
b1a6ab0c86a1 Fixes in commit dialog (warning about commiting new head)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   218
    ^(heads includes: changeset) not
b1a6ab0c86a1 Fixes in commit dialog (warning about commiting new head)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   219
b1a6ab0c86a1 Fixes in commit dialog (warning about commiting new head)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   220
    "Created: / 08-03-2013 / 20:11:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
282
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   221
    "Modified: / 01-04-2013 / 12:57:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   222
!
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   223
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   224
isMergeCommit
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   225
    "Return true, if this commit is a merge commit, i.e., 
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   226
     if commited changeset will have two parents"
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   227
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   228
    ^temporaryWorkingCopy parent2Id isNull not
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   229
fb71143ed353 Fixes for commiting from filebrowser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 248
diff changeset
   230
    "Created: / 01-04-2013 / 13:03:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
248
b1a6ab0c86a1 Fixes in commit dialog (warning about commiting new head)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   231
! !
b1a6ab0c86a1 Fixes in commit dialog (warning about commiting new head)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   232
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   233
!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
   234
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   235
version_HG
115
b1ed2d29054b version_HG changed to return string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
   236
b1ed2d29054b version_HG changed to return string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
   237
    ^ '$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
   238
!
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   239
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   240
version_SVN
61
fd129d0c603e Fixes in committing
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   241
    ^ '§Id::                                                                                                                        §'
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   242
! !
210
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 158
diff changeset
   243