works

Plugins, tools, and games.

works/P4 Tools

P4StreamSwitcher

P4StreamSwitcher

Manage a pool of Perforce stream workspaces, switch branches, reuse local directories, and choose between synchronization and offline directory adoption.

  • Version Control & Collaboration

Platforms:Windows

Requirements:Python 3.10+, Tkinter, P4Python, platformdirs / Perforce CLI, P4V, and a valid server account / Two-level streams: //depot/project/branch

Back
This page's table of contents

Overview

P4StreamSwitcher is a Windows tool for switching Perforce stream workspaces, built with Python, Tkinter, and P4Python. Select a project and branch to generate a workspace name from a personal tag, manage the workspace count, and open the corresponding P4V client.

It supports the two-level stream layout //depot/project/branch. The source repository is public but does not declare a license.

The problem

Working across projects and branches involves repeatedly selecting clients and local directories. Keeping a workspace for every branch also consumes the available workspace count. UE projects contain local caches such as Saved, Intermediate, and DerivedDataCache, which must be distinguished from versioned files when reusing a directory.

The tool puts naming, cached directories, pool limits, and synchronization modes in one interface to reduce manual client configuration.

Core capabilities

  • Name workspaces as “tag_project_branch” and check tag conflicts across hosts; saving a new tag can rename old workspaces after confirmation.
  • Set a pool limit. At capacity, select the oldest workspace using local timestamps and check opened files and the P4V process before attempting eviction.
  • Open an existing workspace directly in P4V when its directory has not been manually changed and no synchronization flag is pending; otherwise run the relevant synchronization process.
  • In normal mode, use the have list, difference detection, and ignore rules to clean and download files. In offline mode, treat the local directory as authoritative and reconcile differences into the default changelist.
  • Cache directories and offline options per stream, optionally create .p4config, configure rmdir and line endings, and display status and leveled logs.

Scope and limitations

Normal synchronization deletes local files that are absent from the have list and are not protected by ignore rules. Inspect existing directories and back up files you need before using them. Offline mode opens add, edit, and delete records that require review in P4V.

The pool manages workspaces for the current host and user that match its naming format. Its checks do not provide a complete backup of local changes. The tool does not submit changes for you, and no measurements establish a fixed switching speedup.