The scripts in this package simplify working with a series of patches.
The usual tasks like applying, refreshing and reversing are supported.

Please see the paper "How To Survive With Many Patches /or/
Introduction to Quilt" for an introduction.


Command reference
=================

quilt add [-p patch] {file} ...

  Add one or more files to the topmost or named patch.  Files must be
  added to the patch before being modified.  Files that are modified by
  patches already applied on top of the specified patch cannot be added.

  -p patch
  	Patch to add files to.


quilt annotate {file}

  Print an annotated listing of the specified file showing which
  patches modify which lines.


quilt applied [patch]

  Print a list of applied patches, or all patches up to and including the
  specified patch in the file series.


quilt delete [patch | -n]

  Remove the specified or topmost patch from the series file.  If the
  patch is applied, quilt will attempt to remove it first. (Only the
  topmost patch can be removed right now.)

  -n	Delete the next patch after topmost, rather than the specified
  	or topmost patch.


quilt diff [-p n] [-u|-U num|-c|-C num] [--combine patch|-z] [-R] [-P patch] [--snapshot] [--diff=utility] [--no-timestamps] [--no-index] [--sort] [--color] [file ...]

  Produces a diff of the specified file(s) in the topmost or specified
  patch.  If no files are specified, all files that are modified are
  included.

  -p n	Create a -p n style patch (-p0 or -p1 are supported).

  -u, -U num, -c, -C num
  	Create a unified diff (-u, -U) with num lines of context. Create
  	a context diff (-c, -C) with num lines of context. The number of
  	context lines defaults to 3.

  --no-timestamps
  	Do not include file timestamps in patch headers.

  --no-index
  	Do not output Index: lines.

  -z	Write to standard output the changes that have been made
  	relative to the topmost or specified patch.

  -R	Create a reverse diff.

  -P patch
  	Create a diff for the specified patch.  (Defaults to the topmost
  	patch.)

  --combine patch
  	Create a combined diff for all patches between this patch and
  	the patch specified with -P. A patch name of "-" is equivalent
  	to specifying the first applied patch.

  --snapshot
  	Diff against snapshot (see `quilt snapshot -h').

  --diff=utility
  	Use the specified utility for generating the diff. The utility
  	is invoked with the original and new file name as arguments.

  --color[=always|auto|never]
  	Use syntax coloring.

  --sort	Sort files by their name instead of preserving the original order.


quilt edit file ...

  Edit the specified file(s) in $EDITOR (vi) after adding it (them) to
  the topmost patch.


quilt files [-v] [-a] [-l] [--combine patch] [patch]

  Print the list of files that the topmost or specified patch changes.

  -a	List all files in all applied patches.

  -l	Add patch name to output.

  -v	Verbose, more user friendly output.

  --combine patch
  	Create a listing for all patches between this patch and
  	the topmost applied patch. A patch name of "-" is equivalent
  	to specifying the first applied patch.



quilt fold [-p strip-level]

  Integrate the patch read from standard input into the topmost patch:
  After making sure that all files modified are part of the topmost
  patch, the patch is applied with the specified strip level (which
  defaults to 1).

  -p strip-level
  	The number of pathname components to strip from file names
  	when applying patchfile.


quilt fork [new_name]

  Fork the topmost patch.  Forking a patch means creating a verbatim copy
  of it under a new name, and use that new name instead of the original
  one in the current series.  This is useful when a patch has to be
  modified, but the original version of it should be preserved, e.g.
  because it is used in another series, or for the history.  A typical
  sequence of commands would be: fork, edit, refresh.

  If new_name is missing, the name of the forked patch will be the current
  patch name, followed by "-2".  If the patch name already ends in a
  dash-and-number, the number is further incremented (e.g., patch.diff,
  patch-2.diff, patch-3.diff).


quilt graph [--all] [--reduce] [--lines[=num]] [--edge-labels=files] [patch]

  Generate a dot(1) directed graph showing the dependencies between
  applied patches. A patch depends on another patch if both touch the same
  file or, with the --lines option, if their modifications overlap. Unless
  otherwise specified, the graph includes all patches that the topmost
  patch depends on.
  When a patch name is specified, instead of the topmost patch, create a
  graph for the specified patch. The graph will include all other patches
  that this patch depends on, as well as all patches that depend on this
  patch.

  --all	Generate a graph including all applied patches and their
  	dependencies. (Unapplied patches are not included.)

  --reduce
  	Eliminate transitive edges from the graph.

  --lines[=num]
  	Compute dependencies by looking at the lines the patches modify.
  	Unless a different num is specified, two lines of context are
  	included.

  --edge-labels=files
  	Label graph edges with the file names that the adjacent patches
  	modify.

  -T ps	Directly produce a PostScript output file.


quilt grep [-h|options] {pattern}

  Grep through the source files, recursively, skipping patches and quilt
  meta-information. If no filename argument is given, the whole source
  tree is searched. Please see the grep(1) manual page for options.

  -h	Print this help. The grep -h option can be passed after a
  	double-dash (--). Search expressions that start with a dash
  	can be passed after a second double-dash (-- --).


quilt header [-a|-r|-e] [--backup] [--strip-diffstat] [--strip-trailing-whitespace] [patch]

  Print or change the header of the topmost or specified patch.

  -a, -r, -e
  	Append to (-a) or replace (-r) the exiting patch header, or
  	edit (-e) the header in $EDITOR (vi). If none of these options is
  	given, print the patch header.
  	
  --strip-diffstat
  	Strip diffstat output from the header.

  --strip-trailing-whitespace
  	Strip trailing whitespace at the end of lines of the header.

  --backup
  	Create a backup copy of the old version of a patch as patch~.


quilt import [-f] [-p num] [-n patch] patchfile ...

  Import external patches.

  -p num
  	Number of directory levels to strip when applying (default=1)

  -n patch
  	Patch filename to use inside quilt. This option can only be
  	used when importing a single patch.

  -f	Overwite/update existing patches.


quilt mail {--mbox file|--send} [--from ...] [--to ...] [--cc ...] [--bcc ...] [--subject ...]

  Create mail messages from all patches in the series file, and either store
  them in a mailbox file, or send them immediately. The editor is opened
  with a template for the introductory message. Please see the file
  /usr/share/doc/quilt/README.MAIL for details.

  --mbox file
  	Store all messages in the specified file in mbox format. The mbox
  	can later be sent using formail, for example.

  --send
  	Send the messages directly using /usr/sbin/sendmail.

  --from, --subject
  	The values for the From and Subject headers to use.

  --to, --cc, --bcc
  	Append a recipient to the To, Cc, or Bcc header.


quilt new {patchname}

  Create a new patch with the specified file name, and insert it after the
  topmost patch in the patch series file.


quilt next [patch]

  Print the name of the next patch after the specified or topmost patch in
  the series file.


quilt patches {file}

  Print the list of patches that modify the specified file. (Uses a
  heuristic to determine which files are modified by unapplied patches.
  Note that this heuristic is much slower than scanning applied patches.)

  -v	Verbose, more user friendly output.


quilt pop [-afRqv] [num|patch]

  Remove patch(es) from the stack of applied patches.  Without options,
  the topmost patch is removed.  When a number is specified, remove the
  specified number of patches.  When a patch name is specified, remove
  patches until the specified patch end up on top of the stack.  Patch
  names may include the patches/ prefix, which means that filename
  completion can be used.

  -a	Remove all applied patches.

  -f	Force remove. The state before the patch(es) were applied will
  	be restored from backup files.

  -R	Always verify if the patch removes cleanly; don't rely on
  	timestamp checks.

  -q	Quiet operation.

  -v	Verbose operation.


quilt previous [patch]

  Print the name of the previous patch before the specified or topmost
  patch in the series file.


quilt push [-afqv] [--leave-rejects] [num|patch]

  Apply patch(es) from the series file.  Without options, the next patch
  in the series file is applied.  When a number is specified, apply the
  specified number of patches.  When a patch name is specified, apply
  all patches up to and including the specified patch.  Patch names may
  include the patches/ prefix, which means that filename completion can
  be used.

  -a	Apply all patches in the series file.

  -f	Force apply, even if the patch has rejects.

  -q	Quiet operation.

  -v	Verbose operation.

  --leave-rejects
  	Leave around the reject files patch produced, even if the patch
  	is not actually applied.

  --interactive
  	Allow the patch utility to ask how to deal with conflicts. If
  	this option is not given, the -f option will be passed to the 
  	patch program.

  --color[=always|auto|never]
  	Use syntax coloring.


quilt refresh [-p n] [-f] [--no-timestamps] [--no-index] [--diffstat] [--sort] [--backup] [--strip-trailing-whitespace] [patch]

  Refreshes the specified patch, or the topmost patch by default.
  Documentation that comes before the actual patch in the patch file is
  retained.

  It is possible to refresh patches that are not on top.  If any patches
  on top of the patch to refresh modify the same files, the script aborts
  by default.  Patches can still be refreshed with -f.  In that case this
  script will print a warning for each shadowed file, changes by more
  recent patches will be ignored, and only changes in files that have not
  been modified by any more recent patches will end up in the specified
  patch.

  -p n	Create a -p n style patch (-p0 or -p1 supported).

  -u, -U num, -c, -C num
  	Create a unified diff (-u, -U) with num lines of context. Create
  	a context diff (-c, -C) with num lines of context. The number of
  	context lines defaults to 3.

  --no-timestamps
  	Do not include file timestamps in patch headers.
  	
  --no-index
  	Do not output Index: lines.

  --diffstat
  	Add a diffstat section to the patch header, or replace the
  	existing diffstat section.

  -f	Enforce refreshing of a patch that is not on top.

  --backup
  	Create a backup copy of the old version of a patch as patch~.

  --sort	Sort files by their name instead of preserving the original order.

  --strip-trailing-whitespace
  	Strip trailing whitespace at the end of lines.


quilt remove [-p patch] {file} ...

  Remove one or more files from the topmost or named patch.  Files that
  are modified by patches on top of the specified patch cannot be removed.

  -p patch
  	Patch to remove files from.


quilt rename [-p patch] new_name

  Rename the topmost or named patch.

  -p patch
  	Patch to rename.


quilt series [-v]

  Print the names of all patches in the series file.

  -v	Verbose, more user friendly output.


quilt setup [-d path-prefix] [-v] {specfile|seriesfile}

  Initializes a source tree from an rpm spec file or a quilt series file.

  -d	optional path prefix (sub-directory).

  -v	verbose debug output.


quilt snapshot [-d]

  Take a snapshot of the current working state.  After taking the snapshot,
  the tree can be modified in the usual ways, including pushing and
  popping patches.  A diff against the tree at the moment of the
  snapshot can be generated with `quilt diff --snapshot'.

  -d	Only remove current snapshot.


quilt top

  Print the name of the topmost patch on the current stack of applied
  patches.


quilt unapplied [patch]

  Print a list of patches that are not applied, or all patches that follow
  the specified patch in the series file.


quilt upgrade

  Upgrade the meta-data in a working tree from an old version of quilt to the
  current version. This command is only needed when the quilt meta-data format
  has changed, and the working tree still contains old-format meta-data. In that
  case, quilt will request to run `quilt upgrade'.


guards [--prefix=dir] [--path=dir1:dir2:...] [--default=0|1]
[--check] [--config=file] symbol ...

Convert a series file with conditional statements into a series
file as expected; see the guards(1) manual page.


Helper files/scripts
====================

patchfns
A collection of functions.

parse-patch {-s|-u} section file [< replacement]
Select a %section from a patch (-s) or replace a
%section with the text from standard input (-u).

touched-by-patch filename
Print a list of files modified by a patch file.

backup-files
A simple utility that creates / restores / removes
backup files.

