[Pharo-dev] iceberg: merging branches just at the git level without changing code in the image

Andrei Chis chisvasileandrei at gmail.com
Mon Feb 4 12:18:34 EST 2019


Hi,

Currently in Iceberg to merge a branch into another, we need to checkout
the branch into which we want to merge and then do the merge.
Checking out a branch also updates the code in the image, which when
needing to perform automatic releases on a branch can cause issues.

Is there already a way in Iceberg to switch to a branch (for example
`release`) and then merge another branch (for example `master`) into it
without updating any code in the image?
The use-case is that the user is on the `master` branch and needs to merge
`master` into `release` without changing any code in the image.

I found LGitRepository>>#merge:, but it seems not to be used anywhere in
the image.

Another way would be to implement something like the method below. This:
  - calculates what changes need to be merged
  - always takes what is on the left branch (in this case what is on master
overrides what is on release)
  - does not call loadChangesInWorkingCopy: to update the working copy as
the code is already in the image
  - refreshes the dirty packages in case there are changes between what is
on the image and what is on disk

```
IceMerge>>#executeWithAcceptingLeftOnConflictAndWithoutImageUpdate
| commitToAdvance |
mergeCommit validateCanMerge.
self isAlreadyMerged ifTrue: [ ^ self ].

self calculateChanges.
self conflictsDo: [ :operation |
operation selectLeft.
].
commitToAdvance := self updateHead.
        "Do not update the working copy"
"repository workingCopy loadChangesInWorkingCopy: self
changesToWorkingCopyTree."
repository workingCopy refreshDirtyPackages.
^ commitToAdvance
```

Could something like the above solution work? Or are there other issues to
take into account?

Cheers,
Andrei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20190204/61448d88/attachment.html>


More information about the Pharo-dev mailing list