Reimplement directory diffing for ClearCase and VersionVault.

Review Request #12581 — Created Sept. 6, 2022 and submitted — Latest diff uploaded


The community-driven ClearCase implementation included diffs of
directory elements (basically doing a diff of the ls output).
Directory diffs aren't a thing anywhere else in Review Board, but it's
apparently a requirement from our partners at HCL, so we're going to
reimplement this behavior.

This change adds back directory diffs, but does so in a hopefully
forward-looking way. We're including the correct "directory" type in the
diffx metadata to indicate that a file entry is actually for a
directory, and we're adding a new key to the VersionVault metadata
section to say that the directory diff is a legacy "filenames" diff.
This will allow us to implement directory diffs in a more useful/correct
way later down the line without having painted ourselves into a corner
relying on only this behavior.

I've added unit tests not only for the new directory diffs, but also for
basic file diff generation (in both legacy and diffx mode). While doing
this, I discovered a bug where creating diffs for the legacy mode with
dynamic views would end up replacing filenames twice, resulting in
filenames that looked like vob/vob/file, instead of vob/file. I've
changed it to explicitly replace the old and new filenames only on the
first and second lines of the diff.

  • Posted changes including directory diffs (along with a corresponding
    Power Pack change) and saw the correct output.
  • Ran unit tests.