pullRequest := 73.
target := '/path/pharo' asFileReference.
myForkName := 'myFork'.
repository := IceRepositoryCreator new location: target; subdirectory:'src'; createRepository.
repository register.
fork := repository remotes detect: [ :remote | remote remoteName = myForkName ].
repository pushRemote: fork.
repository pullRemote: repository origin.
repository checkoutBranch: (SystemVersion current commitHash).
fileTreeRepository := (MCFileTreeRepository new directory: target / #src; yourself).
repositoryGroup := MCRepositoryGroup withRepositories: { fileTreeRepository. MCCacheRepository uniqueInstance. }.
MCWorkingCopy allManagers
select: [ :wc | (wc repositoryGroup repositories reject: [ :repo | repo isCache ]) isEmpty ]
thenDo: [ :wc | wc repositoryGroup: repositoryGroup ].
head := (STONJSON fromString: stonString) at: 'head'.
sshUrl := (head at: #repo) at: 'ssh_url'.
branchName := head at: #ref.
user := (sshUrl withoutPrefix: '
[hidden email]:') withoutSuffix: '/pharo.git'.
fork := repository remotes detect: [ :remote | remote remoteName = user ] ifNone: [
| newFork |
newFork := (IceRemote name: user url: ('
[hidden email]:{1}/pharo.git' format: {user})).
repository addRemote: newFork.
newFork ].
repository fetchFrom: fork.
prMergedBranchName := 'pr', pullRequest asString.
repository createBranch: prMergedBranchName.
repository checkoutBranch: prMergedBranchName.
commit := repository revparse: user, '/', branchName.
bootstrapCommit := repository revparse: (SystemVersion current commitHash).
[ repository backend merge: commit id ]
on: IceMergeAborted
do: [ :error | repository mergeConflictsWith: commit ] .
headCommit := repository revparse: 'HEAD'.
browser := GLMTabulator new.
browser row: [:row | row column: #commits span: 2; column: #changes span: 3]; row: #diff.
browser transmit to: #commits.
browser transmit to: #changes; from: #commits; andShow: [ :a :commitInfo |
(IceDiffChangeTreeBuilder new entity: commitInfo; diff: (IceDiff from: commitInfo to: bootstrapCommit); buildOn: a) title: 'Changes'. ].
browser transmit from: #commits; from: #changes; to: #diff; andShow: [ :a |
a diff title: 'Left: working copy / Right: incoming updates'; display: [ :commitInfo :change |
{ change theirVersion ifNil: ''. change myVersion ifNil: ''. }]].
browser openOn: {headCommit}.
The merge operation only changes the Git working copy, no code is loaded into the image. If you want to test the PR code, currently you need to open Iceberg and reload all packages in the Pharo repository (Packages tab, Reload all)