Skip to content

Commit

Permalink
adjust the logic when doing a second update on a project --> the bran…
Browse files Browse the repository at this point in the history
…ch already exists
  • Loading branch information
dalehenrich committed Sep 30, 2023
1 parent 733a537 commit 8273b0d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
11 changes: 11 additions & 0 deletions bin/cloneProjectsFromProjectSet.solo
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ USAGE $basename [--help | -h] [--debug | -D] [--debugGem] registry=<registry-na
DESCRIPTION
A project set is a list of load specs that specify a group of git repositories that are managed together.

CLONE git commands for each project
git clone <project-url>
git checkout -B remote/revision
git remote add remote <additional-project-project-urls>
git fetch --all

UPDATE git commands for each project
git checkout remote/revision
git pull remote revision


OPTIONS
-h, --help display usage message
-D, --debug bring up topaz debugger in the event of a script error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ cloneOrUpdateProject: projectName remoteName: remoteName in: gitRootPath pull: p
'There are unsaved changes in ' , gitProjectRef fullName printString
, '. We cannot clone or update a repository with unsaved chnages' ] ]
ifFalse: [
"GIT CLONE"
gitTool gitcloneIn: gitRootPath with: origin logging: true.
cloned := true ].
(specDict at: 'revision' ifAbsent: [ ])
Expand All @@ -29,13 +30,27 @@ cloneOrUpdateProject: projectName remoteName: remoteName in: gitRootPath pull: p
cr;
show: ' Set ' , projectName , ' revision to ' , revision.
cloned
ifTrue: [ gitTool gitcheckoutIn: gitProjectRef with: ' -B ' , remoteName , '/' , revision ]
ifTrue: [
"GIT CHECKOUT -B"
gitTool
gitcheckoutIn: gitProjectRef
with: ' -B ' , remoteName , '/' , revision ]
ifFalse: [
"GIT CHECKOUT -b"
[
gitTool
gitcheckoutIn: gitProjectRef
with: ' -b ' , revision , ' ' , remoteName , '/' , revision ].
with: ' -b ' , revision , ' ' , remoteName , '/' , revision ]
on: Error
do: [ :ex |
"assume that the branch already exists, and try again without -b option"
Transcript
cr;
show: 'assume branch ' , revision , ' already exists. Tryig again'.
gitTool gitcheckoutIn: gitProjectRef with: revision ] ].
pull
ifTrue: [
"GIT PULL"
Transcript
cr;
show:
Expand All @@ -46,12 +61,13 @@ cloneOrUpdateProject: projectName remoteName: remoteName in: gitRootPath pull: p
branch: revision ] ].
cloned
ifTrue: [
"GIT REMOTE ADD"
(gitUrls keys reject: [ :each | each = remoteName ])
do: [ :theRemote |
self
gitAddRemoteIn: gitProjectRef fullName
remote: theRemote
gitUrl: (gitUrls at: theRemote) ].
gitUrl: (gitUrls at: theRemote) ]. "GIT FETCH --all"
Transcript
cr;
show: ' Fetch --all '.
Expand Down

0 comments on commit 8273b0d

Please sign in to comment.