Support rebasing local changes on top of master/incoming changes #737
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently we
Merge
master changes into local changes of a briefcase when we dopullMerge
. This method of change integration is very inflexible. It was decided way back we needed to move away from it to a more robust method that is more flexible and stable and works with editing workflows.Change integration can be done using following two methods
Sqlite allow both but its "Merge" does not work the same way as let's say git merge works. The whole method of merge is flawed in different ways as highlighted below. For example, there is not any merged changeset instead we have a rebase buffer that records decisions and then applies to the outgoing changeset which can cause some local changes to be lost altogether.
Merge
Merge
goes as followsunion
of two ranges mainly due to the merge ignoring local change when there was a conflict for that row when merging incoming changes. This lead to this PR as we cannot do anything meaningful with the current change integration strategy when we actively need to do some sort of merging or conflict resolution.Pros
None that I know other than it can be faster as master changes are applied on top of local changes.
Cons
Rebase
An alternate method to
Merge
is calledRebase
. We do the following.Pros
TxnManager::_onRebaseBeginLocalTxn()
/TxnManager::_onRebaseBeginLocalTxn()
when individual local txn are rebased. Any changes made during these are captured and local txn is updated.Cons
Possible performance impact on pull/merge depending on size of local changes.
As following shown by test their is certain conflict that will not happen in "Rebase".
Data
(Update)Data
(Delete)Conflict
NotFound
Constraint
itwinjs-core: iTwin/itwinjs-core#6662