Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add support for merge commits #303

Merged
merged 7 commits into from
Feb 20, 2022
Merged

Conversation

sorenlouv
Copy link
Owner

@sorenlouv sorenlouv commented Feb 16, 2022

Fix bug where backport would fail if no .backportrc.json file existed
@sorenlouv sorenlouv merged commit 75efeaf into main Feb 20, 2022
@sorenlouv sorenlouv deleted the add-support-for-merge-commits branch February 20, 2022 08:53
@Krzmbrzl
Copy link

Krzmbrzl commented May 1, 2022

Okay, I forgot how to make use of this feature and I can't seem to get it working anymore xD

Using the --pr option only seems to backport the first commit of that PR for me. Is there an additional CLI option that is intended for this feature? 🙈

@sorenlouv
Copy link
Owner Author

sorenlouv commented May 1, 2022

@Krzmbrzl --pr option should be all that's needed. What version are you using? You need minimum 7.2.

As far as I can tell, it works as it should. Take a look at this dummy repo: https://github.com/backport-org/different-merge-strategies. If you clone it, you'll be able to run:

backport --repo backport-org/different-merge-strategies --branch 7.x --pr 9

Then you should see that it backports all commits from the source pull request. I did it here.

I might have missed some edge cases so it would be terrific if you can reproduce the problem in a public repo that I can view.

@Krzmbrzl
Copy link

Krzmbrzl commented May 1, 2022

Hm okay. Could it be related to the fact that I was seeing a merge conflict during the cherry-pick of that very first commit? Could that have thrown off the following logic?

I did encounter the issue while trying to backport mumble-voip/mumble#5641 to https://github.com/mumble-voip/mumble/tree/1.4.x, though at commit 3960373d98f9226b73e947abc582e0e4e4ae5936.

The command that I ran was

backport --pr 5641

and then select then 1.4.x branch in the menu presented afterwards.

@sorenlouv
Copy link
Owner Author

Hi @Krzmbrzl

Thanks for making me aware of this problem. I just confirmed this is indeed a problem when conflicts occur.

The pull requests is expected to have 8 commits like here. But if a conflict occurs in the first commit, it omits the rest like here.

I'll look into a fix.

@Krzmbrzl
Copy link

Krzmbrzl commented May 4, 2022

I just confirmed this is indeed a problem when conflicts occur.

Aha - so it was not me doing something silly - that's good :D

I'll look into a fix.

Thanks! 👍

@sorenlouv
Copy link
Owner Author

@Krzmbrzl I've made a fix and released it in v8.4.1. Please let me know if it works for you if you have time.

@Krzmbrzl
Copy link

Krzmbrzl commented May 18, 2022

So I've been using the new version for a bit now and while I have yet to use it on a PR that causes a merge conflict, I now constantly keep running into issues where backlog "crashes" and in the logs there is always a message such as

{"level":"error","message":"runSequentially failed Code: 128, Args: \"rev-list -1 --merges e93d486ba6f7504eb08b94befcfc9a07c4fc5aae~1..e93d486ba6f7504eb08b94befcfc9a07c4fc5aae\", Message: fatal: ambiguous argument 'e93d486ba6f7504eb08b94befcfc9a07c4fc5aae~1..e93d486ba6f7504eb08b94befcfc9a07c4fc5aae': unknown revision or path not in the working tree.\nUse '--' to separate paths from revisions, like this:\n'git <command> [<revision>...] -- [<file>...]'","metadata":{"context":{"cmdArgs":["rev-list","-1","--merges","e93d486ba6f7504eb08b94befcfc9a07c4fc5aae~1..e93d486ba6f7504eb08b94befcfc9a07c4fc5aae"],"code":128,"stderr":"fatal: ambiguous argument 'e93d486ba6f7504eb08b94befcfc9a07c4fc5aae~1..e93d486ba6f7504eb08b94befcfc9a07c4fc5aae': unknown revision or path not in the working tree.\nUse '--' to separate paths from revisions, like this:\n'git <command> [<revision>...] -- [<file>...]'\n","stdout":""},"name":"SpawnError","stack":"SpawnError: Code: 128, Args: \"rev-list -1 --merges e93d486ba6f7504eb08b94befcfc9a07c4fc5aae~1..e93d486ba6f7504eb08b94befcfc9a07c4fc5aae\", Message: fatal: ambiguous argument 'e93d486ba6f7504eb08b94befcfc9a07c4fc5aae~1..e93d486ba6f7504eb08b94befcfc9a07c4fc5aae': unknown revision or path not in the working tree.\nUse '--' to separate paths from revisions, like this:\n'git <command> [<revision>...] -- [<file>...]'\n    at ChildProcess.<anonymous> (/usr/local/lib/node_modules/backport/dist/lib/child-process-promisified.js:37:29)\n    at ChildProcess.emit (node:events:526:28)\n    at maybeClose (node:internal/child_process:1092:16)\n    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)"},"timestamp":"2022-05-18 09:43:06"}

I'm not sure if this is related to the latest changes though. This is backlog's output when this happens

$ backport --pr 5677
? Select pull request Merge PR #5677: CHANGE(client): Disable RNNoise by default
? Select branch 1.4.x

Backporting to 1.4.x:
✔ Pulling latest changes
An unhandled error occurred while backporting commit. Please see the logs for details

Whenever this happens I have to delete .backport/repositories/<theRepo> and then explicitly fetch the latest commits from the upstream master branch. Then I can repeat above command and it'll work.

@Krzmbrzl
Copy link

Note: Just after I wrote this I did encounter a backport with merge conflicts and it seems to work as expected 👍

@sorenlouv
Copy link
Owner Author

I now constantly keep running into issues where backlog "crashes"

@Krzmbrzl Thanks for the heads up! I was not aware of this problem until you pointed it out. I have a fixed ready and will merge and release it sometime Thursday.

@sorenlouv
Copy link
Owner Author

The fix is released in 8.4.2.

@Krzmbrzl
Copy link

Krzmbrzl commented Jun 5, 2022

Can confirm that everything seems to be working smoothly again. Thank you! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backport commits in PR instead of merge commit
2 participants