mercurial/HGRepository.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 22 Jan 2013 17:09:15 +0000
changeset 191 f0745f4cdc97
parent 176 78124cee58da
child 193 ad31a280c0d4
permissions -rw-r--r--
Performance optimization: lazily pre-load all unloaded changes at once. Whenever an HGChangeset is lazy-loaded, all other pending unloaded changsets are pre-loaded. This speeds up operations like listing all revision of given class as hg command is executed once to retrive them all.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     1
"{ Package: 'stx:libscm/mercurial' }"
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     2
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     3
Object subclass:#HGRepository
165
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
     4
	instanceVariableNames:'uuid path wc changesets branches config lock'
163
21bc6994087d Experimental HGWorkingCopyBrowser - unfinished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
     5
	classVariableNames:'Cache'
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     6
	poolDictionaries:''
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     7
	category:'SCM-Mercurial-Core'
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     8
!
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     9
40
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
    10
HGRepositoryObject subclass:#Changesets
69
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
    11
	instanceVariableNames:'changesets revno2nodeIdMap'
40
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
    12
	classVariableNames:''
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
    13
	poolDictionaries:''
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
    14
	privateIn:HGRepository
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
    15
!
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
    16
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    17
163
21bc6994087d Experimental HGWorkingCopyBrowser - unfinished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
    18
!HGRepository class methodsFor:'initialization'!
21bc6994087d Experimental HGWorkingCopyBrowser - unfinished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
    19
21bc6994087d Experimental HGWorkingCopyBrowser - unfinished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
    20
initialize
21bc6994087d Experimental HGWorkingCopyBrowser - unfinished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
    21
    "Invoked at system start or when the class is dynamically loaded."
21bc6994087d Experimental HGWorkingCopyBrowser - unfinished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
    22
21bc6994087d Experimental HGWorkingCopyBrowser - unfinished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
    23
    "/ please change as required (and remove this comment)
21bc6994087d Experimental HGWorkingCopyBrowser - unfinished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
    24
21bc6994087d Experimental HGWorkingCopyBrowser - unfinished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
    25
    Cache := CacheDictionary new: 8
21bc6994087d Experimental HGWorkingCopyBrowser - unfinished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
    26
21bc6994087d Experimental HGWorkingCopyBrowser - unfinished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
    27
    "Modified: / 14-12-2012 / 19:31:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
21bc6994087d Experimental HGWorkingCopyBrowser - unfinished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
    28
! !
21bc6994087d Experimental HGWorkingCopyBrowser - unfinished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
    29
46
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
    30
!HGRepository class methodsFor:'instance creation'!
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    31
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    32
on: aStringOrFilename
167
73ede479a28f Bugfix - do not cache repositories by default.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 165
diff changeset
    33
    ^self on: aStringOrFilename cached: false
73ede479a28f Bugfix - do not cache repositories by default.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 165
diff changeset
    34
73ede479a28f Bugfix - do not cache repositories by default.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 165
diff changeset
    35
    "Created: / 17-10-2012 / 13:30:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
73ede479a28f Bugfix - do not cache repositories by default.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 165
diff changeset
    36
    "Modified: / 16-12-2012 / 12:59:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
73ede479a28f Bugfix - do not cache repositories by default.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 165
diff changeset
    37
!
73ede479a28f Bugfix - do not cache repositories by default.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 165
diff changeset
    38
73ede479a28f Bugfix - do not cache repositories by default.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 165
diff changeset
    39
on: aStringOrFilename cached: cache
163
21bc6994087d Experimental HGWorkingCopyBrowser - unfinished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
    40
    | path |
21bc6994087d Experimental HGWorkingCopyBrowser - unfinished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
    41
21bc6994087d Experimental HGWorkingCopyBrowser - unfinished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
    42
    path := aStringOrFilename asFilename.
167
73ede479a28f Bugfix - do not cache repositories by default.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 165
diff changeset
    43
    ^cache ifTrue:[
73ede479a28f Bugfix - do not cache repositories by default.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 165
diff changeset
    44
        Cache at: path ifAbsentPut:[self new initializeOn: path]
73ede479a28f Bugfix - do not cache repositories by default.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 165
diff changeset
    45
    ] ifFalse:[
73ede479a28f Bugfix - do not cache repositories by default.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 165
diff changeset
    46
        self new initializeOn: path
73ede479a28f Bugfix - do not cache repositories by default.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 165
diff changeset
    47
    ]
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    48
167
73ede479a28f Bugfix - do not cache repositories by default.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 165
diff changeset
    49
    "Created: / 16-12-2012 / 12:58:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    50
! !
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    51
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    52
!HGRepository class methodsFor:'cloning'!
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    53
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    54
clone: aFilenameOrUrlOrString to: aStringOrFilename
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    55
    "Clones repository at given URL to given directory.
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    56
     Returns an instance HGRepository representing the clone."
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    57
88
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
    58
    ^self clone: aFilenameOrUrlOrString to: aStringOrFilename update: true
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
    59
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
    60
    "Created: / 14-11-2012 / 22:46:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
    61
    "Modified: / 21-11-2012 / 00:20:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
    62
!
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
    63
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
    64
clone: aFilenameOrUrlOrString to: aStringOrFilename update: update
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
    65
    "Clones repository at given URL to given directory.
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
    66
     Returns an instance HGRepository representing the clone."
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
    67
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    68
    | url dst dir |
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    69
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    70
    url := aFilenameOrUrlOrString asString.
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    71
    dst := aStringOrFilename asFilename.
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    72
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    73
    dst exists ifTrue:[
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    74
        HGError raiseErrorString: 'Cannot clone to existsing directory!!'.
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    75
        ^nil
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    76
    ].
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    77
    dir := dst directory.
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    78
    dir exists ifFalse:[
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    79
        HGError raiseErrorString: 'Directory for clone does not exist!!'.
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    80
        ^nil
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    81
    ].
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    82
    dir isWritable ifFalse:[
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    83
        HGError raiseErrorString: 'Cannot clone into write-protected directory'.
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    84
        ^nil
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
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    87
    HGCommand clone
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    88
        url: url;
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    89
        path: dst pathName;
88
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
    90
        update: update;
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    91
        execute.
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    92
    ^HGRepository on: dst.
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    93
88
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
    94
    "Created: / 21-11-2012 / 00:20:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    95
! !
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
    96
46
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
    97
!HGRepository class methodsFor:'utilities'!
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
    98
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
    99
discover: aStringOrFilename
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   100
    "Find a Mercurial repository in given directory or super-directories
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   101
     and return it (as an instance of Filename). If no repository is found, 
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   102
     returns nil.
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   103
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   104
     Currently, it searches for presence of .hg directory"
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   105
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   106
    | f |
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   107
    f := aStringOrFilename.
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   108
    f isDirectory ifFalse:[
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   109
        f := f directory
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   110
    ].
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   111
    [ ( f / '.hg' ) exists ] whileFalse:[
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   112
        f isRootDirectory ifTrue:[ ^nil ].
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   113
        f := f directory.
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   114
    ].
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   115
    ^f
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   116
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   117
    "Created: / 13-11-2012 / 22:34:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   118
    "Modified: / 14-11-2012 / 00:02:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   119
! !
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   120
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   121
!HGRepository methodsFor:'accessing'!
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   122
105
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   123
branches
106
99be3b5a40da Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   124
    "Returns a list of named branches in the repository,
99be3b5a40da Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   125
     including closed ones"
99be3b5a40da Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   126
105
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   127
    | current names |
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   128
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   129
    current := HGCommand branches
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   130
            workingDirectory: path pathName;
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   131
            active: false;
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   132
            closed: true;
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   133
            execute.
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   134
    names := branches collect:[:b|b name].
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   135
    current := current reject:[:b|names includes: b name].
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   136
    current do:[:b|b setRepository: self].
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   137
    branches addAll: current.
176
78124cee58da Bugfix: keep branch of mater working copy even if there are no changesets yet.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 175
diff changeset
   138
    branches isEmpty ifTrue:[
78124cee58da Bugfix: keep branch of mater working copy even if there are no changesets yet.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 175
diff changeset
   139
        branches add: (HGBranch new setName: 'default'; setRepository: self).
78124cee58da Bugfix: keep branch of mater working copy even if there are no changesets yet.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 175
diff changeset
   140
    ].
105
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   141
    ^branches.
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   142
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   143
    "Created: / 27-11-2012 / 19:57:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
176
78124cee58da Bugfix: keep branch of mater working copy even if there are no changesets yet.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 175
diff changeset
   144
    "Modified: / 14-01-2013 / 14:17:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
106
99be3b5a40da Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   145
!
99be3b5a40da Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   146
145
1b8652185a8f Added HGRepository>>config.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 115
diff changeset
   147
config
1b8652185a8f Added HGRepository>>config.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 115
diff changeset
   148
    ^config
1b8652185a8f Added HGRepository>>config.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 115
diff changeset
   149
1b8652185a8f Added HGRepository>>config.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 115
diff changeset
   150
    "Created: / 06-12-2012 / 21:40:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1b8652185a8f Added HGRepository>>config.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 115
diff changeset
   151
!
1b8652185a8f Added HGRepository>>config.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 115
diff changeset
   152
106
99be3b5a40da Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   153
heads
99be3b5a40da Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   154
    "Returns a list of heads (as HGChangeset)"
99be3b5a40da Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   155
99be3b5a40da Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   156
    | ids |
99be3b5a40da Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   157
99be3b5a40da Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   158
    ids := HGCommand heads
99be3b5a40da Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   159
                workingDirectory: path pathName;
99be3b5a40da Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   160
                execute.
99be3b5a40da Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   161
    ^ids collect:[:id|self changesetWithId: id].
99be3b5a40da Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   162
99be3b5a40da Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   163
    "Created: / 27-11-2012 / 21:33:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
105
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   164
!
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   165
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   166
path
46
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   167
    "Return path to the repository (directory with .hg store)"
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   168
    ^ path
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   169
46
d5a192b11a1a - More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 40
diff changeset
   170
    "Modified (comment): / 13-11-2012 / 18:18:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
36
41cb88196e69 - HGTests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 34
diff changeset
   171
!
41cb88196e69 - HGTests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 34
diff changeset
   172
69
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   173
pathName
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   174
    "Return path to the repository (directory with .hg store)"
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   175
    ^ path pathName
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   176
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   177
    "Created: / 16-11-2012 / 22:36:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   178
!
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   179
151
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 150
diff changeset
   180
remoteDefault
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 150
diff changeset
   181
    "Return default remote (upstream) repository or nil if none"
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 150
diff changeset
   182
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 150
diff changeset
   183
    ^self remotes detect:[:e|e isDefault] ifNone:[nil]
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 150
diff changeset
   184
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 150
diff changeset
   185
    "Created: / 10-12-2012 / 01:26:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 150
diff changeset
   186
!
527a1e85aef8 Support for 'autopush' in commit dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 150
diff changeset
   187
150
1813913f6106 Addec HGRepositoru>>remotes returning list of remote repositories.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 145
diff changeset
   188
remotes
1813913f6106 Addec HGRepositoru>>remotes returning list of remote repositories.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 145
diff changeset
   189
    "Returns a collection of configured remote (upstream) repositories"
1813913f6106 Addec HGRepositoru>>remotes returning list of remote repositories.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 145
diff changeset
   190
1813913f6106 Addec HGRepositoru>>remotes returning list of remote repositories.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 145
diff changeset
   191
    | paths remotes |
1813913f6106 Addec HGRepositoru>>remotes returning list of remote repositories.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 145
diff changeset
   192
1813913f6106 Addec HGRepositoru>>remotes returning list of remote repositories.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 145
diff changeset
   193
    paths := self config get: #paths default: nil.
1813913f6106 Addec HGRepositoru>>remotes returning list of remote repositories.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 145
diff changeset
   194
    paths isNil ifTrue:[ ^ #() ].
1813913f6106 Addec HGRepositoru>>remotes returning list of remote repositories.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 145
diff changeset
   195
    paths isEmpty ifTrue:[ ^ #() ].
1813913f6106 Addec HGRepositoru>>remotes returning list of remote repositories.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 145
diff changeset
   196
    remotes := OrderedCollection new.
1813913f6106 Addec HGRepositoru>>remotes returning list of remote repositories.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 145
diff changeset
   197
    paths keysAndValuesDo:[:name :url|
1813913f6106 Addec HGRepositoru>>remotes returning list of remote repositories.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 145
diff changeset
   198
        remotes add: (HGRemote new setRepository: self; setName: name url:url value).
1813913f6106 Addec HGRepositoru>>remotes returning list of remote repositories.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 145
diff changeset
   199
    ].
1813913f6106 Addec HGRepositoru>>remotes returning list of remote repositories.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 145
diff changeset
   200
    ^remotes
1813913f6106 Addec HGRepositoru>>remotes returning list of remote repositories.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 145
diff changeset
   201
1813913f6106 Addec HGRepositoru>>remotes returning list of remote repositories.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 145
diff changeset
   202
    "Created: / 09-12-2012 / 22:51:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1813913f6106 Addec HGRepositoru>>remotes returning list of remote repositories.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 145
diff changeset
   203
!
1813913f6106 Addec HGRepositoru>>remotes returning list of remote repositories.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 145
diff changeset
   204
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
   205
uuid
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
   206
    "Returns unique ID identifing this concrete instance
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
   207
     of a repository"
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
   208
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
   209
    ^ uuid
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
   210
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
   211
    "Modified (comment): / 14-11-2012 / 23:22:41 / 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
   212
!
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
   213
36
41cb88196e69 - HGTests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 34
diff changeset
   214
workingCopy
41cb88196e69 - HGTests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 34
diff changeset
   215
    wc isNil ifTrue:[
41cb88196e69 - HGTests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 34
diff changeset
   216
	wc := HGWorkingCopy new setRepository: self.
41cb88196e69 - HGTests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 34
diff changeset
   217
    ].
41cb88196e69 - HGTests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 34
diff changeset
   218
    ^wc
41cb88196e69 - HGTests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 34
diff changeset
   219
41cb88196e69 - HGTests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 34
diff changeset
   220
    "Created: / 19-10-2012 / 15:42:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   221
! !
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   222
40
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   223
!HGRepository methodsFor:'accessing-changesets'!
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   224
69
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   225
@ id
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   226
    ^self changesetWithId: id.
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   227
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   228
    "Created: / 16-11-2012 / 20:29:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   229
!
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   230
40
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   231
changesetWithId: id
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   232
    ^changesets changesetWithId: id
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   233
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   234
    "Created: / 13-11-2012 / 17:58:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   235
! !
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   236
105
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   237
!HGRepository methodsFor:'accessing-private'!
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   238
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   239
branchWithName: name 
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   240
    "Returns branch with given name. If there is no such branch,
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   241
     an exception is raised"
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   242
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   243
    ^self branchWithName: name ifAbsent:[
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   244
        HGNoSuchBranchError newException
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   245
            parameter: name;
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   246
            messageText: 'No such branch: ', name;
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   247
            raiseSignal
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   248
    ]
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   249
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   250
    "Created: / 27-11-2012 / 13:55:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   251
!
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   252
152
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
   253
branchWithName: name createIfAbsent: create
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
   254
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
   255
    ^self branchWithName: name ifAbsent:[
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
   256
        | b |
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
   257
        b := HGBranch new setRepository: self.
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
   258
        b setName: name.
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
   259
        branches add: b.
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
   260
        b
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
   261
    ]
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
   262
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
   263
    "Created: / 10-12-2012 / 03:14:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
   264
!
9068fe7a5795 Support for commiting to a new branch.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 151
diff changeset
   265
105
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   266
branchWithName: name ifAbsent: block
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   267
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   268
    ^self branches detect:[:b|b name = name] ifNone: block
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   269
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   270
    "Created: / 27-11-2012 / 14:31:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
165
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   271
!
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   272
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   273
changesetWithId: id into: cs
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   274
    changesets load: id into: cs
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   275
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   276
    "Created: / 16-12-2012 / 01:26:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   277
!
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   278
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   279
lock
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   280
    ^lock
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   281
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   282
    "Created: / 16-12-2012 / 00:39:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
105
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   283
! !
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   284
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   285
!HGRepository methodsFor:'initialization'!
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   286
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   287
initializeOn: aStringOrFilename
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   288
    | p |
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   289
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   290
    p := aStringOrFilename asFilename.
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   291
    p exists ifFalse:[
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   292
        HGRepositoryError raiseSignal: 'Given path does not exists'.
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   293
        ^nil.
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   294
    ].
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   295
    p isDirectory ifFalse:[
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   296
        HGRepositoryError raiseSignal: 'Given path is not a directory'.
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   297
        ^nil.
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   298
    ].
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   299
    (p / '.hg') isDirectory ifFalse:[
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   300
        HGRepositoryError raiseSignal: 'Given path does not contain a repository (.hg subdir not found - try use #lookup:)'.
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   301
        ^nil.
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   302
    ].
40
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   303
    path := p.
55
30d72a8f4501 Commit support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   304
    changesets := HGRepository::Changesets new setRepository: self.
105
25e8ff9d2a31 Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 103
diff changeset
   305
    branches := OrderedCollection new.
145
1b8652185a8f Added HGRepository>>config.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 115
diff changeset
   306
    uuid := UUID new.
1b8652185a8f Added HGRepository>>config.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 115
diff changeset
   307
    config := HGConfig new setRepository: self.
165
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   308
    lock := RecursionLock new.
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   309
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   310
    "Created: / 17-10-2012 / 13:35:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
165
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   311
    "Modified: / 16-12-2012 / 00:38:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
40
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   312
! !
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   313
57
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   314
!HGRepository methodsFor:'operations'!
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   315
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   316
cloneTo: aStringOrFilename
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   317
    "Creates a clone of the receiver into given directory.
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   318
     Returns an instance HGRepository representing the clone."
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   319
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   320
    ^self class clone: path to: aStringOrFilename
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   321
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   322
    "Created: / 14-11-2012 / 22:43:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   323
!
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   324
88
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
   325
cloneTo: aStringOrFilename update: update
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
   326
    "Creates a clone of the receiver into given directory.
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
   327
     Returns an instance HGRepository representing the clone.
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
   328
     If update is true, repository working copy is updated, otherwise
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
   329
     it's left empty"
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
   330
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
   331
    ^self class clone: path to: aStringOrFilename update: update
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
   332
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
   333
    "Created: / 21-11-2012 / 00:21:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
   334
!
1ad71a063a20 Bunch of fixes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
   335
57
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   336
pull
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   337
    "Pulls changesets from default upstream repository.
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   338
     See .hg/hgrc, section path"
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   339
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   340
    HGCommand pull
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   341
        workingDirectory: path pathName;
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   342
        execute.
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   343
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   344
    "Created: / 15-11-2012 / 10:00:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   345
!
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   346
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   347
push
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   348
    "Pushes changesets to default upstream repository.
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   349
     See .hg/hgrc, section path"
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   350
107
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   351
    ^self push: nil force: false
57
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   352
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   353
    "Created: / 15-11-2012 / 09:59:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
107
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   354
    "Modified: / 27-11-2012 / 21:58:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
57
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   355
!
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   356
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   357
push: url
107
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   358
    "Push changesets to given repository. url can be either repository URL or alias. 
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   359
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   360
    See .hg/hgrc, section for configured aliases"
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   361
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   362
    ^self push: url force: false
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   363
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   364
    "Created: / 15-11-2012 / 10:00:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   365
    "Modified: / 27-11-2012 / 21:59:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   366
!
57
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   367
107
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   368
push: urlOrNil force: force
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   369
    "Pushes changesets to url. If url is nil, then changes are pushed to
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   370
     a default repository. If force is true, push is forced (allowing creation
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   371
     of new heads in remote repo),
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   372
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   373
     See .hg/hgrc, section path"
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   374
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   375
    HGCommand push
57
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   376
        workingDirectory: path pathName;
107
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   377
        url: urlOrNil;
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   378
        force: force;
57
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   379
        execute.
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   380
107
c92f7674485e Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   381
    "Created: / 27-11-2012 / 21:58:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
57
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   382
! !
47b14a8b7eb8 Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 55
diff changeset
   383
165
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   384
!HGRepository methodsFor:'synchronized evaluation'!
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   385
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   386
synchronizationSemaphore
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   387
    ^lock
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   388
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   389
    "Created: / 16-12-2012 / 00:40:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   390
!
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   391
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   392
synchronizationSemaphore: aRecursionLock
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   393
    lock := aRecursionLock
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   394
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   395
    "Created: / 16-12-2012 / 00:40:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   396
! !
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   397
40
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   398
!HGRepository::Changesets class methodsFor:'documentation'!
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   399
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   400
documentation
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   401
"
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   402
    A simple object to maintain and load changesets metadata lazily.
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   403
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   404
    [author:]
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   405
        Jan Vrany <jan.vrany@fit.cvut.cz>
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   406
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   407
    [instance variables:]
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   408
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   409
    [class variables:]
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   410
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   411
    [see also:]
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   412
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   413
"
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   414
! !
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   415
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   416
!HGRepository::Changesets class methodsFor:'instance creation'!
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   417
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   418
new
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   419
    "return an initialized instance"
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   420
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   421
    ^ self basicNew initialize.
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   422
! !
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   423
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   424
!HGRepository::Changesets methodsFor:'accessing'!
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   425
69
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   426
changesetWithId: idobj
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   427
    | id xid cs |
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   428
103
04731ef44417 HGNodeId renamed to HGChangesetId
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 88
diff changeset
   429
    id := idobj asHGChangesetId.    
69
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   430
    "/Try to translate it...
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   431
    id hasRevnoOnly ifTrue:[
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   432
        xid := revno2nodeIdMap at: id revno ifAbsent:[nil].
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   433
    ].
165
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   434
    xid := xid ? id.
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   435
69
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   436
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   437
    "/Look in cache using xlated id...
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   438
    cs := changesets at: xid ifAbsent:[ nil ].
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   439
    cs notNil ifTrue: [ ^ cs ].
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   440
165
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   441
    self synchronized:[
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   442
        "/Look in cache using xlated id...
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   443
        cs := changesets at: xid ifAbsent:[ nil ].
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   444
        cs notNil ifTrue: [ ^ cs ].
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   445
191
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   446
        cs := (xid isShort or:[xid hasRevnoOnly]) 
165
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   447
                ifTrue:[
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   448
                    self load: xid into: nil]"/Short id, we have to load it
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   449
                ifFalse:[
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   450
                    HGChangeset new setId: xid; setRepository: repository]."/Full id, can make it lazy
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   451
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   452
        changesets at: cs id put: cs.
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   453
        revno2nodeIdMap  at: cs id revno put: cs id.
69
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   454
    ].
165
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   455
    ^cs .
40
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   456
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   457
    "Created: / 13-11-2012 / 17:52:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
191
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   458
    "Modified: / 22-01-2013 / 17:04:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
40
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   459
! !
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   460
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   461
!HGRepository::Changesets methodsFor:'initialization'!
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   462
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   463
initialize
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   464
    "Invoked when a new instance is created."
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   465
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   466
    "/ please change as required (and remove this comment)
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   467
    changesets := Dictionary new.
69
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   468
    revno2nodeIdMap := Dictionary new.
40
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   469
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   470
    "/ super initialize.   -- commented since inherited method does nothing
e3699c0b00f9 Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 36
diff changeset
   471
69
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 57
diff changeset
   472
    "Modified: / 16-11-2012 / 21:58:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   473
! !
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   474
165
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   475
!HGRepository::Changesets methodsFor:'private'!
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   476
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   477
load: id into: changesetOrNil
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   478
    "Load all data for changeset with given id.
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   479
     If changesetOrNil is not nil, then update given
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   480
     changeset.
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   481
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   482
     Return changeset with filled data, i.e,, changeset is
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   483
     non-lazy"
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   484
191
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   485
     | csets cs |
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   486
     csets := HGCommand log
165
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   487
                    workingDirectory: repository path asString;
191
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   488
                    revsets: (self loadRevsetsForLoad: id);
165
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   489
                    execute.
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   490
     "/just to be defensive...
191
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   491
     csets do:[:each| 
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   492
        | existing |
165
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   493
191
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   494
        each setRepository: repository.
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   495
        existing := changesets at: each id ifAbsentPut:[each].
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   496
        existing ~~ each ifTrue:[
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   497
            existing setSlotsFrom: each.
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   498
            self assert: existing id isShort not.
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   499
        ].
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   500
        existing id = id ifTrue:[
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   501
            cs := existing
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   502
        ].
165
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   503
    ].
191
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   504
    ^cs
165
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   505
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   506
    "Created: / 16-12-2012 / 00:57:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
191
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   507
    "Modified: / 22-01-2013 / 16:46:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   508
!
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   509
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   510
loadRevsetsForLoad: id
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   511
    | revsets ids start stop addId |
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   512
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   513
    revsets := OrderedCollection new.
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   514
    ids := changesets keys asOrderedCollection sort: [:a :b|a revno > b revno].
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   515
    addId := true.
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   516
    ids do:[:each| | cs |
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   517
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   518
        each = id ifTrue:[addId := false].
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   519
        cs := changesets at: each.
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   520
        cs loaded ifFalse:[
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   521
            start isNil ifTrue:[
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   522
                start := stop := each
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   523
            ] ifFalse:[
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   524
                each revno < (start revno - 20) ifTrue:[
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   525
                    revsets add: (start revno printString , ':' , (start revno - 20) printString).
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   526
                    start := each.
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   527
                ] ifFalse:[
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   528
                    revsets add: (start revno printString , ':' , stop revno printString).
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   529
                ].
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   530
            ]
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   531
        ].
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   532
    ].
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   533
    addId ifTrue:[revsets add: id printString].
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   534
    ^revsets
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   535
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   536
    "Created: / 22-01-2013 / 16:41:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
165
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   537
! !
4f6432cf4240 Added support for lazy changesets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 163
diff changeset
   538
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   539
!HGRepository class methodsFor:'documentation'!
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   540
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
   541
version_HG
115
b1ed2d29054b version_HG changed to return string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
   542
b1ed2d29054b version_HG changed to return string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 107
diff changeset
   543
    ^ '$Changeset: <not expanded> $'
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
   544
!
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 46
diff changeset
   545
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   546
version_SVN
55
30d72a8f4501 Commit support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   547
    ^ '§Id::                                                                                                                        §'
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   548
! !
163
21bc6994087d Experimental HGWorkingCopyBrowser - unfinished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
   549
191
f0745f4cdc97 Performance optimization: lazily pre-load all unloaded changes at once.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 176
diff changeset
   550
163
21bc6994087d Experimental HGWorkingCopyBrowser - unfinished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 152
diff changeset
   551
HGRepository initialize!