mercurial/HGPackageModel.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 21 Nov 2012 01:21:47 +0000
changeset 88 1ad71a063a20
parent 86 facd1382c8a6
child 102 16bc16d9e6d5
permissions -rw-r--r--
Bunch of fixes. HGPackageModel: fixed temporary working copy creation. Must update temporary working copy to a revision the package in image is based on. HGStatus & HGCommandParser: added new status (Copied), fixed command parser to correctly parse copied file status. Added HGRevisionInfo class as interface to AbstractSourceCodeManager. HGRepository & HGWorkingCopy: improved cloning and updating.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     1
"{ Package: 'stx:libscm/mercurial' }"
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     2
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     3
SCMAbstractPackageModel subclass:#HGPackageModel
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     4
	instanceVariableNames:''
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     5
	classVariableNames:''
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     6
	poolDictionaries:''
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     7
	category:'SCM-Mercurial-StX'
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     8
!
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     9
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    10
69
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
    11
!HGPackageModel class methodsFor:'instance creation'!
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
    12
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
    13
named:package
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
    14
    ^HGPackageModelRegistry packageNamed: package
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
    15
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
    16
    "Modified: / 16-11-2012 / 19:53:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
    17
! !
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
    18
46
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    19
!HGPackageModel methodsFor:'accessing'!
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    20
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    21
manager
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    22
    ^ HGSourceCodeManager
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    23
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    24
    "Created: / 14-11-2012 / 01:02:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
57
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    25
!
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    26
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    27
repository
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    28
    self ensureWorkingCopy.
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    29
    ^wc repository
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    30
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    31
    "Created: / 15-11-2012 / 09:47:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
46
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    32
! !
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    33
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    34
!HGPackageModel methodsFor:'accessing-classes'!
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    35
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    36
commitDialogClass
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    37
    "raise an error: must be redefined in concrete subclass(es)"
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    38
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    39
    ^ HGCommitDialog
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    40
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    41
    "Created: / 14-11-2012 / 22:30:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    42
!
46
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    43
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    44
commitTaskClass
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    45
    ^ HGCommitTask
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    46
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    47
    "Created: / 14-11-2012 / 00:36:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    48
! !
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    49
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    50
!HGPackageModel methodsFor:'utils'!
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    51
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    52
ensureWorkingCopy
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    53
    "raise an error: must be redefined in concrete subclass(es)"
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    54
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    55
    | tmpPath tmpRepo tmpWc |
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    56
86
facd1382c8a6 HGPackageModel: check for missing workspace.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
    57
    (wc notNil and:[wc path exists]) ifTrue:[ ^ self ].
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    58
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    59
    tmpPath := self manager temporaryWorkingCopyDirectory / repository uuid printString.
88
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
    60
    tmpPath exists ifTrue:[
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
    61
        tmpRepo := HGRepository on: tmpPath.
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
    62
        tmpWc := tmpRepo workingCopy.
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
    63
    ] ifFalse:[
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
    64
        tmpRepo := repository cloneTo: tmpPath update: false.
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
    65
        tmpWc := tmpRepo workingCopy.
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
    66
        tmpWc update: self definition hgLogicalRevision.
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
    67
    ].
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
    68
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    69
    self wc: tmpWc
46
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    70
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    71
    "Created: / 14-11-2012 / 00:16:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
88
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
    72
    "Modified: / 21-11-2012 / 00:37:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
46
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    73
! !
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    74
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    75
!HGPackageModel class methodsFor:'documentation'!
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    76
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    77
version_GIT
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    78
    "Never, ever change this method. Ask JV or CG why"
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    79
    ^thisContext method mclass theNonMetaclass instVarNamed: #revision
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    80
!
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    81
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    82
version_HG
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    83
    "Never, ever change this method. Ask JV or CG why"
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    84
    ^thisContext method mclass theNonMetaclass instVarNamed: #revision
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    85
!
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    86
46
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    87
version_SVN
57
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    88
    ^ '§Id::                                                                                                                        §'
46
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    89
! !