Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. gerrit beginner advice needed
QtWS25 Last Chance

gerrit beginner advice needed

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 163 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gaess
    wrote on last edited by gaess
    #1

    Hello, having a hard time understanding gerrit.
    I've uploaded three commits. gerrit complains about mixed whitespace and other changes. So I tried to split up my commit into two and upload it again. But I just don't get it.
    Here's what i've tried:

    mkdir gerritfetch
    cd gerritfetch
    git init
    git fetch ssh://dsavi@codereview.qt-project.org:29418/qt/qtbase refs/changes/42/627542/1 && git checkout -b change-627542 FETCH_HEAD
    git log
    

    from the log, I copied my original commit message and kept it in a text editor

    git rebase -i change-627542
    git reset d870a4d0947a7
    

    that's the second latest commit in the fetch

    git add -p
    

    now choosing only non-whitespace changes

    git commit
    

    adding my original commit message

    git add -p
    

    choosing all other changes

    git commit
    

    here i struggled ending the rebase, --continue gave my an error saying "missing arguments for edit", so i did

    git rebase --quit
    git add remote gerrit  ssh://codereview.qt-project.org/qt/qt5
    git push gerrit HEAD:refs/for/dev
    

    which fails with the error: ! [remote rejected] HEAD -> refs/for/dev (no common ancestry)

    Obviously, I'm on the wrong path. What should I do instead?

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You should rebase your changes on current HEAD. After git init you forgot to checkout dev. I normally don't use the checkout but the cherry-pick so I can work on current HEAD.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • G Offline
        G Offline
        gaess
        wrote on last edited by
        #3

        Thank you for the quick answer, Christian. To be honest, my git skills are still quite shaky.
        So should I do this?

        mkdir gerritfetch
        cd gerritfetch
        git init
        git checkout -b my-fix origin/dev
        git fetch ssh://dsavi@codereview.qt-project.org:29418/qt/qtbase refs/changes/42/627542/1 && git checkout -b change-627542 FETCH_HEAD
        

        This will trigger quite a big download. Could I just copy my existing local directory and fetch into that copy?

        Christian EhrlicherC 1 Reply Last reply
        0
        • G gaess

          Thank you for the quick answer, Christian. To be honest, my git skills are still quite shaky.
          So should I do this?

          mkdir gerritfetch
          cd gerritfetch
          git init
          git checkout -b my-fix origin/dev
          git fetch ssh://dsavi@codereview.qt-project.org:29418/qt/qtbase refs/changes/42/627542/1 && git checkout -b change-627542 FETCH_HEAD
          

          This will trigger quite a big download. Could I just copy my existing local directory and fetch into that copy?

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by Christian Ehrlicher
          #4

          @gaess said in gerrit beginner advice needed:

          Could I just copy my existing local directory and fetch into that copy?

          If this is a git repo clone from official qt, yes - you can work there as I also do - there is no need for a checkout for a patch. Simply do a cherry-pick in your local git clone.

          // pull to be on current git HEAD, not needed if your local copy is not that old
          git pull
          // cherry-pick patch to your local HEAD
          git fetch https://codereview.qt-project.org/qt/qtbase refs/changes/42/627542/1 && git cherry-pick FETCH_HEAD  
          // modify the patch
          
          // ... and push your changes
          git push gerrit HEAD:refs/for/dev
          

          /edit: when using the cherry-pick method you have to make sure all ancestors which might produce a merge conflict are cherry-picked before (in your case the two other patches)

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          3
          • G Offline
            G Offline
            gaess
            wrote on last edited by
            #5

            Thanks a lot! with your help, the split worked.

            1 Reply Last reply
            0
            • G gaess has marked this topic as solved on

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved