author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 06 Dec 2012 21:56:30 +0000 | |
changeset 145 | 1b8652185a8f |
parent 115 | b1ed2d29054b |
child 150 | 1813913f6106 |
permissions | -rw-r--r-- |
34 | 1 |
"{ Package: 'stx:libscm/mercurial' }" |
2 |
||
3 |
Object subclass:#HGRepository |
|
145
1b8652185a8f
Added HGRepository>>config.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
115
diff
changeset
|
4 |
instanceVariableNames:'uuid path wc changesets branches config' |
34 | 5 |
classVariableNames:'' |
6 |
poolDictionaries:'' |
|
7 |
category:'SCM-Mercurial-Core' |
|
8 |
! |
|
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 | 17 |
|
46
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
18 |
!HGRepository class methodsFor:'instance creation'! |
34 | 19 |
|
20 |
on: aStringOrFilename |
|
21 |
^self new initializeOn: aStringOrFilename |
|
22 |
||
23 |
"Created: / 17-10-2012 / 13:30:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
24 |
! ! |
|
25 |
||
54
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
26 |
!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
|
27 |
|
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
28 |
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
|
29 |
"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
|
30 |
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
|
31 |
|
88 | 32 |
^self clone: aFilenameOrUrlOrString to: aStringOrFilename update: true |
33 |
||
34 |
"Created: / 14-11-2012 / 22:46:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
35 |
"Modified: / 21-11-2012 / 00:20:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
36 |
! |
|
37 |
||
38 |
clone: aFilenameOrUrlOrString to: aStringOrFilename update: update |
|
39 |
"Clones repository at given URL to given directory. |
|
40 |
Returns an instance HGRepository representing the clone." |
|
41 |
||
54
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
42 |
| 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
|
43 |
|
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
44 |
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
|
45 |
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
|
46 |
|
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
47 |
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
|
48 |
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
|
49 |
^nil |
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
50 |
]. |
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
51 |
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
|
52 |
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
|
53 |
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
|
54 |
^nil |
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
55 |
]. |
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
56 |
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
|
57 |
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
|
58 |
^nil |
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
59 |
]. |
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
60 |
|
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
61 |
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
|
62 |
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
|
63 |
path: dst pathName; |
88 | 64 |
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
|
65 |
execute. |
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
66 |
^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
|
67 |
|
88 | 68 |
"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
|
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 |
|
46
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
71 |
!HGRepository class methodsFor:'utilities'! |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
72 |
|
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
73 |
discover: aStringOrFilename |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
74 |
"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
|
75 |
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
|
76 |
returns nil. |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
77 |
|
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
78 |
Currently, it searches for presence of .hg directory" |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
79 |
|
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
80 |
| f | |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
81 |
f := aStringOrFilename. |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
82 |
f isDirectory ifFalse:[ |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
83 |
f := f directory |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
84 |
]. |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
85 |
[ ( f / '.hg' ) exists ] whileFalse:[ |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
86 |
f isRootDirectory ifTrue:[ ^nil ]. |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
87 |
f := f directory. |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
88 |
]. |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
89 |
^f |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
90 |
|
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
91 |
"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
|
92 |
"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
|
93 |
! ! |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
94 |
|
34 | 95 |
!HGRepository methodsFor:'accessing'! |
96 |
||
105
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
97 |
branches |
106
99be3b5a40da
Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
105
diff
changeset
|
98 |
"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
|
99 |
including closed ones" |
99be3b5a40da
Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
105
diff
changeset
|
100 |
|
105
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
101 |
| current names | |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
102 |
|
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
103 |
current := HGCommand branches |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
104 |
workingDirectory: path pathName; |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
105 |
active: false; |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
106 |
closed: true; |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
107 |
execute. |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
108 |
names := branches collect:[:b|b name]. |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
109 |
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
|
110 |
current do:[:b|b setRepository: self]. |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
111 |
branches addAll: current. |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
112 |
^branches. |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
113 |
|
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
114 |
"Created: / 27-11-2012 / 19:57:23 / 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
|
115 |
"Modified (comment): / 27-11-2012 / 21:31:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
99be3b5a40da
Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
105
diff
changeset
|
116 |
! |
99be3b5a40da
Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
105
diff
changeset
|
117 |
|
145
1b8652185a8f
Added HGRepository>>config.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
115
diff
changeset
|
118 |
config |
1b8652185a8f
Added HGRepository>>config.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
115
diff
changeset
|
119 |
^config |
1b8652185a8f
Added HGRepository>>config.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
115
diff
changeset
|
120 |
|
1b8652185a8f
Added HGRepository>>config.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
115
diff
changeset
|
121 |
"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
|
122 |
! |
1b8652185a8f
Added HGRepository>>config.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
115
diff
changeset
|
123 |
|
106
99be3b5a40da
Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
105
diff
changeset
|
124 |
heads |
99be3b5a40da
Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
105
diff
changeset
|
125 |
"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
|
126 |
|
99be3b5a40da
Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
105
diff
changeset
|
127 |
| ids | |
99be3b5a40da
Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
105
diff
changeset
|
128 |
|
99be3b5a40da
Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
105
diff
changeset
|
129 |
ids := HGCommand heads |
99be3b5a40da
Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
105
diff
changeset
|
130 |
workingDirectory: path pathName; |
99be3b5a40da
Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
105
diff
changeset
|
131 |
execute. |
99be3b5a40da
Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
105
diff
changeset
|
132 |
^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
|
133 |
|
99be3b5a40da
Added support for heads (both repository and per-branch)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
105
diff
changeset
|
134 |
"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
|
135 |
! |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
136 |
|
34 | 137 |
path |
46
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
138 |
"Return path to the repository (directory with .hg store)" |
34 | 139 |
^ path |
140 |
||
46
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
40
diff
changeset
|
141 |
"Modified (comment): / 13-11-2012 / 18:18:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
36 | 142 |
! |
143 |
||
69
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
144 |
pathName |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
145 |
"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
|
146 |
^ path pathName |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
147 |
|
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
148 |
"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
|
149 |
! |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
150 |
|
54
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
151 |
uuid |
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
152 |
"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
|
153 |
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
|
154 |
|
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
155 |
^ uuid |
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
156 |
|
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
157 |
"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
|
158 |
! |
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
159 |
|
36 | 160 |
workingCopy |
161 |
wc isNil ifTrue:[ |
|
162 |
wc := HGWorkingCopy new setRepository: self. |
|
163 |
]. |
|
164 |
^wc |
|
165 |
||
166 |
"Created: / 19-10-2012 / 15:42:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
34 | 167 |
! ! |
168 |
||
40
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
169 |
!HGRepository methodsFor:'accessing-changesets'! |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
170 |
|
69
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
171 |
@ id |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
172 |
^self changesetWithId: id. |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
173 |
|
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
174 |
"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
|
175 |
! |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
176 |
|
40
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
177 |
changesetWithId: id |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
178 |
^changesets changesetWithId: id |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
179 |
|
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
180 |
"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
|
181 |
! ! |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
182 |
|
105
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
183 |
!HGRepository methodsFor:'accessing-private'! |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
184 |
|
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
185 |
branchWithName: name |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
186 |
"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
|
187 |
an exception is raised" |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
188 |
|
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
189 |
^self branchWithName: name ifAbsent:[ |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
190 |
HGNoSuchBranchError newException |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
191 |
parameter: name; |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
192 |
messageText: 'No such branch: ', name; |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
193 |
raiseSignal |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
194 |
] |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
195 |
|
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
196 |
"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
|
197 |
! |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
198 |
|
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
199 |
branchWithName: name ifAbsent: block |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
200 |
|
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
201 |
^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
|
202 |
|
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
203 |
"Created: / 27-11-2012 / 14:31:27 / 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
|
204 |
! ! |
25e8ff9d2a31
Added read-only support for branches.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
103
diff
changeset
|
205 |
|
34 | 206 |
!HGRepository methodsFor:'initialization'! |
207 |
||
208 |
initializeOn: aStringOrFilename |
|
209 |
| p | |
|
210 |
||
211 |
p := aStringOrFilename asFilename. |
|
212 |
p exists ifFalse:[ |
|
213 |
HGRepositoryError raiseSignal: 'Given path does not exists'. |
|
214 |
^nil. |
|
215 |
]. |
|
216 |
p isDirectory ifFalse:[ |
|
217 |
HGRepositoryError raiseSignal: 'Given path is not a directory'. |
|
218 |
^nil. |
|
219 |
]. |
|
220 |
(p / '.hg') isDirectory ifFalse:[ |
|
221 |
HGRepositoryError raiseSignal: 'Given path does not contain a repository (.hg subdir not found - try use #lookup:)'. |
|
222 |
^nil. |
|
223 |
]. |
|
40
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
224 |
path := p. |
55 | 225 |
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
|
226 |
branches := OrderedCollection new. |
145
1b8652185a8f
Added HGRepository>>config.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
115
diff
changeset
|
227 |
uuid := UUID new. |
1b8652185a8f
Added HGRepository>>config.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
115
diff
changeset
|
228 |
config := HGConfig new setRepository: self. |
34 | 229 |
|
230 |
"Created: / 17-10-2012 / 13:35:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
145
1b8652185a8f
Added HGRepository>>config.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
115
diff
changeset
|
231 |
"Modified: / 06-12-2012 / 20:21:40 / 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
|
232 |
! ! |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
233 |
|
57
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
234 |
!HGRepository methodsFor:'operations'! |
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
235 |
|
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
236 |
cloneTo: aStringOrFilename |
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
237 |
"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
|
238 |
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
|
239 |
|
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
240 |
^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
|
241 |
|
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
242 |
"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
|
243 |
! |
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
244 |
|
88 | 245 |
cloneTo: aStringOrFilename update: update |
246 |
"Creates a clone of the receiver into given directory. |
|
247 |
Returns an instance HGRepository representing the clone. |
|
248 |
If update is true, repository working copy is updated, otherwise |
|
249 |
it's left empty" |
|
250 |
||
251 |
^self class clone: path to: aStringOrFilename update: update |
|
252 |
||
253 |
"Created: / 21-11-2012 / 00:21:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
254 |
! |
|
255 |
||
57
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
256 |
pull |
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
257 |
"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
|
258 |
See .hg/hgrc, section path" |
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
259 |
|
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
260 |
HGCommand pull |
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
261 |
workingDirectory: path pathName; |
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
262 |
execute. |
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
263 |
|
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
264 |
"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
|
265 |
! |
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
266 |
|
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
267 |
push |
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
268 |
"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
|
269 |
See .hg/hgrc, section path" |
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
270 |
|
107
c92f7674485e
Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
106
diff
changeset
|
271 |
^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
|
272 |
|
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
273 |
"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
|
274 |
"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
|
275 |
! |
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
276 |
|
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
277 |
push: url |
107
c92f7674485e
Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
106
diff
changeset
|
278 |
"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
|
279 |
|
c92f7674485e
Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
106
diff
changeset
|
280 |
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
|
281 |
|
c92f7674485e
Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
106
diff
changeset
|
282 |
^self push: url force: false |
c92f7674485e
Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
106
diff
changeset
|
283 |
|
c92f7674485e
Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
106
diff
changeset
|
284 |
"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
|
285 |
"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
|
286 |
! |
57
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
287 |
|
107
c92f7674485e
Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
106
diff
changeset
|
288 |
push: urlOrNil force: force |
c92f7674485e
Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
106
diff
changeset
|
289 |
"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
|
290 |
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
|
291 |
of new heads in remote repo), |
c92f7674485e
Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
106
diff
changeset
|
292 |
|
c92f7674485e
Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
106
diff
changeset
|
293 |
See .hg/hgrc, section path" |
c92f7674485e
Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
106
diff
changeset
|
294 |
|
c92f7674485e
Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
106
diff
changeset
|
295 |
HGCommand push |
57
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
296 |
workingDirectory: path pathName; |
107
c92f7674485e
Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
106
diff
changeset
|
297 |
url: urlOrNil; |
c92f7674485e
Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
106
diff
changeset
|
298 |
force: force; |
57
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
299 |
execute. |
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
300 |
|
107
c92f7674485e
Fixed test StXTests>>test_commit_03c
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
106
diff
changeset
|
301 |
"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
|
302 |
! ! |
47b14a8b7eb8
Some hacks to make basic Mercurial commit working
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
55
diff
changeset
|
303 |
|
40
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
304 |
!HGRepository::Changesets class methodsFor:'documentation'! |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
305 |
|
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
306 |
documentation |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
307 |
" |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
308 |
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
|
309 |
|
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
310 |
[author:] |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
311 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
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 |
[instance variables:] |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
314 |
|
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
315 |
[class variables:] |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
316 |
|
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
317 |
[see also:] |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
318 |
|
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
319 |
" |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
320 |
! ! |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
321 |
|
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
322 |
!HGRepository::Changesets class methodsFor:'instance creation'! |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
323 |
|
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
324 |
new |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
325 |
"return an initialized instance" |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
326 |
|
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
327 |
^ self basicNew initialize. |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
328 |
! ! |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
329 |
|
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
330 |
!HGRepository::Changesets methodsFor:'accessing'! |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
331 |
|
69
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
332 |
changesetWithId: idobj |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
333 |
| id xid cs | |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
334 |
|
103
04731ef44417
HGNodeId renamed to HGChangesetId
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
88
diff
changeset
|
335 |
id := idobj asHGChangesetId. |
69
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
336 |
"/Try to translate it... |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
337 |
id hasRevnoOnly ifTrue:[ |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
338 |
xid := revno2nodeIdMap at: id revno ifAbsent:[nil]. |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
339 |
] ifFalse:[ |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
340 |
xid := id. |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
341 |
]. |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
342 |
|
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
343 |
"/Look in cache using xlated id... |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
344 |
cs := changesets at: xid ifAbsent:[ nil ]. |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
345 |
cs notNil ifTrue: [ ^ cs ]. |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
346 |
|
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
347 |
cs := HGCommand log |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
348 |
workingDirectory: repository path asString; |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
349 |
start: (xid ? id) printString; |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
350 |
execute. |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
351 |
"/just to be defensive... |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
352 |
self assert: cs size == 1. |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
353 |
cs do:[:changeset| |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
354 |
changeset setRepository: repository. |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
355 |
changesets at: changeset id put: changeset. |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
356 |
revno2nodeIdMap at: changeset id revno put: changeset id. |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
357 |
]. |
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
358 |
^cs anElement. |
40
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
359 |
|
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
360 |
"Created: / 13-11-2012 / 17:52:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
69
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
361 |
"Modified: / 16-11-2012 / 22:04:52 / 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
|
362 |
! ! |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
363 |
|
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
364 |
!HGRepository::Changesets methodsFor:'initialization'! |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
365 |
|
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
366 |
initialize |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
367 |
"Invoked when a new instance is created." |
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
368 |
|
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
369 |
"/ 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
|
370 |
changesets := Dictionary new. |
69
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
371 |
revno2nodeIdMap := Dictionary new. |
40
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
372 |
|
e3699c0b00f9
Baisc support for changesets (revision log)
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
373 |
"/ 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
|
374 |
|
69
17045d49309f
Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
57
diff
changeset
|
375 |
"Modified: / 16-11-2012 / 21:58:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
34 | 376 |
! ! |
377 |
||
378 |
!HGRepository class methodsFor:'documentation'! |
|
379 |
||
54
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
380 |
version_HG |
115
b1ed2d29054b
version_HG changed to return string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
107
diff
changeset
|
381 |
|
b1ed2d29054b
version_HG changed to return string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
107
diff
changeset
|
382 |
^ '$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
|
383 |
! |
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
384 |
|
34 | 385 |
version_SVN |
55 | 386 |
^ '§Id:: §' |
34 | 387 |
! ! |