Add setting to auto fetch after merge request creation#153
Open
subhajitlucky wants to merge 2 commits into
Open
Add setting to auto fetch after merge request creation#153subhajitlucky wants to merge 2 commits into
subhajitlucky wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an optional configuration flag to automatically git fetch origin immediately after creating a GitLab merge request, and documents/tests the behavior to address issue #28.
Changes:
- Add
auto_fetch_after_merge_requestconfig parsing and conditionally rungit fetch originafter MR creation. - Document the new setting in
configs/config.ini.example. - Add a regression test covering the enabled behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
gitHappens.py |
Parses new config flag and conditionally runs git fetch origin after merge request creation. |
configs/config.ini.example |
Documents auto_fetch_after_merge_request with a default of false. |
tests/test_auto_fetch_after_merge_request.py |
Adds unit test for the “enabled” fetch behavior during MR creation flow. |
tests/__init__.py |
Introduces tests package marker for discovery/import behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+11
to
+15
| config_dir = root / "configs" | ||
| config_dir.mkdir(exist_ok=True) | ||
| (config_dir / "config.ini").write_text( | ||
| "[DEFAULT]\n" | ||
| "base_url=https://gitlab.example\n" |
Comment on lines
+24
to
+27
| (config_dir / "templates.json").write_text( | ||
| '{"templates": [], "reviewers": []}', | ||
| encoding="utf-8", | ||
| ) |
Comment on lines
+35
to
+39
| sys.modules["inquirer"] = inquirer_stub | ||
|
|
||
| spec = importlib.util.spec_from_file_location("gitHappens_under_test", root / "gitHappens.py") | ||
| module = importlib.util.module_from_spec(spec) | ||
| spec.loader.exec_module(module) |
Comment on lines
+43
to
+46
| class AutoFetchAfterMergeRequestTest(unittest.TestCase): | ||
| def test_fetches_origin_after_merge_request_when_setting_is_enabled(self): | ||
| git_happens = load_githappens_module(auto_fetch_after_merge_request=True) | ||
| created_issue = {"iid": 12, "title": "Fix broken thing"} |
Comment on lines
342
to
344
|
|
||
| print("Run:") | ||
| print(" git fetch origin") |
Author
|
Updated this PR to address the review comments:
Verification after the update:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #28
Summary
auto_fetch_after_merge_requestconfig supportgit fetch originafter the merge request is created when that setting is enabledVerification
python3 -m unittest tests.test_auto_fetch_after_merge_request -vpython3 -m unittest discover -vpython3 -m compileall gitHappens.py testsgit diff --check