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

Sweep: allow for rebase. #3499

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sweepai/config/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,5 @@
JIRA_USER_NAME = os.environ.get("JIRA_USER_NAME", None)
JIRA_API_TOKEN = os.environ.get("JIRA_API_TOKEN", None)
JIRA_URL = os.environ.get("JIRA_URL", None)

MERGE_CONFLICT_RESOLUTION_STRATEGY = os.environ.get("MERGE_CONFLICT_RESOLUTION_STRATEGY", "merge")
7 changes: 5 additions & 2 deletions sweepai/handlers/on_merge_conflict.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from github.PullRequest import PullRequest
from loguru import logger

from sweepai.config.server import PROGRESS_BASE_URL
from sweepai.config.server import MERGE_CONFLICT_RESOLUTION_STRATEGY, PROGRESS_BASE_URL
from sweepai.core import entities
from sweepai.core.entities import FileChangeRequest
from sweepai.core.sweep_bot import SweepBot
Expand Down Expand Up @@ -186,7 +186,10 @@ def edit_comment(body):
git_repo.config_writer().set_value(
"user", "email", "team@sweep.dev"
).release()
git_repo.git.merge("origin/" + pr.base.ref)
if MERGE_CONFLICT_RESOLUTION_STRATEGY == "rebase":
git_repo.git.rebase("origin/" + pr.base.ref)
else:
git_repo.git.merge("origin/" + pr.base.ref)
except GitCommandError:
# Assume there are merge conflicts
pass
Expand Down
Loading