Skip to content

cub variant diff

cub variant diff

Show differences in a Variant between Tags

Synopsis

Show what changed across a whole variant space between two Tags.

A Tag marks one Revision in each Unit it was applied to, so naming two Tags compares the space at two points in its history -- the state one release captured against the state another did -- rather than one Unit at a time. Each Unit is diffed from its Revision on the one side to its Revision on the other, and Units whose configuration is the same at both print nothing.

Each side has to name something that picks out a Revision in every Unit of the space:

| Tag: the Revision that Tag marks ChangeSet: where a Closed ChangeSet ended Before:ChangeSet: the state it started from ChangeOrder: where the change arrived Before:ChangeOrder: the state before it HeadRevisionNum each Unit's head Revision

A Unit with no Revision carrying the Tag is absent on that side rather than falling back to its head, so it shows as a whole addition or removal and is labeled "absent". That is where this differs from cub release publish --revision, which selects the same Revision but has to bundle something for every Unit, and so falls back.

A revision number, a delta from head, a Revision ID and LastReleasedRevisionNum each pick out a Revision of one Unit, and mean something different -- or nothing -- in the next one, so they are refused here; cub unit diff is what takes them. Slugs resolve in unless qualified as space/slug.

is required. defaults to HeadRevisionNum, so naming one Tag compares that point against what the space holds now.

--where narrows the Units compared, taking the same expressions cub unit list does.

Output Formats: - Default: Line-numbered format with color, under a header naming each Unit - Unified: Use -u for unified diff format (like git diff) - Color: Use -c to enable color in unified diff - Mutations: Use -o mutations for a structured mutation display

-o mutations shows what set each value rather than the lines that differ. A Unit's MutationNums are one sequence, so the Mutations recorded at the to side that the from side did not already carry are the ones the comparison is about, and those are what is listed; a Unit the from side does not have lists everything, an addition having no prior state. A Unit missing from the to side is named but lists nothing, since its removal is not recorded as a Mutation of it.

Examples:

  # What the variant has changed since the release tagged v1.3.0
  cub variant diff apptique-prod v1.3.0

  # Between two releases
  cub variant diff apptique-prod v1.2.0 v1.3.0

  # What a change order brought to the variant
  cub variant diff apptique-prod Before:ChangeOrder:release-42 ChangeOrder:release-42

  # Only the workloads, as a unified diff
  cub variant diff -u apptique-prod v1.2.0 v1.3.0 --where "Slug LIKE 'deployment-%'"

  # What set each value that the change touched, rather than the lines
  cub variant diff apptique-prod v1.2.0 v1.3.0 -o mutations
cub variant diff <space> <fromTag> [toTag] [flags]

Options

  -c, --color           colorize the unified diff output (default: true for numbered diff)
  -h, --help            help for diff
  -o, --output string   Output format: "default" for the text diff, or "mutations" for a resource-mutations diff.
      --quiet           No default output.
  -u, --unified         output unified diff format
      --where string    Filter expression using SQL-inspired syntax. Supports conjunctions with AND. String operators: =, !=, <, >, <=, >=, LIKE, NOT LIKE, ILIKE, ~~, !~~, ~, ~*, !~, !~*. Pattern matching with LIKE/ILIKE uses % and _ wildcards. Regex operators (~, ~*, !~, !~*) support POSIX regular expressions. A related entity is referenced by prefix, as in "UpstreamUnit.Slug = 'base'"; when the reference names a list, a * segment matches any element, as in "FromLink.*.Slug = 'upgrade-app'". Examples: "Slug LIKE 'app-%'", "DisplayName ILIKE '%backend%'", "Slug ~ '^[a-z]+-[0-9]+$'"

Options inherited from parent commands

      --context string   The context to use for this command
      --debug            Debug output

SEE ALSO