author | Patrik Svestka <patrik.svestka@gmail.com> |
Tue, 13 Nov 2018 15:43:08 +0100 | |
changeset 864 | c854577212b8 |
parent 605 | 96fd9746c9ed |
child 914 | 04391080b32d |
permissions | -rw-r--r-- |
864
c854577212b8
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
605
diff
changeset
|
1 |
"{ Encoding: utf8 }" |
c854577212b8
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
605
diff
changeset
|
2 |
|
210 | 3 |
" |
335
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
4 |
stx:libscm - a new source code management library for Smalltalk/X |
509
f92210d4585b
Updated copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
396
diff
changeset
|
5 |
Copyright (C) 2012-2015 Jan Vrany |
335
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
6 |
|
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
7 |
This library is free software; you can redistribute it and/or |
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
8 |
modify it under the terms of the GNU Lesser General Public |
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
9 |
License as published by the Free Software Foundation; either |
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
10 |
version 2.1 of the License. |
210 | 11 |
|
335
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
12 |
This library is distributed in the hope that it will be useful, |
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
15 |
Lesser General Public License for more details. |
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
16 |
|
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
17 |
You should have received a copy of the GNU Lesser General Public |
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
18 |
License along with this library; if not, write to the Free Software |
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
19 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
210 | 20 |
" |
46
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff
changeset
|
21 |
"{ Package: 'stx:libscm/mercurial' }" |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff
changeset
|
22 |
|
605
96fd9746c9ed
Fix in HGPackageWorkingCopyRegistry>>flush: on Windows, just give up if temporary working copy could not be removed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
509
diff
changeset
|
23 |
"{ NameSpace: Smalltalk }" |
96fd9746c9ed
Fix in HGPackageWorkingCopyRegistry>>flush: on Windows, just give up if temporary working copy could not be removed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
509
diff
changeset
|
24 |
|
396
3c9d047e3841
Introduced a SCMAbstractPackageWorkingCopy and SCMAbstractPackageRevision...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
335
diff
changeset
|
25 |
SCMAbstractPackageWorkingCopyRegistry subclass:#HGPackageWorkingCopyRegistry |
46
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff
changeset
|
26 |
instanceVariableNames:'' |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff
changeset
|
27 |
classVariableNames:'' |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff
changeset
|
28 |
poolDictionaries:'' |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff
changeset
|
29 |
category:'SCM-Mercurial-StX' |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff
changeset
|
30 |
! |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff
changeset
|
31 |
|
396
3c9d047e3841
Introduced a SCMAbstractPackageWorkingCopy and SCMAbstractPackageRevision...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
335
diff
changeset
|
32 |
!HGPackageWorkingCopyRegistry class methodsFor:'documentation'! |
210 | 33 |
|
34 |
copyright |
|
35 |
" |
|
335
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
36 |
stx:libscm - a new source code management library for Smalltalk/X |
509
f92210d4585b
Updated copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
396
diff
changeset
|
37 |
Copyright (C) 2012-2015 Jan Vrany |
335
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
38 |
|
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
39 |
This library is free software; you can redistribute it and/or |
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
40 |
modify it under the terms of the GNU Lesser General Public |
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
41 |
License as published by the Free Software Foundation; either |
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
42 |
version 2.1 of the License. |
210 | 43 |
|
335
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
44 |
This library is distributed in the hope that it will be useful, |
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
45 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
46 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
47 |
Lesser General Public License for more details. |
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
48 |
|
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
49 |
You should have received a copy of the GNU Lesser General Public |
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
50 |
License along with this library; if not, write to the Free Software |
7e19ab19148b
Changed license to LGPL2.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
297
diff
changeset
|
51 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
210 | 52 |
" |
53 |
! ! |
|
46
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff
changeset
|
54 |
|
396
3c9d047e3841
Introduced a SCMAbstractPackageWorkingCopy and SCMAbstractPackageRevision...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
335
diff
changeset
|
55 |
!HGPackageWorkingCopyRegistry methodsFor:'accessing'! |
46
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff
changeset
|
56 |
|
270
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
57 |
packageNamed0:package |
123
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
58 |
"Returns a HGPackageModel for given package or nil |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
59 |
if given package is not backed by Mercurial repository." |
46
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff
changeset
|
60 |
|
296
f7824c40a07e
Bugfix for creating new subpackage inside existing package (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
270
diff
changeset
|
61 |
| dir components names namei directories root rootI rootD pkg| |
46
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff
changeset
|
62 |
|
123
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
63 |
packages at: package ifPresent: [ :p | ^ p ]. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
64 |
|
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
65 |
components := OrderedCollection new. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
66 |
names := OrderedCollection new. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
67 |
|
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
68 |
(package includes: $:) ifFalse:[ |
297
0f36d2c091e9
Fix in HGPackageModelRegistry>>#packageNamed0: for top-level packages...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
296
diff
changeset
|
69 |
components := Array with: package. |
0f36d2c091e9
Fix in HGPackageModelRegistry>>#packageNamed0: for top-level packages...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
296
diff
changeset
|
70 |
names := Array with: package. |
123
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
71 |
] ifTrue:[ |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
72 |
| i1 i2 | |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
73 |
|
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
74 |
i1 := 1. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
75 |
i2 := package indexOf: $:. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
76 |
|
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
77 |
components add: (package copyFrom: i1 to: i2 - 1). |
124
7802d185b2c3
HGPackageModelRegistry fixed (compiles now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
123
diff
changeset
|
78 |
names add: (package copyFrom: 1 to: i2 - 1). |
123
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
79 |
|
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
80 |
i1 := i2 + 1. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
81 |
[ (i2 := package indexOf: $/ startingAt: i1) ~~ 0 ] whileTrue:[ |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
82 |
components add: (package copyFrom: i1 to: i2 - 1). |
124
7802d185b2c3
HGPackageModelRegistry fixed (compiles now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
123
diff
changeset
|
83 |
names add: (package copyFrom: 1 to: i2 - 1). |
123
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
84 |
i1 := i2 + 1. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
85 |
]. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
86 |
|
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
87 |
components add: (package copyFrom: i1 ). |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
88 |
names add: package |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
89 |
|
46
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff
changeset
|
90 |
]. |
296
f7824c40a07e
Bugfix for creating new subpackage inside existing package (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
270
diff
changeset
|
91 |
|
f7824c40a07e
Bugfix for creating new subpackage inside existing package (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
270
diff
changeset
|
92 |
"Package might be sub-package which may not exists. Search for some |
f7824c40a07e
Bugfix for creating new subpackage inside existing package (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
270
diff
changeset
|
93 |
existing packagedir along package hierarchy" |
f7824c40a07e
Bugfix for creating new subpackage inside existing package (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
270
diff
changeset
|
94 |
namei := names size. |
f7824c40a07e
Bugfix for creating new subpackage inside existing package (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
270
diff
changeset
|
95 |
[ dir isNil and: [ namei > 0 ] ] whileTrue:[ |
f7824c40a07e
Bugfix for creating new subpackage inside existing package (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
270
diff
changeset
|
96 |
dir := Smalltalk getPackageDirectoryForPackage: (names at: namei). |
f7824c40a07e
Bugfix for creating new subpackage inside existing package (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
270
diff
changeset
|
97 |
dir notNil ifTrue:[ |
f7824c40a07e
Bugfix for creating new subpackage inside existing package (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
270
diff
changeset
|
98 |
namei + 1 to: names size do:[:i| |
f7824c40a07e
Bugfix for creating new subpackage inside existing package (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
270
diff
changeset
|
99 |
dir := dir / (components at: i). |
f7824c40a07e
Bugfix for creating new subpackage inside existing package (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
270
diff
changeset
|
100 |
]. |
f7824c40a07e
Bugfix for creating new subpackage inside existing package (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
270
diff
changeset
|
101 |
]. |
f7824c40a07e
Bugfix for creating new subpackage inside existing package (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
270
diff
changeset
|
102 |
namei := namei - 1. |
f7824c40a07e
Bugfix for creating new subpackage inside existing package (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
270
diff
changeset
|
103 |
]. |
f7824c40a07e
Bugfix for creating new subpackage inside existing package (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
270
diff
changeset
|
104 |
dir isNil ifTrue:[ ^ nil ]. |
f7824c40a07e
Bugfix for creating new subpackage inside existing package (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
270
diff
changeset
|
105 |
|
123
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
106 |
directories := Array new: components size. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
107 |
directories at: components size put: dir. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
108 |
directories size - 1 downTo: 1 do:[:i| |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
109 |
directories at: i put: (directories at: i + 1) directory. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
110 |
]. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
111 |
|
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
112 |
"/ search cached packages... |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
113 |
1 to: names size do:[:i| |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
114 |
packages at: (names at:i) ifPresent:[:p|root := p. rootI := i]. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
115 |
]. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
116 |
root isNil ifTrue:[ |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
117 |
directories withIndexDo:[:each :eachI| |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
118 |
( each / '.hg' ) exists ifTrue:[ |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
119 |
rootD := each. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
120 |
rootI := eachI. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
121 |
]. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
122 |
]. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
123 |
rootD isNil ifTrue:[ ^ nil ]. |
396
3c9d047e3841
Introduced a SCMAbstractPackageWorkingCopy and SCMAbstractPackageRevision...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
335
diff
changeset
|
124 |
root := HGPackageWorkingCopy new |
123
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
125 |
setName: (names at: rootI) |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
126 |
repository: (HGRepository on: rootD). |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
127 |
packages at: root name put: root. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
128 |
]. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
129 |
pkg := root. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
130 |
rootI + 1 to: components size do:[:each| |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
131 |
pkg := pkg construct: (components at:each). |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
132 |
packages at: pkg name put: pkg. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
133 |
]. |
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
134 |
|
ee1cc926f489
Added parent/child relationship to SCMAbstractPackageModel (part 2)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
118
diff
changeset
|
135 |
^pkg |
46
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff
changeset
|
136 |
|
270
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
137 |
"Created: / 18-03-2013 / 22:26:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
396
3c9d047e3841
Introduced a SCMAbstractPackageWorkingCopy and SCMAbstractPackageRevision...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
335
diff
changeset
|
138 |
"Modified: / 05-03-2014 / 21:45:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
270
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
139 |
! |
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
140 |
|
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
141 |
packageNamed:package |
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
142 |
"Returns a HGPackageModel for given package or nil |
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
143 |
if given package is not backed by Mercurial repository." |
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
144 |
|
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
145 |
| pkg idx | |
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
146 |
|
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
147 |
pkg := self packageNamed0: package. |
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
148 |
pkg notNil ifTrue:[ ^ pkg ]. |
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
149 |
idx := package lastIndexOf: $/. |
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
150 |
idx == 0 ifTrue:[ |
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
151 |
idx := package lastIndexOf: $:. |
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
152 |
]. |
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
153 |
idx ~~ 0 ifTrue:[ |
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
154 |
pkg := self packageNamed0: (package copyTo: idx - 1). |
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
155 |
pkg notNil ifTrue:[ |
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
156 |
pkg := pkg construct: (package copyFrom: idx + 1). |
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
157 |
packages at: pkg name put: pkg. |
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
158 |
^pkg. |
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
159 |
] |
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
160 |
]. |
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
161 |
^nil. |
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
162 |
|
46
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff
changeset
|
163 |
"Created: / 14-11-2012 / 00:15:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
270
fefcd7551c36
Correctly set path within repository for subpackages even if the subpackage does not yet exists.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
218
diff
changeset
|
164 |
"Modified: / 18-03-2013 / 22:41:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
46
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff
changeset
|
165 |
! ! |
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff
changeset
|
166 |
|
396
3c9d047e3841
Introduced a SCMAbstractPackageWorkingCopy and SCMAbstractPackageRevision...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
335
diff
changeset
|
167 |
!HGPackageWorkingCopyRegistry methodsFor:'initialization'! |
93
2579830f6b61
Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
69
diff
changeset
|
168 |
|
2579830f6b61
Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
69
diff
changeset
|
169 |
flush: pattern |
2579830f6b61
Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
69
diff
changeset
|
170 |
"Flushes all cached data packages matching given name." |
2579830f6b61
Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
69
diff
changeset
|
171 |
| toFlush | |
2579830f6b61
Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
69
diff
changeset
|
172 |
toFlush := OrderedCollection new. |
2579830f6b61
Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
69
diff
changeset
|
173 |
packages valuesDo:[:package| |
2579830f6b61
Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
69
diff
changeset
|
174 |
(package name matches: pattern) ifTrue:[toFlush add: package]]. |
2579830f6b61
Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
69
diff
changeset
|
175 |
toFlush do:[:package| |
96
7a0ecabf712b
HGPackageModelRegistry>>flush: fix for Windows.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
93
diff
changeset
|
176 |
| wcdir | |
93
2579830f6b61
Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
69
diff
changeset
|
177 |
repositories removeKey: package repository path ifAbsent:[nil]. |
218
8d975bd9fe4f
Bugfix in HGPackageModelRegistry class>>flush: and pull command output parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
210
diff
changeset
|
178 |
wcdir := package temporaryWorkingCopyPath. |
8d975bd9fe4f
Bugfix in HGPackageModelRegistry class>>flush: and pull command output parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
210
diff
changeset
|
179 |
wcdir exists ifTrue:[ |
8d975bd9fe4f
Bugfix in HGPackageModelRegistry class>>flush: and pull command output parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
210
diff
changeset
|
180 |
[ wcdir recursiveRemove ] on: Error do:[ |
8d975bd9fe4f
Bugfix in HGPackageModelRegistry class>>flush: and pull command output parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
210
diff
changeset
|
181 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
8d975bd9fe4f
Bugfix in HGPackageModelRegistry class>>flush: and pull command output parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
210
diff
changeset
|
182 |
Delay waitForSeconds: 1. |
605
96fd9746c9ed
Fix in HGPackageWorkingCopyRegistry>>flush: on Windows, just give up if temporary working copy could not be removed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
509
diff
changeset
|
183 |
[ wcdir recursiveRemove ] on: Error do:[ |
96fd9746c9ed
Fix in HGPackageWorkingCopyRegistry>>flush: on Windows, just give up if temporary working copy could not be removed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
509
diff
changeset
|
184 |
"/ Sigh, just give up on this stupid system. |
96fd9746c9ed
Fix in HGPackageWorkingCopyRegistry>>flush: on Windows, just give up if temporary working copy could not be removed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
509
diff
changeset
|
185 |
] |
218
8d975bd9fe4f
Bugfix in HGPackageModelRegistry class>>flush: and pull command output parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
210
diff
changeset
|
186 |
]. |
96
7a0ecabf712b
HGPackageModelRegistry>>flush: fix for Windows.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
93
diff
changeset
|
187 |
]. |
7a0ecabf712b
HGPackageModelRegistry>>flush: fix for Windows.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
93
diff
changeset
|
188 |
]. |
93
2579830f6b61
Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
69
diff
changeset
|
189 |
packages removeKey: package name |
2579830f6b61
Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
69
diff
changeset
|
190 |
]. |
2579830f6b61
Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
69
diff
changeset
|
191 |
|
2579830f6b61
Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
69
diff
changeset
|
192 |
"Created: / 16-11-2012 / 19:40:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
218
8d975bd9fe4f
Bugfix in HGPackageModelRegistry class>>flush: and pull command output parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
210
diff
changeset
|
193 |
"Modified: / 05-02-2013 / 09:28:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
605
96fd9746c9ed
Fix in HGPackageWorkingCopyRegistry>>flush: on Windows, just give up if temporary working copy could not be removed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
509
diff
changeset
|
194 |
"Modified: / 01-03-2016 / 19:52:09 / jv" |
93
2579830f6b61
Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
69
diff
changeset
|
195 |
! ! |
2579830f6b61
Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
69
diff
changeset
|
196 |
|
396
3c9d047e3841
Introduced a SCMAbstractPackageWorkingCopy and SCMAbstractPackageRevision...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
335
diff
changeset
|
197 |
!HGPackageWorkingCopyRegistry class methodsFor:'documentation'! |
46
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff
changeset
|
198 |
|
54
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
199 |
version_HG |
115
b1ed2d29054b
version_HG changed to return string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
96
diff
changeset
|
200 |
|
b1ed2d29054b
version_HG changed to return string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
96
diff
changeset
|
201 |
^ '$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
|
202 |
! |
66045198bfbc
More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
46
diff
changeset
|
203 |
|
46
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff
changeset
|
204 |
version_SVN |
864
c854577212b8
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
Patrik Svestka <patrik.svestka@gmail.com>
parents:
605
diff
changeset
|
205 |
^ '§Id:: §' |
46
d5a192b11a1a
- More Smalltalk/X support
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff
changeset
|
206 |
! ! |
210 | 207 |