Tim's patch management tools

From eLinux.org
Jump to: navigation, search

Here I plan to post the patch management tools I have written for working with Linux inside Sony. We use a combination of quilt and arch for our SCM for the kernel, and I use diffinfo (with pcomp), qdiff, and reisolate when analyzing patches. Some of the functionality of diffinfo overlaps with stuff available in quilt, but some does not. See the Diff And Patch Tricks page for other utilities for manipulating patches.


Diffinfo reads a patch file, and produces information about the number of lines changed and number of hunks for each file referenced. In this regard, it is similar to diffstat. However, diffinfo can also produce a list of hunks related to specific file patterns or matching a regular expression, and can optionally write out only those hunks to a new patch file.

This allows you to extract sub-patches from a single large patch.

If no file is specified on the command line, the program reads the patch from stdin.



Command line usage

Usage: diffinfo [options] [<patch_file>]

    -h, --help       Show this usage help.
    -v, --verbose    Show verbose output (including hunk details)
    -f, --force      Force continuing even if errors are encountered
    -d               Show info in 'diffstat' format (without histogram)
    -p <path>        Show info for files matching path <path>
    -q               Specify NOT (inverse) operation of path match.
    -s <pat_string>  Show info for pattern string <pat_string>
    -a               Specify AND operation with a second pattern match
    -o               Specify OR operation with a second pattern match
    -i               Specify NOT (inverse) operation of pattern match
    -n <file>        Write matching hunks to new patch <file>
                     If <file> is "-", then output to stdout.
                     Note: This writes the entire patch unless used
                       with a matching option (-s or -p).
    -l               show a simple list of files
    -V, --version    Print the version number


This tool, when used in conjunction with diffinfo, allows you to re-isolate a broken-out series of patches using on an all-in-one patch and a previous set of broken-out patches.