Gerrit GUI Shows - Submit including parents

543 views
Skip to first unread message

Mohan

unread,
Jan 29, 2020, 1:48:32 AM1/29/20
to Repo and Gerrit Discussion

The following commands used to merge the branch from project-1 to project-2 repository.

 

 

1) Clone the target repository (Eg: project-2):-

git clone ssh://blr-user@gerrit-server:29418/project-2 && scp -p -P 29418 ssh://blr-user@gerrit-server:hooks/commit-msg project-2/.git/hooks/


2) Changing the remote origin:-

git remote add project-1-origin ssh://blr-user@gerrit-server:29418/project-1


3) git fetch project-1-origin

4)git checkout test-branch


5) git pull --rebase

6) git merge --allow-unrelated-histories --no-ff --no-commit release_branch

7) git commit -a


8) git push origin HEAD:refs/for/test-branch

As soon we pushed the changes to gerrit, On Gerrit GUI it shows “Submit including parents” for the review request.

 

Note: There is no dependency request as well, still it shows above message. Any suggestion to fix the problem would be helpful.

Marco Miller

unread,
Jan 29, 2020, 12:04:01 PM1/29/20
to Repo and Gerrit Discussion
Seems like you already had a change up for review, for project-2's test-branch.
-And that previously existing review was ready to Submit, when you pushed this follow-up change at #8 above.
It seems also like the change that you pushed in #8 is as ready to Submit.
Now if you happened to push multiple changes at once (#6, #8), then your review workflow may have set them all as Submit-able.

If all so, then the enabled Submit-including-parents button is expected.

Above, you are not detailing the locally listed remotes for each branch (test-branch, release_branch).
-Seems like test-branch is from/for project-2, and release_branch would have to come from project-1.
Also, it is assumed that you change directory to project-2, between #1 and #2 (above).

Mohan

unread,
Feb 3, 2020, 8:32:11 AM2/3/20
to Repo and Gerrit Discussion
Sorry for late reply. Actually there is no pending/dependency request for both the repositories. Yes test-branch is from project-2 & release_branch is from Project-1.

Yes changed the directory after step-1.


Marco Miller

unread,
Feb 3, 2020, 8:44:53 AM2/3/20
to Repo and Gerrit Discussion
Then you are likely getting related change reviews as that push uploaded multiple commits, at once.
-Those related changes in Gerrit should correspond to a local git commits history, as per your git log.
/Marco

Mohan

unread,
Feb 3, 2020, 10:45:24 AM2/3/20
to Repo and Gerrit Discussion
Yes I m trying to push multiple commits at once. So can you give more details about Gerrit should correspond to local git history.

Marco Miller

unread,
Feb 3, 2020, 3:34:00 PM2/3/20
to Repo and Gerrit Discussion
If you are pushing multiple commits at once, with each commit having a Change-Id, then each such commit will lend a change in Gerrit.
Since each commit is based on another, each corresponding change in Gerrit will be based on a related change.
-I think you're faced with one Gerrit change review created per commit pushed, this for every recent commit.

So those changes get based on each other the same way as their corresponding commits are (based on each other).
That is normal and expected Gerrit behaviour.
/Marco

Mohan

unread,
Feb 4, 2020, 1:33:19 AM2/4/20
to Repo and Gerrit Discussion

So for this situation what is the best way to merge multiple commits in a single push with history?

Message has been deleted

Marco Miller

unread,
Feb 5, 2020, 9:16:06 AM2/5/20
to Repo and Gerrit Discussion
On Tuesday, February 4, 2020 at 1:33:19 AM UTC-5, Mohan wrote:

So for this situation what is the best way to merge multiple commits in a single push with history?


You could git-squash ([1] below) the commits locally (into one) before pushing.
Doing this would lead to a single change review in Gerrit.

During squashing, to retain some kind of history, you need to edit the resulting commit message accordingly.
Meaning, you'll need to craft a short list of the squashed commits, say with their short sha-1 and slogan.

Note that using such a squashing commit and its message will not be like keeping all commits, git-history wise.
If you rather want to preserve original history, then you have to deal with the multiple /related changes in Gerrit.

/Marco
Reply all
Reply to author
Forward
0 new messages