author | vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177 |
Tue, 13 Nov 2012 11:06:16 +0000 | |
changeset 39 | 10e693b3e034 |
parent 38 | c3d02ed6a645 |
child 54 | 66045198bfbc |
permissions | -rw-r--r-- |
34 | 1 |
"{ Package: 'stx:libscm/mercurial' }" |
2 |
||
3 |
Object subclass:#HGWorkingCopyFile |
|
4 |
instanceVariableNames:'wc children filename' |
|
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'GitStatusCodes' |
|
7 |
category:'SCM-Mercurial-Core' |
|
8 |
! |
|
9 |
||
10 |
||
11 |
!HGWorkingCopyFile class methodsFor:'instance creation'! |
|
12 |
||
13 |
wc: aGitWorkingCopy path: aStringOrFilename |
|
14 |
^self new setWorkingCopy: aGitWorkingCopy path: aStringOrFilename |
|
15 |
||
16 |
"Created: / 24-09-2012 / 13:52:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
17 |
! ! |
|
18 |
||
19 |
!HGWorkingCopyFile methodsFor:'accessing'! |
|
20 |
||
39
10e693b3e034
- Support for commit
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
38
diff
changeset
|
21 |
pathName |
10e693b3e034
- Support for commit
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
38
diff
changeset
|
22 |
^filename pathName |
10e693b3e034
- Support for commit
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
38
diff
changeset
|
23 |
|
10e693b3e034
- Support for commit
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
38
diff
changeset
|
24 |
"Created: / 12-11-2012 / 22:43:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10e693b3e034
- Support for commit
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
38
diff
changeset
|
25 |
! |
10e693b3e034
- Support for commit
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
38
diff
changeset
|
26 |
|
34 | 27 |
pathNameRelative |
28 |
^self == wc root |
|
29 |
ifTrue:[wc root pathName] |
|
30 |
ifFalse:[filename pathName copyFrom: (wc root pathName size + 2)] |
|
31 |
||
32 |
"Created: / 25-09-2012 / 00:28:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
33 |
! |
|
34 |
||
35 |
status |
|
38
c3d02ed6a645
- HGWorkingCopyFile
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
36 |
| cmd statuses | |
36 | 37 |
|
38 |
cmd := HGCommand status. |
|
38
c3d02ed6a645
- HGWorkingCopyFile
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
39 |
cmd workingDirectory: filename directory. |
36 | 40 |
cmd path: filename pathName. |
38
c3d02ed6a645
- HGWorkingCopyFile
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
41 |
statuses := cmd execute. |
c3d02ed6a645
- HGWorkingCopyFile
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
42 |
self assert: statuses size == 1. |
c3d02ed6a645
- HGWorkingCopyFile
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
43 |
self assert: statuses first second = filename baseName. |
c3d02ed6a645
- HGWorkingCopyFile
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
44 |
^statuses first first. |
34 | 45 |
|
46 |
"Created: / 24-09-2012 / 22:27:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
38
c3d02ed6a645
- HGWorkingCopyFile
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
36
diff
changeset
|
47 |
"Modified: / 09-11-2012 / 12:09:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
34 | 48 |
! ! |
49 |
||
50 |
!HGWorkingCopyFile methodsFor:'delegating'! |
|
51 |
||
52 |
doesNotUnderstand: aMessage |
|
53 |
||
54 |
^(filename respondsTo: aMessage selector) ifTrue:[ |
|
55 |
aMessage sendTo: filename |
|
56 |
] ifFalse:[ |
|
57 |
super doesNotUnderstand: aMessage |
|
58 |
]. |
|
59 |
||
60 |
"Created: / 24-09-2012 / 13:46:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
61 |
! ! |
|
62 |
||
63 |
!HGWorkingCopyFile methodsFor:'initialization'! |
|
64 |
||
65 |
setWorkingCopy: aHGWorkingCopy path: aStringOrFilename |
|
66 |
||
67 |
wc := aHGWorkingCopy. |
|
68 |
filename := aStringOrFilename asFilename. |
|
69 |
||
70 |
"Created: / 24-09-2012 / 13:53:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
71 |
! ! |
|
72 |
||
73 |
!HGWorkingCopyFile methodsFor:'instance creation'! |
|
74 |
||
75 |
/ aString |
|
76 |
^self construct: aString |
|
77 |
||
78 |
"Created: / 24-09-2012 / 13:49:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
79 |
! |
|
80 |
||
81 |
construct: aString |
|
82 |
^(aString includes: Filename separator) ifTrue:[ |
|
83 |
self components: (aString tokensBasedOn: Filename separator) |
|
84 |
] ifFalse:[ |
|
85 |
self component: aString |
|
86 |
] |
|
87 |
||
88 |
"Created: / 24-09-2012 / 13:50:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
89 |
! ! |
|
90 |
||
91 |
!HGWorkingCopyFile methodsFor:'instance creation-private'! |
|
92 |
||
93 |
component: aString |
|
94 |
children isNil ifTrue: [ children := Dictionary new ]. |
|
95 |
^children |
|
96 |
at: aString |
|
97 |
ifAbsentPut:[HGWorkingCopyFile wc: wc path: (filename construct: aString)] |
|
98 |
||
99 |
"Created: / 24-09-2012 / 23:26:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
100 |
"Modified: / 17-10-2012 / 13:50:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
101 |
! |
|
102 |
||
103 |
components: anArray"OfStrings" |
|
104 |
^anArray inject: self into:[:entry :name | entry component: name ] |
|
105 |
||
106 |
"Created: / 24-09-2012 / 23:25:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
107 |
! ! |
|
108 |
||
109 |
!HGWorkingCopyFile methodsFor:'printing & storing'! |
|
110 |
||
111 |
printOn:aStream |
|
112 |
"append a printed representation if the receiver to the argument, aStream" |
|
113 |
||
114 |
| path | |
|
115 |
||
116 |
aStream nextPut:$[. |
|
117 |
path := filename pathName. |
|
118 |
path := path copyFrom: wc path pathName size + 1. |
|
119 |
aStream nextPutAll: path. |
|
120 |
aStream nextPut:$]. |
|
121 |
||
122 |
"Modified: / 17-10-2012 / 13:51:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
123 |
! ! |
|
124 |
||
36 | 125 |
!HGWorkingCopyFile methodsFor:'testing'! |
126 |
||
127 |
isAdded |
|
128 |
^ self status isAdded |
|
129 |
||
130 |
"Modified: / 23-10-2012 / 11:13:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
131 |
! |
|
132 |
||
133 |
isClean |
|
134 |
^ self status isClean |
|
135 |
||
136 |
"Modified: / 23-10-2012 / 11:13:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
137 |
! |
|
138 |
||
139 |
isIgnored |
|
140 |
^ self status isIgnored |
|
141 |
||
142 |
"Modified: / 23-10-2012 / 11:13:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
143 |
! |
|
144 |
||
145 |
isMissing |
|
146 |
^ self status isMissing |
|
147 |
||
148 |
"Modified: / 23-10-2012 / 11:12:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
149 |
! |
|
150 |
||
151 |
isModified |
|
152 |
^ self status isModified |
|
153 |
||
154 |
"Modified: / 23-10-2012 / 11:13:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
155 |
! |
|
156 |
||
157 |
isNotTracked |
|
158 |
^ self status isNotTracked |
|
159 |
||
160 |
"Modified: / 23-10-2012 / 11:13:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
161 |
! |
|
162 |
||
163 |
isRemoved |
|
164 |
^ self status isRemoved |
|
165 |
||
166 |
"Modified: / 23-10-2012 / 11:13:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
167 |
! ! |
|
168 |
||
34 | 169 |
!HGWorkingCopyFile class methodsFor:'documentation'! |
170 |
||
171 |
version_SVN |
|
172 |
^ '$Id:: $' |
|
173 |
! ! |