[Development] Instructions how to set up cherry-picking between Qt5 and Qt4 repositories?

Rohan McGovern rohan.mcgovern at nokia.com
Wed Jan 18 01:17:26 CET 2012


ext-sami.1.rosendahl at nokia.com said:
> 
> Hi
> 
> I am backporting fixes I have pushed to Qt5 to Qt4.8 now that 4.8 is available in gerrit. I got comments to my Qt4.8 patches that I should preferably cherry-pick the Qt5 commits to Qt4. I do not know how to set up my environment to enable the cherry-picking because of the separate Qt5 and Qt4.x repositories and their different directory structures.
> 
> I found the tool qtrepotools/bin/git-qt-cherry-pick in Qt5 repository, but have not been able to figure out how to use it or how to set up the repositories to enable its use. Lacking the cherry-picking capability I have moved commits between Qt5 and 4.x using git format-patch & apply and have edited the paths in the patches to match the target repo.
> 
> Any help or instructions for setting up cherry-picking would be much appreciated.
> 
> ________________________________
> 
> Was able to figure something out:
> - git-qt-cherry-pick seems to prefer that the Qt4.x and Qt5 repository directories are siblings in the same directory and the Qt5 path (looking from the Qt4.x repository path) is ../qt5

It seems if your setup doesn't satisfy this, you can still make it work
with the "-p" option.

> - The <repo> in the script usage means the base name of a Qt5 subrepository (e.g. 'qtbase')
> 
> Alas, the script still fails:
> $ ../qt5/qtrepotools/bin/git-qt-cherry-pick -l qtbase b851c764a61c0de781ef3447230a0a6a3f4a0ed9
> Porting from qt5/qtbase to qt
> Other path is ../qt5/qtbase
> Applying: Fix stack overwrite in QDBusDemarshaller
> fatal: sha1 information is lacking or useless (tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp).
> Repository lacks necessary blobs to fall back on 3-way merge.
> Cannot fall back to three-way merge.
> Patch failed at 0001 Fix stack overwrite in QDBusDemarshaller
> When you have resolved this problem run "git am --resolved".
> If you would prefer to skip this patch, instead run "git am --skip".
> To restore the original branch and stop patching run "git am --abort".
> Aborting at b851c764a61c0de781ef3447230a0a6a3f4a0ed9
> $

I was able to get your change as far as a "normal" conflict by the
following:

  cd ~/build/qt/4.8

  # copy all qt5 qtbase objects into qt 4.8
  git fetch -v ~/build/qt/qt5/qtbase 'refs/heads/*:refs/qt5-qtbase/*'

  # do the cherry-pick
  ~/build/qt/qt5/qtrepotools/bin/git-qt-cherry-pick -l qtbase -p ~/build/qt/qt5/qtbase b851c764a61c0de781ef3447230a0a6a3f4a0ed9
  Porting from qt5/qtbase to qt
  Other path is /home/rmcgover/build/qt/qt5/qtbase
  Applying: Fix stack overwrite in QDBusDemarshaller
  Using index info to reconstruct a base tree...
  Falling back to patching base and 3-way merge...
  Renaming tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp => tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp
  Auto-merging tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp
  CONFLICT (rename/modify): Merge conflict in tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp
  Failed to merge in the changes.
  Patch failed at 0001 Fix stack overwrite in QDBusDemarshaller
  When you have resolved this problem run "git am -3 --resolved".
  If you would prefer to skip this patch, instead run "git am -3 --skip".
  To restore the original branch and stop patching run "git am -3 --abort".
  Aborting at b851c764a61c0de781ef3447230a0a6a3f4a0ed9

After this point you would need to resolve the conflict as usual.
The important thing is that you can see from the above that git was able
to follow the rename of tst_qdbusmarshall.cpp (therefore reducing
the amount of work you need to do manually to resolve conflicts).

> 
> I am assuming that the message "Repository lacks necessary blobs to fall back on 3-way merge." may be related to the note "it's strongly recommended to have linked object stores between the repositories to enable 3-way merges." in this announcement about qt-cherry-pick I was able to find: http://lists.qt-project.org/pipermail/development/2011-November/000483.html.
> 
> I don't know how to set up "linked object stores between the repositories". I did set up the Git Grafts as instructed in the Qt5 README, but that did not help with the git-qt-cherry-pick.

There are many ways to set up linked object stores, some of them
dangerous if you are not a git "power user".  What I did above is to
copy the objects from one repo to another rather than linking them.



More information about the Development mailing list