-
Notifications
You must be signed in to change notification settings - Fork 25
Home
Please take care to separate any changes touching upstream code. Keep these in separate commits.
You can learn which code is "our" by comparing master
branch to mer-x.y
. The mer-x.y
branch is basically the upstream x.y
branch with our changes to upstream code collected on top of it by the mean of cherry-picking (ch-p) appropriate commits from the master
branch.
sailfish/master <--merge-- sailfish/mer-x.y <--merge-- qt/x.y
sailfish/master ---ch-p--> sailfish/mer-x.y ---ch-p--> qt/x.y
New upstream is merged by
- reseting the
mer-x.y
branch to the newer upstream (utilizing theours
strategy ofgit-merge
), - cherry-picking our commits discarded with the reset, resolving possible conflicts and discarding commits which are no more needed
- then merging the
mer-x.y
branch back tomaster
, often usingnext
branch as a staging area.
This way we
- keep our changes to upstream code as a minimal patch set
x.y..mer-x.y
and - avoid conflicts resolution in a single huge merge commit
The following command provides an overview of the process.
gitk --simplify-by-decoration sailfish/master ^v4.0.1 ^sdk-1608
Time has shown that the use of the ours
strategy of git-merge
for resetting is not ideal. It leads to such order of parent commits that makes the history harder to look at. It would be better done the opposite way, but the opposite theirs
strategy was unfortunately removed from git-merge
earlier. We continue consistently using this not so ideal approach and use git-replace
to correct the order of parents of the concerned commits as in this example:
git replace --graft "$commit" "$commit"^2 "$commit"^1
To see the effect, the replacements must be explicitly fetched e.g. with command:
git fetch sailfish 'refs/replace/*:refs/replace/*'
After that, the following command provides much cleaner overview of the process.
gitk --simplify-by-decoration sailfish/master ^qt/master
(When used without fetching the replace objects, it provides an incomplete view.)
The following command helps deciding which changes should be cherry-picked to a mer-x.y
branch - we aim to minimize the diff:
git diff mer-X.Y..master -- * ':(exclude)'{\
src/plugins/mer,\
doc,\
src/plugins/qmldesigner/jollaplugin,\
share/qtcreator/sfdk,\
share/qtcreator/templates/wizards/sailfishos-qtquick2app,\
share/qtcreator/translations/sfdk_modules_tr.pro,\
dist/gdb,\
src/tools/{merssh,sdktool/*sfdk*,sfdk},\
src/libs/sfdk,\
tests/manual/mer,\
*.ts\
}