Skip to main content
Diversion stores every version of every file forever. For large binary files that change often — game builds, textures, audio — this adds up fast. A 500 MB texture saved every week is about 26 GB of history each year. A revision limit tells Diversion to keep only the latest N versions of the files that match a pattern. Older versions are pruned in the background to free storage. Unlike obliterate, which removes every version of a file, a revision limit keeps the file and its most recent versions — only the excess older versions are removed.
A “version” (also called a revision) is one committed state of a file. --keep 3 means Diversion keeps the three most recent committed versions of each matching file and prunes anything older.
Pruning permanently deletes older file versions and cannot be undone. It runs automatically after every commit with no prompt or confirmation. Review a repo’s rules with dv prune list before you rely on them.

Usage examples

Requirements

  • You must be an organization admin.
  • Revision limits are not supported on repositories synced with Git.

How it works

  1. An admin adds one or more rules. Each rule is a path pattern plus a keep count (see dv prune).
  2. After every commit, Diversion checks the files that commit touched against the rules and prunes versions beyond the keep count.
  3. Pruning runs in the background. It does not slow down the commit, and the person committing sees no prompt or warning.
Pruning is silent by design: the admin (or a Perforce import) sets the policy, and committers cannot override it. Review what a repo will prune with dv prune list.

Keep counts

  • --keep <N> — keep the latest N versions (1 to 999). --keep 1 keeps the head version only.
  • --keep all — keep every version (never prune). Use this to carve a path back out of a broader limit (partially negate); see Rule order.

Branch-safe counting

“Keep N” is counted per branch, not per repository:
  • Every branch’s head version is always kept.
  • A file’s stored bytes are deleted only when no kept version on any branch still needs them.
So a version shared across branches survives until the last branch that needs it prunes it. When in doubt, Diversion keeps a version longer rather than deleting one a branch still needs.

What is never pruned

  • Drafts and shelves. Uncommitted work and shelved changes are always preserved.
  • Every branch’s head. The latest version on each branch is always kept, even with --keep 1.

Glob syntax

Patterns are anchored to the repo root. Always quote them so your shell does not expand the wildcards. This is the same pattern grammar as obliterate.

Rule order

Rules are an ordered list. When more than one rule matches a path, the last matching rule wins. Adding a rule appends it to the end, so a later rule can override an earlier one. Use this to keep everything under a subtree while limiting a wider pattern:
dv prune list prints rules in this priority order.

Managing rules

Use dv prune to list, add, edit, and remove rules:
Adding a rule applies it to future commits. It does not prune versions that already exist beyond the new limit; those are pruned as later commits touch each file.

Coming from Perforce

This is the Diversion equivalent of Perforce’s +S / +Sn file type modifier, which keeps only the last N revisions of a file. When you import a Perforce depot, your existing +S rules can be brought over as Diversion revision limits so retention carries across the migration. The import produces a review report of the translated rules for an admin to apply. Contact the Diversion team to run a Perforce import.
Diversion guarantees branch-safe counting by design. Perforce’s +S behavior across branches changed between server versions and is not consistent — Diversion always keeps every branch’s head and never deletes a version another branch still needs.