26.5.4 Quilt Support

Quilt is not a version control system, therefore this is not implemented as a backend. It can help keeping track of a series of patches. People use it to keep a set of changes they want to use on top of software packages (which is tightly integrated into the package build process - the Debian project does this for a large number of packages). Quilt can also help individual developers keep track of their own patches on top of real version control systems.

The vcs_info integration tries to support both ways of using quilt by having two slightly different modes of operation: ‘addon’ mode and ‘standalone’ mode).

Quilt integration is off by default; to enable it, set the use-quilt style, and add %Q to your formats or actionformats style:

zstyle ':vcs_info:*' use-quilt true

Styles looked up from the Quilt support code include ‘.quilt-quilt-mode’ in the vcs-string part of the context, where quilt-mode is either addon or standalone. Example: :vcs_info:git.quilt-addon:default:repo-root-name.

For ‘addon’ mode to become active vcs_info must have already detected a real version control system controlling the directory. If that is the case, a directory that holds quilt’s patches needs to be found. That directory is configurable via the ‘QUILT_PATCHES’ environment variable. If that variable exists its value is used, otherwise the value ‘patches’ is assumed. The value from $QUILT_PATCHES can be overwritten using the ‘quilt-patch-dir’ style. (Note: you can use vcs_info to keep the value of $QUILT_PATCHES correct all the time via the post-quilt hook).

When the directory in question is found, quilt is assumed to be active. To gather more information, vcs_info looks for a directory called ‘.pc’; Quilt uses that directory to track its current state. If this directory does not exist we know that quilt has not done anything to the working directory (read: no patches have been applied yet).

If patches are applied, vcs_info will try to find out which. If you want to know which patches of a series are not yet applied, you need to activate the get-unapplied style in the appropriate context.

vcs_info allows for very detailed control over how the gathered information is presented (see Configuration and Hooks in vcs_info), all of which are documented below. Note there are a number of other patch tracking systems that work on top of a certain version control system (like stgit for git, or mq for hg); the configuration for systems like that are generally configured the same way as the quilt support.

If the quilt support is working in ‘addon’ mode, the produced string is available as a simple format replacement (%Q to be precise), which can be used in formats and actionformats; see below for details).

If, on the other hand, the support code is working in ‘standalone’ mode, vcs_info will pretend as if quilt were an actual version control system. That means that the version control system identifier (which otherwise would be something like ‘svn’ or ‘cvs’) will be set to ‘-quilt-’. This has implications on the used style context where this identifier is the second element. vcs_info will have filled in a proper value for the "repository’s" root directory and the string containing the information about quilt’s state will be available as the ‘misc’ replacement (and %Q for compatibility with ‘addon’ mode).

What is left to discuss is how ‘standalone’ mode is detected. The detection itself is a series of searches for directories. You can have this detection enabled all the time in every directory that is not otherwise under version control. If you know there is only a limited set of trees where you would like vcs_info to try and look for Quilt in ‘standalone’ mode to minimise the amount of searching on every call to vcs_info, there are a number of ways to do that:

Essentially, ‘standalone’ mode detection is controlled by a style called ‘quilt-standalone’. It is a string style and its value can have different effects. The simplest values are: ‘always’ to run detection every time vcs_info is run, and ‘never’ to turn the detection off entirely.

If the value of quilt-standalone is something else, it is interpreted differently. If the value is the name of a scalar variable the value of that variable is checked and that value is used in the same ‘always’/‘never’ way as described above.

If the value of quilt-standalone is an array, the elements of that array are used as directory names under which you want the detection to be active.

If quilt-standalone is an associative array, the keys are taken as directory names under which you want the detection to be active, but only if the corresponding value is the string ‘true’.

Last, but not least, if the value of quilt-standalone is the name of a function, the function is called without arguments and the return value decides whether detection should be active. A ‘0’ return value is true; a non-zero return value is interpreted as false.

Note, if there is both a function and a variable by the name of quilt-standalone, the function will take precedence.