Multi-project Workspace - Define project branches

Answered

We'd like to use multi-project workspaces in our project (https://www.jetbrains.com/help/idea/workspaces.html).

We use release branches (e.g. release/v23 and release/v24), but unfortunately there's no branch attribute on the vcs element in jb-workspace.xml. Is there a workaround for this?
 

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="WorkspaceSettings">
    <project name="foo-bar-v23" path="$PROJECT_DIR$/foo-bar-v23">
      <vcs id="Git" remoteUrl="https://github.com/fs-foo-bar.git" />   <!-- missing branch attribute here -->
    </project>
    <project name="foo-bar-v24" path="$PROJECT_DIR$/foo-bar-v24">
      <vcs id="Git" remoteUrl="https://github.com/fs-foo-bar.git" />  <!-- missing branch attribute here -->
    </project>
    <option name="workspace" value="true" />
  </component>
</project>
2
1 comment
Hi,

Thank you for contacting JetBrains Support.

The <vcs> element in WorkspaceSettings is descriptive rather than declarative. It tells the IDE that a sub-project folder is a Git working copy so that VCS features (branch widget, commit, Git log, etc.) light up for it. It does not drive git checkout, and there is no branch attribute on the schema today.

For your setup with separate folders per release (foo-bar-v23, foo-bar-v24), the workaround is:

1. In each sub-project folder, run git checkout release/v23 (and release/v24 in the other) once.
2. Open the workspace. The IDE picks up whatever branch each clone is on, and the branch widget will show the branch per root.


That should give you the per-project branch view you are after, without needing the schema to carry the branch.

If your goal is for the workspace itself to enforce or restore a branch on open (for example, to recover if someone switches branches manually in one of the clones), that would be a new feature request, since the schema does not support it today.

A short note on the user scenario (what should happen on open, on workspace switch, on a dirty working copy) would help the team scope it.

Kind regards,

Emin.
0

Please sign in to leave a comment.