PATCHVIEW(1)

✨ PATCHVIEW(1) ✨

okay bestie, gather round, because this is patchview(1) from the Man pages manual, and she is a whole vibe πŸ’– She's the queen bee of a little family of scripts, and she's here to make your diffs cute and numbered.


🌸 NAME 🌸

patchview, gitdiff, gitdiffview, gitshow, gitshowview, svndiff, svndiffview β€” no options? she shows you the numbered files that got modified by the patch. give her options? she lowkey becomes filterdiff. periodt πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

patchview [[-n] | [--line-number]] [[-p n] | [--strip-match=n]]
          [--strip=n] [--git-prefixes=strip|keep]
          [--git-extended-diffs=exclude|include] [--addprefix=PREFIX]
          [[-s] | [--status]] [[-E] | [--empty-files-as-removed]]
          [[-i PATTERN] | [--include=PATTERN]] [[-x PATTERN] |
          [--exclude=PATTERN]] [[-z] | [--decompress]] [[-# RANGE] |
          [--hunks=RANGE]] [--lines=RANGE] [[-FRANGE] | [--files=RANGE]]
          [[-H] | [--with-filename]] [[-h] | [--no-filename]] [[-v] |
          [--verbose]...] [file...]

patchview {[--help] | [--version] | [--filter ...] | [--grep ...]}

πŸ¦‹ DESCRIPTION πŸ¦‹

so like… what even is patchview? bestie, she's a wrapper around filterdiff, built specifically for numbered files. iconic behavior honestly πŸ‘‘

patchview

with no args at all? that's literally the same as:

lsdiff --number

and then

patchview -F2-

(or with literally any other args, no cap) is equivalent to filterdiff -F2- β€” or whatever arguments you hand her. she's flexible like that 🫢

now, the family: there are 4 scripts for working with git repos β€” gitdiff, gitdiffview, gitshow and gitshowview β€” and 2 for svn β€” svndiff and svndiffview.

svndiff

gitdiff

no args? you get the list of files modified. that's it, that's the tea β˜•

svndiff -F1

gitdiff -F1

this one shows the patch of file #1 πŸ”₯

svndiffview

gitdiffview

these two pipe all patches through filterdiff to vim - -R (read-only mode, which means it's easy to quit, thank u), showing you the complete patch with color. aesthetic AND functional πŸ’œ

svndiffview -F2

gitdiffview -F2

or any other args you feel like β€” this pipes the patch of file #2 to vim - -R.

gitshow

gitshowview

same energy as gitdiff, except it uses git show instead of git diff. slay ✨


πŸ’… OPTIONS πŸ’…

  • -n, --line-number β€” shows the line number where each patch begins. and if you ask for verbose output (like with -nv), every hunk of every patch gets listed too, bestie.

for each modified file, she generates a line with the line number of the beginning of the patch, then a Tab character, then the name of the modified file. if -v is given once, each of those lines gets followed by one line per hunk: a Tab character, the line number the hunk begins at, another Tab character, the string β€œHunk #”, and the hunk number (starting at 1).

and if -v is given twice alongside -n (so, -nvv), the format is slightly different: hunk-level descriptive text shows up after each hunk number, and the --number-files option is enabled. different flavor, same snack 😌

  • -N, --number-files β€” file numbers get listed, starting at 1, right before each filename. cute numbering moment πŸ”’
  • -#RANGE, --hunks=RANGE β€” only list hunks inside the specified RANGE. hunks are numbered from 1, and the range is a comma-separated list of numbers or β€œfirst-last” spans, optionally preceded by a modifier x which inverts the entire range; you can omit either the first or the last in the span to say "no limit in that direction."
  • --lines=RANGE β€” only list hunks that contain lines from the original file lying within the specified RANGE. lines are numbered from 1, and the range is a comma-separated list of numbers or β€œfirst-last” spans, optionally preceded by a modifier x which inverts the entire range; either the first or the last in the span may be omitted to indicate no limit in that direction.
  • -F=RANGE, --files=RANGE β€” only list files indicated by the specified RANGE. files are numbered from 1 in the order they appear in the patch input, and the range is a comma-separated list of numbers or β€œfirst-last” spans, optionally preceded by a modifier x which inverts the entire range; either the first or the last in the span may be omitted to indicate no limit in that direction.
  • -pn, --strip-match=n β€” when matching, ignore the first n components of the pathname. bye girl πŸ‘‹
  • --strip=n β€” removes the first n components of the pathname before displaying it.
  • --git-prefixes=strip|keep β€” how to handle a/ and b/ prefixes in Git diff filenames. with strip, she removes the prefixes both for filename matching (when you use -i and -x) and for filename output (similar to --strip). with keep (the default), existing behavior is preserved. this applies to both Git-specific diffs (binary files, renames, mode changes) and traditional diffs when they're part of a Git patch. ⚠️ note: with keep, copy and rename operations are treated as if they had a/ and b/ prefixes, for consistency with other Git operations. the default will change to strip in version 0.5.0 β€” so heads up, bestie, the future is coming 🫣
  • --git-extended-diffs=exclude|include β€” controls whether to process Git diffs that have no traditional content hunks. this includes renames, copies, mode-only changes, and binary files. with exclude (default in 0.4.x), these diffs are skipped. with include (default in 0.5.0+), these diffs are processed normally. this option affects file numbering with -N and file filtering with -F.
  • --addprefix=PREFIX β€” prefix the pathname with PREFIX before displaying it. glow-up for your paths πŸ’«
  • -s, --status β€” shows file additions, modifications and removals. an addition gets a β€œ+”, a removal gets a β€œ-”, and a modification gets a β€œ!”. visual language, love her.
  • --empty-files-as-absent, --empty-files-as-removed β€” treat empty files as absent for the purposes of displaying additions, modifications and removals. for example, a file with an empty old version and additions in the new version gets treated as a file addition (+) rather than a modification (!). ⚠️ note: for grepdiff, only the long form is available (-E means --extended-regexp for grepdiff). different script, different rules, iykyk.
  • -iPATTERN, --include=PATTERN β€” include only files matching PATTERN. gatekeeping, but make it useful βœ‹
  • -xPATTERN, --exclude=PATTERN β€” exclude files matching PATTERN. not you, not today 🚫
  • -z, --decompress β€” decompress files with extensions .gz and .bz2.
  • -H, --with-filename β€” print the name of the patch file containing each patch.
  • -h, --no-filename β€” suppress the name of the patch file containing each patch.
  • -v, --verbose β€” verbose output. for the git and svn wrapper scripts (gitdiff, gitdiffview, gitshow, gitshowview, svndiff, svndiffview), this option shows the full command that's being executed. full transparency, we love that πŸ’–
  • --help β€” display a short usage message.
  • --version β€” display the version number of patchview.
  • --filter β€” behave like filterdiff(1) instead.
  • --grep β€” behave like grepdiff(1) instead.

🌈 SEE ALSO 🌈

lsdiff(1), filterdiff(1), grepdiff(1)


πŸ“ EXAMPLES πŸ“

okay so we can make this one-line script called difftotrunk.sh, to view the differences of two directories or svn repos (trunk and .):

diff ../trunk . -ru -x .svn | patchview "$@"

and then, bestie:

./difftotrunk.sh

will show all different files and his number. πŸ’…

./difftotrunk.sh -F3,4

will show the differences of files #3 and #4 only.

./difftotrunk.sh -F3 -#1

will show only hunk #1 of file #3.

./difftotrunk.sh -F3 -#x1

will show the differences of file #3 without hunk #1 (x means that exclude, remember?).


πŸ‘‘ AUTHOR πŸ‘‘

Tim Waugh <twaugh@redhat.com>

  • Package maintainer

and that's the whole page, bestie!! πŸ’œ This diva lives in patchutils, and this particular version is dated 02 Jul 2020. she's still serving looks. slay, goodbye, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from