Skip to content

Fix #203: add Merge Branch button to addon, repair Check Merge Conflicts - #229

Merged
R0bb1eV merged 2 commits into
mainfrom
203-merge-branches-feature
Apr 28, 2026
Merged

R0bb1eV merged 2 commits into
mainfrom
203-merge-branches-feature

Conversation

@aarshrpatel

Copy link
Copy Markdown
Contributor

Summary

  • Adds a Merge Branch operator + button to the BVCS N-panel so users can merge a source branch into the current branch from inside Blender (calls existing POST /api/projects/{id}/branches/{branch_id}/merge).
  • Fixes the Check Merge Conflicts button, which was hitting /api/projects/{id}/conflicts — an endpoint that no longer exists, so it always errored. It now runs the local three-way diff and populates the same bvcs_merge_conflicts / bvcs_conflict_items state that Push/Pull use, so conflicts show up in the existing per-object resolution UI (Keep Local / Keep Remote / Keep Both / Delete → Apply Resolutions / Cancel / Preview Remote).

Closes #203.

Test plan

  • Install the addon, log in, open a project with at least two branches.
  • Switch to main, click Merge Branch, pick alice, leave message blank → success report; click Pull and verify the merge commit lands in the scene.
  • Repeat with a custom commit message → message appears on the new commit.
  • Force a real conflict (modify the same object on both branches), trigger Merge Branch → 409 path reports conflicting object names.
  • Click Check Merge Conflicts with no remote drift → "No merge conflicts detected".
  • Click Check Merge Conflicts with conflicts → conflicts populate the panel with per-object dropdowns; Apply Resolutions and Preview Remote work end-to-end.
  • Confirm the dropdown only lists branches other than the current one and disables when there's only one branch.

🤖 Generated with Claude Code

aarshrpatel and others added 2 commits April 26, 2026 21:38
Branch deletion failed with a 500 because commits.branch_id, object_locks.branch_id,
and branches.parent_branch_id are FKs with default ON DELETE RESTRICT. Any branch
with attached commits, locks, or child branches violated the constraint and surfaced
as an Internal Server Error.

- delete_branch now reassigns commits to the parent (or default) branch so history
  survives, detaches child branches' parent pointer, and clears scoped object locks
  before removing the branch row.
- Added _validate_branch_name to reject empty/whitespace, slashes, control chars,
  other punctuation, and names over 100 chars at create and rename time, with
  HTTP 400 errors that match the test expectations.
- Backfilled branch coverage in tests/test_projects.py (rename, default-branch
  guards, special-char rejection, delete with commits, delete with child branch)
  and corrected the "name" -> "branch_name" payload mismatch in
  tests/test_authorization.py so the role-based branch tests actually run.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add Merge Branch operator + button to the BVCS N-panel and fix the
broken Check Merge Conflicts button (was calling /conflicts, an
endpoint that no longer exists). Check Merge Conflicts now does pure
local three-way detection and surfaces results in the existing
per-object resolution UI used by Push/Pull.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8c7278a38c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread blender_vcs/__init__.py
Comment on lines +2753 to +2756
base_objects_map = (
_get_commit_objects_by_hash(prefs, base_hash)
if base_hash and base_hash != remote_hash
else {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid empty merge base when remote head is unchanged

When base_hash equals remote_hash (the remote branch has not advanced since last sync), this branch sets base_objects_map to {} and still runs compute_object_diff. In that case any local-only edits are misclassified as ADDED_BOTH conflicts because every object looks “new” relative to an empty base, so Check Merge Conflicts reports false conflicts and can drive users into unnecessary conflict-resolution merge commits despite no remote drift.

Useful? React with 👍 / 👎.

@R0bb1eV
R0bb1eV merged commit fb1ea69 into main Apr 28, 2026
2 checks passed
@R0bb1eV
R0bb1eV deleted the 203-merge-branches-feature branch April 28, 2026 02:31
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.

Cannot merge branches

2 participants