Skip to content

Commit 27ff34c

Browse files
committed
Issue #37: ... like the content, but I think that the --preview is too verbose ... need to easily ideify the things that are going to change
1 parent 417768b commit 27ff34c

2 files changed

Lines changed: 67 additions & 16 deletions

File tree

bin/cloneProjectsFromProjectSet.solo

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ usage
1414
USAGE $basename [--help | -h] [--debug | -D] [--debugGem] \
1515
[--registry=<registry-name> | -r <registry-name>] \
1616
--projectSet=<projectSet-name> [--projectDirectory=<project-directory>] \
17-
[project-name]
17+
[--update | --preview] [project-name]
1818

1919
DESCRIPTION
2020
A project set is a list of load specs that specify a group of git repositories that are managed together.
2121

22+
23+
PREVIEW git CLONE commands for each
2224
CLONE git commands for each project
2325
git clone <project-url>
2426
git checkout -B remote/revision

src/GsDevKit_stones-Core.package/GDKProjectSet.class/instance/cloneOrUpdateProject.remoteName.in.preview.pull..st

Lines changed: 64 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,23 @@ cloneOrUpdateProject: projectDirName remoteName: remoteName in: gitRootPath prev
3939
(Rowan gitTools gitstatusIn: gitProjectRef fullName with: '--porcelain') isEmpty
4040
not
4141
ifTrue: [
42-
"the git repository has unsaved modifications, so abort the operation"
43-
self
44-
error:
45-
'There are unsaved changes in ' , gitProjectRef fullName printString
46-
, '. We cannot clone or update a repository with unsaved changes' ] ]
42+
| message |
43+
message := 'There are unsaved changes in '
44+
, gitProjectRef fullName printString
45+
,
46+
'. We WILL NOT switch, clone or update a repository with unsaved changes. Please CLEAN up your unsaved changes.'.
47+
preview
48+
ifTrue: [
49+
stdout
50+
cr;
51+
nextPutAll: '***************************';
52+
cr;
53+
nextPutAll: message;
54+
cr;
55+
nextPutAll: '***************************' ]
56+
ifFalse: [
57+
"the git repository has unsaved modifications, so abort the operation"
58+
self error: message ] ] ]
4759
ifFalse: [
4860
| originArg dirNameArg |
4961
"GIT CLONE"
@@ -86,11 +98,26 @@ cloneOrUpdateProject: projectDirName remoteName: remoteName in: gitRootPath prev
8698
in: gitProjectRef fullName
8799
with: ' ' , remoteName , '/' , revision , ' -t -C ' , revision) ]
88100
ifFalse: [
101+
| currentBranchName |
102+
currentBranchName := Rowan gitTools gitBranchNameIn: gitProjectRef fullName.
89103
pull
90104
ifTrue: [
91105
"GIT FETCH
92106
GIT SWITCH
93107
GIT PULL"
108+
revision = currentBranchName
109+
ifTrue: [
110+
stdout
111+
cr;
112+
nextPutAll: '=======================';
113+
cr;
114+
nextPutAll: '=======================' ]
115+
ifFalse: [
116+
stdout
117+
cr;
118+
nextPutAll: '***************************';
119+
cr;
120+
nextPutAll: '***************************' ].
94121
stdout
95122
cr;
96123
tab;
@@ -118,23 +145,40 @@ cloneOrUpdateProject: projectDirName remoteName: remoteName in: gitRootPath prev
118145
stdout
119146
cr;
120147
nextPutAll:
121-
(gitTool gitpullIn: gitProjectRef fullName remote: remoteName branch: revision) ]
122-
ifFalse: [
123-
preview
148+
(gitTool gitpullIn: gitProjectRef fullName remote: remoteName branch: revision).
149+
revision = currentBranchName
124150
ifTrue: [
125-
| currentBranchName |
126-
currentBranchName := Rowan gitTools
127-
gitBranchNameIn: gitProjectRef fullName.
128151
stdout
129152
cr;
130-
nextPutAll: 'Current BRANCHNAME: ' , currentBranchName.
153+
nextPutAll: '=======================';
154+
cr;
155+
nextPutAll: '=======================' ]
156+
ifFalse: [
157+
stdout
158+
cr;
159+
nextPutAll: '***************************';
160+
cr;
161+
nextPutAll: '***************************' ] ]
162+
ifFalse: [
163+
preview
164+
ifTrue: [
131165
revision = currentBranchName
132166
ifTrue: [
133167
stdout
134168
cr;
135-
nextPutAll: 'PREVIEW:: FETCH and PULL ' , currentBranchName ]
169+
nextPutAll: '=======================';
170+
cr;
171+
nextPutAll: 'Current BRANCHNAME: ' , currentBranchName;
172+
cr;
173+
nextPutAll: 'PREVIEW:: FETCH and PULL ' , currentBranchName;
174+
cr;
175+
nextPutAll: '=======================' ]
136176
ifFalse: [
137177
stdout
178+
cr;
179+
nextPutAll: '***************************';
180+
cr;
181+
nextPutAll: 'Current BRANCHNAME: ' , currentBranchName;
138182
cr;
139183
nextPutAll: '------ Preview FETCH,';
140184
cr;
@@ -144,7 +188,9 @@ cloneOrUpdateProject: projectDirName remoteName: remoteName in: gitRootPath prev
144188
cr;
145189
tab;
146190
nextPutAll: ' and PULL';
147-
nextPutAll: ' ' , revision ] ] ] ] ].
191+
nextPutAll: ' ' , revision;
192+
cr;
193+
nextPutAll: '***************************' ] ] ] ] ].
148194
cloned
149195
ifTrue: [
150196
"GIT REMOTE ADD"
@@ -153,7 +199,8 @@ cloneOrUpdateProject: projectDirName remoteName: remoteName in: gitRootPath prev
153199
self
154200
gitAddRemoteIn: gitProjectRef fullName
155201
remote: theRemote
156-
gitUrl: (gitUrls at: theRemote) ]. "GIT FETCH --all"
202+
gitUrl: (gitUrls at: theRemote) ]. "
203+
GIT FETCH --all"
157204
stdout
158205
cr;
159206
tab;
@@ -169,6 +216,8 @@ cloneOrUpdateProject: projectDirName remoteName: remoteName in: gitRootPath prev
169216
cr;
170217
nextPutAll: '==========';
171218
cr;
219+
nextPutAll: 'End ' , gitProjectRef basename printString;
220+
cr;
172221
nextPutAll: '==========';
173222
cr.
174223
wasTracing

0 commit comments

Comments
 (0)