Skip to content

Commit

Permalink
Handle conflict when cherry-picking changelog
Browse files Browse the repository at this point in the history
fixes: pulp#439
  • Loading branch information
dkliban committed Jul 12, 2021
1 parent 1b40162 commit f474ae0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES/439.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Handle conflicts when cherry-picking changelog to master branch.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import os
import textwrap

from git import Repo
from git.exc import GitCommandError


helper = textwrap.dedent(
Expand Down Expand Up @@ -48,5 +49,11 @@ if not changelog_commit:
git = repo.git
git.stash()
git.checkout("origin/master")
git.cherry_pick(changelog_commit.hexsha)
try:
git.cherry_pick(changelog_commit.hexsha)
except GitCommandError:
git.add("CHANGES/")
# Don't try opening an editor for the commit message
with git.custom_environment(GIT_EDITOR='true'):
git.cherry_pick("--continue")
git.reset("origin/master")

0 comments on commit f474ae0

Please sign in to comment.