Subsections

- - - - Command overview
- Common options to darcs commands
  - Selecting patches
  - Match
  - Resolution of conflicts
- Options apart from darcs commands
- Getting help
  - darcs help
- Creating repositories
  - darcs initialize
  - darcs get
  - darcs put
- Modifying the contents of a repository
  - darcs add
  - darcs remove
  - darcs mv
  - darcs replace
- Working with changes
  - darcs record
  - darcs pull
  - darcs push
  - darcs send
  - darcs apply
- Seeing what you've done
  - darcs whatsnew
  - darcs changes
  - darcs show
    - darcs show authors
    - darcs show contents
    - darcs show files
    - darcs show tags
    - darcs show repo
- More advanced commands
  - darcs tag
  - darcs setpref
  - darcs check
  - darcs optimize
- Undoing, redoing and running in circles
  - darcs amend-record
  - darcs rollback
  - darcs unrecord
  - darcs obliterate
  - darcs revert
  - darcs unrevert
- Advanced examination of the repository
  - darcs diff
  - darcs annotate
  - darcs show
    - darcs show authors
    - darcs show contents
    - darcs show files
    - darcs show tags
    - darcs show repo
- Rarely needed and obscure commands
  - darcs convert
  - darcs mark-conflicts
  - darcs dist
  - darcs trackdown
    - Example usage
  - darcs repair

# Darcs commands

The general format of a darcs command is

    % darcs COMMAND OPTIONS ARGUMENTS ...

Here `COMMAND` is a command such as `add` or `record`, which of course may have one or more arguments. Options have the form `--option` or `-o`, while arguments vary from command to command. There are many options which are common to a number of different commands, which will be summarized here.

If you wish, you may use any unambiguous beginning of a command name as a shortcut: for `darcs record`, you could type `darcs recor` or `darcs rec`, but not `darcs re` since that could be confused with `darcs replace`, `darcs revert` and `darcs remove`.

In some cases, `COMMAND` actually consists of two words, a super-command and a subcommand. For example, the ``display the manifest'' command has the form `darcs query manifest`.

#### Command overview

Not all commands modify the ``patches'' of your repository (that is, the named patches which other users can pull); some commands only affect the copy of the source tree you're working on (your ``working directory''), and some affect both. This table summarizes what you should expect from each one and will hopefully serve as guide when you're having doubts about which command to use.

affects | patches | working directory
record | yes | no
unrecord | yes | no
rollback | yes | yes
revert | no | yes
unrevert | no | yes
pull | yes | yes
obliterate | yes | yes
apply | yes | yes
push7.1 | no | no
send7.2 | no | no
put7.3 | no | no

# Common options to darcs commands

--help
Every `COMMAND` accepts `--help` as an argument, which tells it to provide a bit of help. Among other things, this help always provides an accurate listing of the options available with that command, and is guaranteed never to be out of sync with the version of darcs you actually have installed (unlike this manual, which could be for an entirely different version of darcs).

    % darcs COMMAND --help

--disable
Every `COMMAND` accepts the `--disable` option, which can be used in `_darcs/prefs/defaults` to disable some commands in the repository. This can be helpful if you want to protect the repository from accidental use of advanced commands like obliterate, unpull, unrecord or amend-record.

--verbose, --quiet, --normal-verbosity
Most commands also accept the `--verbose` option, which tells darcs to provide additional output. The amount of verbosity varies from command to command. Commands that accept `--verbose\verb` also accept `--quiet\verb`, which surpresses non-error output, and `--normal-verbosity\verb` which can be used to restore the default verbosity if `--verbose` or `--quiet` is in the defaults file.

--debug, --debug-http
Many commands also accept the `--debug` option, which causes darcs to generate additional output that may be useful for debugging its behavior, but which otherwise would not be interesting. Option `--debug-http` makes darcs output debugging info for curl and libwww.

--repodir
Another common option is the `--repodir` option, which allows you to specify the directory of the repository in which to perform the command. This option is used with commands, such as whatsnew, that ordinarily would be performed within a repository directory, and allows you to use those commands without actually being in the repository directory when calling the command. This is useful when running darcs in a pipe, as might be the case when running `apply` from a mailer.

--remote-repo

Some commands, such as `pull` require a remote repository to be specified, either from the command line or as a default. The `--remote-repo` provides an alternative way to supply this remote repository path. This flag can be seen as temporarily ``replacing'' the default repository. Setting it causes the command to ignore the default repository (it also does not affect, i.e. overwrite the default repository). On the other hand, if any other repositories are supplied as command line arguments, this flag will be ignored (and the default repository may be overwritten).

####
Selecting patches

Many commands operate on a patch or patches that have already been recorded. There are a number of options that specify which patches are selected for these operations: `--patch`, `--match`, `--tag`, and variants on these, which for `--patch` are `--patches`, `--from-patch`, and `--to-patch`. The `--patch` and `--tag` forms simply take (POSIX extended, aka `egrep`) regular expressions and match them against tag and patch names. `--match`, described below, allows more powerful patterns.

The plural forms of these options select all matching patches. The singular forms select the last matching patch. The range (from and to) forms select patches after or up to (both inclusive) the last matching patch.

These options use the current order of patches in the repository. darcs may reorder patches, so this is not necessarily the order of creation or the order in which patches were applied. However, as long as you are just recording patches in your own repository, they will remain in order.

When a patch or a group of patches is selected, all patches they depend on get silently selected too. For example: `darcs pull --patches bugfix` means ``pull all the patches with `bugfix' in their name, along with any patches they require.'' If you really only want patches with `bugfix' in their name, you should use the `--no-deps` option, which makes darcs exclude any matched patches from the selection which have dependencies that are themselves not explicitly matched by the selection.

For `unrecord`, `unpull` and `obliterate`, patches that depend on the selected patches are silently included, or if `--no-deps` is used selected patches with dependencies on not selected patches are excluded from the selection.

#### Match

Currently `--match` accepts six primitive match types, although there are plans to expand it to match more patterns. Also, note that the syntax is still preliminary and subject to change.

The first match type accepts a literal string which is checked against the patch name. The syntax is

    darcs annotate --summary --match 'exact foo+bar'

This is useful for situations where a patch name contains characters that could be considered special for regular expressions.

In this and the other match types, the argument must be enclosed in double quotes if it contains spaces. You can escape a quote in the argument with a backslash; backslash escapes itself, but it is treated literally if followed by a character other than a double quote or backslash, so it is typically not necessary to escape a backslash. No such escaping is necessary unless the argument is enclosed in double quotes.

The second match type accepts a regular expression which is checked against the patch name. The syntax is

    darcs annotate --summary --match 'name foo'

Note that to match regexp metacharacters, such as `(`, literally, they must be escaped with backslash along with any embedded double quotes. To match a literal backslash it must be written quadrupled in general, but often it need not be escaped, since backslash is only special in regexps when followed by a metacharacter. In the following example pairs, the first literal is matched by the second sequence in the match name: ```"`'':```\"`'', ```\`'':```\\\\`'', ```\x`'':```\x`'', ```(`'':```\(`''.

The third match type matches the darcs hash for each patch:

    darcs annotate --summary --match \
      'hash 20040403105958-53a90-c719567e92c3b0ab9eddd5290b705712b8b918ef'

Note you need to provide the full hash string as above. This is intended to be used, for example, by programs allowing you to view darcs repositories (e.g. CGI scripts like viewCVS).

The fourth match type accepts a regular expression which is checked against the patch author. The syntax is

    darcs annotate --summary --match 'author foo'

There is also support for matching by date. This is done using commands such as

    darcs annotate --summary --match 'date "last week"'
    darcs annotate --summary --match 'date yesterday'
    darcs annotate --summary --match 'date "today 14:00"'
    darcs annotate --summary --match 'date "tea time yesterday"'
    darcs annotate --summary --match 'date "3 days before last year at 17:00"'
    darcs changes --from-match 'date "Sat Jun  30 11:31:30 EDT 2004"'

Notes: when matching on the ISO format, a partial date is treated as a range. English dates can either refer to a specific day (``6 months ago',``day before yesterday''), or to an interval from some past date (``last month'') to the present. Putting this all together, if today is ``2004-07-24'' then the following matches should work:

date | patches selected
--- | ---
2004 | from 2004-01-01 up to and including 2004-12-31
2004-01 | from 2004-01-01 up to and including 2004-01-31
2004-01-01 | during 2004-01-01
today | during 2004-07-24 (starting midnight in your timezone)
yesterday | during 2004-07-23
6 months ago | during 2004-01-23
last 6 months | since 2004-01-23
last month | since 2004-06-23 (not 2004-06-01!)
last week | since 2004-07-16

For more precise control, you may specify an interval, either in a small subset of English or of the ISO 8601 format. If you use the ISO format, note that durations, when specified alone, are interpreted as being relative to the current date and time.

    darcs annotate --summary --match 'date "between 2004-03-12 and last week"'
    darcs annotate --summary --match 'date "after 2005"'
    darcs annotate --summary --match 'date "in the last 3 weeks"'
    darcs annotate --summary --match 'date "P3M/2006-03-17"'
    darcs annotate --summary --match 'date "2004-01-02/2006-03-17"'
    darcs annotate --summary --match 'date "P2M6D"'

You may also prefer to combine date matching with a more specific pattern.

    darcs annotate --summary --match 'date "last week" && name foo'

The sixth match type accepts a regular expression which is checked against file paths that the patch touches. The syntax is

    darcs annotate --summary --match 'touch foo/bar.c'

The `--match` pattern can include the logical operators `&&`, `||` and `not`, as well as grouping of patterns with parentheses. For example

    darcs annotate --summary --match 'name record && not name overrode'

--ignore-times
Darcs optimizes its operations by keeping track of the modification times of your files. This dramatically speeds up commands such as `whatsnew` and `record` which would otherwise require reading every file in the repository and comparing it with a reference version. However, there are times when this can cause problems, such as when running a series of darcs commands from a script, in which case often a file will be modified twice in the same second, which can lead to the second modification going unnoticed. The solution to such predicaments is the `--ignore-times` option, which instructs darcs not to trust the file modification times, but instead to check each file's contents explicitly.

--author
Several commands need to be able to identify you. Conventionally, you provide an email address for this purpose, which can include comments, e.g. `David Roundy <droundy@abridgegame.org>`. The easiest way to do this is to define an environment variable `EMAIL` or `DARCS_EMAIL` (with the latter overriding the former). You can also override this using the `--author` flag to any command. Alternatively, you could set your email address on a per-repository basis using the ``defaults'' mechanism for ``ALL'' commands, as described in Appendix . Or, you could specify the author on a per-repository basis using the `_darcs/prefs/author` file as described in section .

Also, a global author file can be created in your home directory with the name `.darcs/author`. This file overrides the contents of the environment variables, but a repository-specific author file overrides the global author file.

--dont-compress, --compress
By default, darcs commands that write patches to disk will compress the patch files. If you don't want this, you can choose the `--dont-compress` option, which causes darcs not to compress the patch file.

--dry-run
The `--dry-run` option will cause darcs not to actually take the specified action, but only print what would have happened. Not all commands accept `--dry-run`, but those that do should accept the `--summary` option.

--summary, --no-summary
The `--summary` option shows a summary of the patches that would have been pulled/pushed/whatever. The format is similar to the output format of `cvs update` and looks like this:

    A  ./added_but_not_recorded.c
    A! ./added_but_not_recorded_conflicts.c
    a  ./would_be_added_if_look_for_adds_option_was_used.h

    M  ./modified.t -1 +1
    M! ./modified_conflicts.t -1 +1

    R  ./removed_but_not_recorded.c
    R! ./removed_but_not_recorded_conflicts.c

You can probably guess what the flags mean from the clever file names.

  `A` is for files that have been added but not recorded yet.
  `a` is for files found using the `--look-for-adds` option available for `whatsnew` and `record`. They have not been added yet, but would be added automatically if `--look-for-adds` were used with the next `record` command.

  `M` is for files that have been modified in the working directory but not recorded yet. The number of added and subtracted lines is also shown.

  `R` is for files that have been removed, but the removal is not recorded yet.

An exclamation mark appears next to any option that has a conflict.

####
Resolution of conflicts

To resolve conflicts using an external tool, you need to specify a command to use, e.g.

    --external-merge 'opendiff %1 %2 -ancestor %a -merge %o'

The `%1` and `%2` are replaced with the two versions to be merged, `%a` is replaced with the common ancestor of the two versions. Most importantly, `%o` is replaced with the name of the output file that darcs will require to be created holding the merged version. The above example works with the FileMerge.app tool that comes with Apple's developer tools. To use xxdiff, you would use

    --external-merge 'xxdiff -m -O -M %o %1 %a %2'

To use `kdiff3`, you can use

    --external-merge 'kdiff3 --output %o %a %1 %2'

To use `tortoiseMerge`, you can use

    --external-merge 'tortoiseMerge /base:"%a" /mine:"%1" /theirs:"%2" /merged:"%o"'

(`tortoiseMerge` is a nice merge tool that comes with TortoiseSVN and works well on Windows.)

Note that the command is split into space-separated words and the first one is `exec`ed with the rest as arguments--it is not a shell command. In particular, on Windows this means that the first command path should not contain spaces and you should make sure the command is in your `PATH`.

The substitution of the `%` escapes is done everywhere. If you need to prevent substitution you can use a double percentage sign, i.e. `%%a` is substituted with `%a`. Here is an example script to use the Emacs' Ediff package for merging.

     #! /bin/sh
     # External merge command for darcs, using Emacs Ediff, via server if possible.
     # It needs args %1 %2 %a %o, i.e. the external merge command is, say,
     # `emerge3 %1 %2 %a %o'.
     test $# -eq 4 || exit 1
     form="(ediff-merge-files-with-ancestor"
     while test $# -gt 0; do
         count=$count.
         if [ $count = .... ]; then
             form=$form\ nil         # Lisp STARTUP-HOOKS arg
         fi
         case $1 in                  # Worry about quoting -- escape " and \
             *[\"\\]* ) form=$form\ \"$(echo $1 | sed -e's/["\\]/\\\0/g')\" ;;
             *) form=$form\ \"$1\" ;;
         esac
         shift
     done
     form=$form')'
     ( emacsclient --eval "$form" || # Emacs 22 server
       gnudoit "$form" ||            # XEmacs/Emacs 21 server
       emacs --eval "$form" ||       # Relatively slow to start up
       xemacs -eval "$form"          # Horribly slow to start up
     ) 2>/dev/null

It would be invoked like:

    --external-merge 'emerge3 %1 %2 %a %o'

If you figure out how to use darcs with another merge tool, please let me know what flags you used so I can mention it here.

Note that if you do use an external merge tool, most likely you will want to add to your defaults file (`_darcs/prefs/defaults` or `~/.darcs/prefs`, see ) a line such as

    ALL external-merge kdiff3 --output %o %a %1 %2

or

    ALL external-merge tortoiseMerge /base:"%a" /mine:"%1" /theirs:"%2" /merged:"%o"

Note that the defaults file does not want quotes around the command.

--sendmail-command

Several commands send email. The user can determine which mta to use with the `--sendmail-command` switch. For repetitive usage of a specific sendmail command it is also possible to set the environment variable `SENDMAIL`. If there is no command line switch given `SENDMAIL` will be used if present.

--posthook=COMMAND, --no-posthook
To provide a command that should be run whenever a darcs command completes successfully, use `--posthook` to specify the command. This is useful for people who want to have a command run whenever a patch is applied. Using `--no-posthook` will disable running the command.
--run-posthook, --prompt-posthook
These options control prompting before running the posthook. Use `--prompt-posthook` to have darcs prompt before running the posthook command. You may use -run-posthook to reenable the default behavior of running user-specified posthooks.

Some darcs commands export to the posthook command information about the changes being made. In particular, three environment variables are defined. `DARCS_PATCHES` contains a human-readable summary of the patches being acted upon. The format is the same as "darcs changes". `DARCS_PATCHES_XML` Contains the same details, in the same XML format as "darcs changes". Finally, `DARCS_FILES` contains a list of the files affected, one file per line. If your repository has filenames including newlines, you'll just have to cope. Note, however, that none of these environment variables are defined when running under windows. Note also that we refuse to pass environment variables greater in size than 10k, in order to avoid triggering `E2BIG` errors.

--prehook=COMMAND, --no-prehook
To provide a command that should be run before a darcs command is executed, use `--prehook` to specify the command. An example use is for people who want to have a command run whenever a patch is to be recorded, such as translating line endings before recording patches. Using `--no-prehook` will disable running the command.
--run-prehook, --prompt-prehook
These options control prompting before running the prehook. See the posthook documentation above for details.

--ssh-cm, --no-ssh-cm

For commands which invoke ssh, darcs will normally multiplex ssh sessions over a single connection as long as your version of ssh has the ControlMaster feature from OpenSSH versions 3.9 and above. This option will avoid darcs trying to use this feature even if your ssh supports it.

--http-pipelining, --no-http-pipelining

When compiled with libwww or curl (version 7.18.0 and above), darcs can use HTTP pipelining. It is enabled by default for libwww and curl (version 7.19.1 and above). This option will make darcs enable or disable HTTP pipelining, overwriting default. Note that if HTTP pipelining is really used depends on the server.

--no-cache

Do not use patch caches.

--umask
By default, Darcs will use your current umask. The option `--umask` will cause Darcs to switch to a different umask before writing to the repository.

--allow-unrelated-repos
By default darcs checks and warns user if repositories are unrelated when doing pull, push and send. This option makes darcs skip this check.

# Options apart from darcs commands

--help, --overview
Calling darcs with just `--help` as an argument gives a brief summary of what commands are available. The `--overview` option gives a more technical summary of what the commands actually do.
--version, --exact-version
Calling darcs with the flag `--version` tells you the version of darcs you are using. Calling darcs with the flag `--exact-version` gives the precise version of darcs, even if that version doesn't correspond to a released version number. This is helpful with bug reports, especially when running with a ``latest'' version of darcs.
--commands
Similarly calling darcs with only `--commands` gives a simple list of available commands. This latter arrangement is primarily intended for the use of command-line autocompletion facilities, as are available in bash.

# Getting help

##
darcs help

`Usage: darcs help [OPTION]... [<DARCS_COMMAND> [DARCS_SUBCOMMAND]]`

Options:

`--match`

shows a summary of how to use patch matching rules

Display help about darcs and darcs commands. Without arguments, `darcs help' prints a categorized list of darcs commands and a short description of each one. With an extra argument, `darcs help foo' prints detailed help about the darcs command foo.

# Creating repositories

##
darcs initialize

`Usage: darcs initialize [OPTION]...`

Options:

`--hashed`

Some new features. Compatible with older repos

`--darcs-2`

All features. Related repos must use same format [DEFAULT]

`--old-fashioned-inventory`

Minimal features. What older repos use.

`--repodir DIRECTORY`

specify the repository directory in which to run

Initialize a new source tree as a darcs repository.

Call `initialize` once for each project you work on. Run it from the top level directory of the project, with the project files already there. `initialize` will set up all the directories and files darcs needs in order to start keeping track of revisions for your project.

`initialize` creates a single directory named `_darcs`, with contents for internal use. The one subdictory of interest to users is `_darcs/prefs`, which will include an empty file `_darcs/prefs/motd` (see Section ), as well as files named `boring` and `binaries`, which contain useful defaults as described in Sections et seq.

--old-fashioned-inventory --hashed --darcs-2

These options force a particular repository format to be used.

## darcs get

`Usage: darcs get [OPTION]... <REPOSITORY> [<DIRECTORY>]`

Options:

`--repo-name DIRECTORY`,`--repodir DIRECTORY`

path of output directory

`--partial`

get partial repository using checkpoint (old-fashioned format only)

`--lazy`

get patch files only as needed

`--ephemeral`

don't save patch files in the repository

`--complete`

get a complete copy of the repository

`--to-match PATTERN`

select changes up to a patch matching PATTERN

`--to-patch REGEXP`

select changes up to a patch matching REGEXP

`-t`

`--tag REGEXP`

select tag matching REGEXP

`--context FILENAME`

version specified by the context in FILENAME

`--set-default`

set default repository [DEFAULT]

`--no-set-default`

don't set default repository

`--set-scripts-executable`

make scripts executable

`--dont-set-scripts-executable`

don't make scripts executable

`--nolinks`

do not link repository or pristine to sibling

`--hashed`

Convert darcs-1 format to hashed format

`--old-fashioned-inventory`

Convert from hashed to darcs-1 format

Advanced options:

`--ssh-cm`

use SSH ControlMaster feature

`--no-ssh-cm`

don't use SSH ControlMaster feature [DEFAULT]

`--http-pipelining`

enable HTTP pipelining

`--no-http-pipelining`

disable HTTP pipelining [DEFAULT]

`--no-cache`

don't use patch caches

If the remote repository and the current directory are in the same filesystem and that filesystem supports hard links, get will create hard links for the patch files, which means that the additional storage space needed will be minimal. This is very good for your disk usage (and for the speed of running get), so if you want multiple copies of a repository, I strongly recommend first running `darcs get` to get yourself one copy, and then running `darcs get` on that copy to make any more you like. The only catch is that the first time you run `darcs push` or `darcs pull` from any of these second copies, by default they will access your first copy--which may not be what you want.

You may specify the name of the repository created by providing a second argument to get, which is a directory name.

--context, --tag, --to-patch, --to-match
If you want to get a specific version of a repository, you have a few options. You can either use the `--tag`, `--to-patch` or `--to-match` options, or you can use the `--context=FILENAME` option, which specifies a file containing a context generated with `darcs changes --context`. This allows you (for example) to include in your compiled program an option to output the precise version of the repository from which it was generated, and then perhaps ask users to include this information in bug reports.

Note that when specifying `--to-patch` or `--to-match`, you may get a version of your code that has never before been seen, if the patches have gotten themselves reordered. If you ever want to be able to precisely reproduce a given version, you need either to tag it or create a context file.

--partial
Only get the patches since the last checkpoint. This will save time, bandwidth and disk space, at the expense of losing the history before the checkpoint.

## darcs put

`Usage: darcs put [OPTION]... <NEW REPOSITORY>`

Options:

`--to-match PATTERN`

select changes up to a patch matching PATTERN

`--to-patch REGEXP`

select changes up to a patch matching REGEXP

`-t`

`--tag REGEXP`

select tag matching REGEXP

`--context FILENAME`

version specified by the context in FILENAME

`--set-scripts-executable`

make scripts executable

`--dont-set-scripts-executable`

don't make scripts executable

`--hashed`

Convert darcs-1 format to hashed format

`--old-fashioned-inventory`

Convert from hashed to darcs-1 format

`--set-default`

set default repository [DEFAULT]

`--no-set-default`

don't set default repository

`--repodir DIRECTORY`

specify the repository directory in which to run

Advanced options:

`--apply-as USERNAME`

apply patch as another user using sudo

`--apply-as-myself`

don't use sudo to apply as another user [DEFAULT]

`--ssh-cm`

use SSH ControlMaster feature

`--no-ssh-cm`

don't use SSH ControlMaster feature [DEFAULT]

`--http-pipelining`

enable HTTP pipelining

`--no-http-pipelining`

disable HTTP pipelining [DEFAULT]

`--no-cache`

don't use patch caches

The `darcs put' command creates a copy of the current repository. It is currently very inefficient, so when creating local copies you should use `darcs get . x' instead of `darcs put x'.

Currently this command just uses `darcs init' to create the target repository, then `darcs push -all' to copy patches to it. Options passed to `darcs put' are passed to the init and/or push commands as appropriate. See those commands for an explanation of each option.

# Modifying the contents of a repository

## darcs add

`Usage: darcs add [OPTION]... <FILE or DIRECTORY> ...`

Options:

`--boring`

don't skip boring files

`--case-ok`

don't refuse to add files differing only in case

`--reserved-ok`

don't refuse to add files with Windows-reserved names

`-r`

`--recursive`

add contents of subdirectories

`--not-recursive`

don't add contents of subdirectories

`--date-trick`

add files with date appended to avoid conflict [EXPERIMENTAL]

`--no-date-trick`

don't use experimental date appending trick [DEFAULT]

`--repodir DIRECTORY`

specify the repository directory in which to run

`--dry-run`

don't actually take the action

Advanced options:

`--umask UMASK`

specify umask to use when writing

Generally a repository contains both files that should be version controlled (such as source code) and files that Darcs should ignore (such as executables compiled from the source code). The `darcs add' command is used to tell Darcs which files to version control.

When an existing project is first imported into a Darcs repository, it is common to run `darcs add -r *' or `darcs record -l' to add all initial source files into darcs.

Adding symbolic links (symlinks) is not supported.

Darcs will ignore all files and folders that look `boring'. The -boring option overrides this behaviour.

Darcs will not add file if another file in the same folder has the same name, except for case. The -case-ok option overrides this behaviour. Windows and OS X usually use filesystems that do not allow files a folder to have the same name except for case (for example, `ReadMe' and `README'). If -case-ok is used, the repository might be unusable on those systems!

The -date-trick option allows you to enable an experimental trick to make add conflicts, in which two users each add a file or directory with the same name, less problematic. While this trick is completely safe, it is not clear to what extent it is beneficial.

## darcs remove

`Usage: darcs remove [OPTION]... <FILE or DIRECTORY> ...`

Options:

`--repodir DIRECTORY`

specify the repository directory in which to run

Advanced options:

`--umask UMASK`

specify umask to use when writing

Remove should be called when you want to remove a file from your project, but don't actually want to delete the file. Otherwise just delete the file or directory, and darcs will notice that it has been removed. Be aware that the file WILL be deleted from any other copy of the repository to which you later apply the patch.

## darcs mv

`Usage: darcs mv [OPTION]... [FILE or DIRECTORY]...`

Options:

`--case-ok`

don't refuse to add files differing only in case

`--reserved-ok`

don't refuse to add files with Windows-reserved names

`--repodir DIRECTORY`

specify the repository directory in which to run

Advanced options:

`--umask UMASK`

specify umask to use when writing

Darcs mv needs to be called whenever you want to move files or directories. Unlike remove, mv actually performs the move itself in your working copy. This is why ``mv'' isn't called ``move'', since it is really almost equivalent to the unix command ``mv''.

--case-ok

Darcs mv will by default refuse to rename a file if there already exists a file having the same name apart from case. This is because doing so could create a repository that could not be used on file systems that are case insensitive (such as Apple's HFS+). You can override this by with the flag `--case-ok`.

## darcs replace

`Usage: darcs replace [OPTION]... <OLD> <NEW> <FILE> ...`

Options:

`--token-chars "[CHARS]"`

define token to contain these characters

`-f`

`--force`

proceed with replace even if 'new' token already exists

`--no-force`

don't force the replace if it looks scary

`--repodir DIRECTORY`

specify the repository directory in which to run

Advanced options:

`--ignore-times`

don't trust the file modification times

`--umask UMASK`

specify umask to use when writing

Replace allows you to change a specified token wherever it occurs in the specified files. The replace is encoded in a special patch and will merge as expected with other patches. Tokens here are defined by a regexp specifying the characters which are allowed. By default a token corresponds to a C identifier.

The default regexp is `[A-Za-z_0-9]`), and if one of your tokens contains a ``-`' or ``.`', you will then (by default) get the ``filename'' regexp, which is `[A-Za-z_0-9\-\.]`.

--token-chars

If you prefer to choose a different set of characters to define your token (perhaps because you are programming in some other language), you may do so with the `--token-chars` option. You may prefer to define tokens in terms of delimiting characters instead of allowed characters using a flag such as `--token-chars '[^ \n\t]'`, which would define a token as being white-space delimited.

If you do choose a non-default token definition, I recommend using `_darcs/prefs/defaults` to always specify the same `--token-chars`, since your replace patches will be better behaved (in terms of commutation and merges) if they have tokens defined in the same way.

When using darcs replace, the ``new'' token may not already appear in the file--if that is the case, the replace change would not be invertible. This limitation holds only on the already-recorded version of the file.

There is a potentially confusing difference, however, when a replace is used to make another replace possible:

    % darcs replace newtoken aaack ./foo.c
    % darcs replace oldtoken newtoken ./foo.c
    % darcs record

will be valid, even if `newtoken` and `oldtoken` are both present in the recorded version of foo.c, while the sequence

    % [manually edit foo.c replacing newtoken with aaack]
    % darcs replace oldtoken newtoken ./foo.c

will fail because ``newtoken'' still exists in the recorded version of `foo.c`. The reason for the difference is that when recording, a ``replace'' patch always is recorded before any manual changes, which is usually what you want, since often you will introduce new occurrences of the ``newtoken'' in your manual changes. In contrast, multiple ``replace'' changes are recorded in the order in which they were made.

# Working with changes

##
darcs record

`Usage: darcs record [OPTION]... [FILE or DIRECTORY]...`

Options:

`-m`

`--patch-name PATCHNAME`

name of patch

`-A`

`--author EMAIL`

specify author id

`--no-test`

don't run the test script

`--test`

run the test script

`--leave-test-directory`

don't remove the test directory

`--remove-test-directory`

remove the test directory

`-a`

`--all`

answer yes to all patches

`--pipe`

ask user interactively for the patch metadata

`-i`

`--interactive`

prompt user interactively

`--ask-deps`

ask for extra dependencies

`--no-ask-deps`

don't ask for extra dependencies

`--edit-long-comment`

edit the long comment by default

`--skip-long-comment`

don't give a long comment

`--prompt-long-comment`

prompt for whether to edit the long comment

`-l`

`--look-for-adds`

look for (non-boring) files that could be added

`--dont-look-for-adds`

don't look for any files that could be added [DEFAULT]

`--repodir DIRECTORY`

specify the repository directory in which to run

Advanced options:

`--logfile FILE`

give patch name and comment in file

`--delete-logfile`

delete the logfile when done

`--compress`

create compressed patches

`--dont-compress`

don't create compressed patches

`--ignore-times`

don't trust the file modification times

`--umask UMASK`

specify umask to use when writing

`--set-scripts-executable`

make scripts executable

`--dont-set-scripts-executable`

don't make scripts executable

If you provide one or more files or directories as additional arguments to record, you will only be prompted to changes in those files or directories. Each patch is given a name, which typically would consist of a brief description of the changes. This name is later used to describe the patch. The name must fit on one line (i.e. cannot have any embedded newlines). If you have more to say, stick it in the log.

The patch is also flagged with the author of the change, taken by default from the `DARCS_EMAIL` environment variable, and if that doesn't exist, from the `EMAIL` environment variable. The date on which the patch was recorded is also included. Currently there is no provision for keeping track of when a patch enters a given repository. Finally, each changeset should have a full log (which may be empty). This log is for detailed notes which are too lengthy to fit in the name. If you answer that you do want to create a comment file, darcs will open an editor so that you can enter the comment in. The choice of editor proceeds as follows. If one of the `$DARCS_EDITOR`, `$VISUAL` or `$EDITOR` environment variables is defined, its value is used (with precedence proceeding in the order listed). If not, ``vi'', ``emacs'', ``emacs -nw'' and ``nano'' are tried in that order.

--logfile

If you wish, you may specify the patch name and log using the `--logfile` flag. If you do so, the first line of the specified file will be taken to be the patch name, and the remainder will be the ``long comment''. This feature can be especially handy if you have a test that fails several times on the record (thus aborting the record), so you don't have to type in the long comment multiple times. The file's contents will override the `--patch-name` option.

--ask-deps

Each patch may depend on any number of previous patches. If you choose to make your patch depend on a previous patch, that patch is required to be applied before your patch can be applied to a repository. This can be used, for example, if a piece of code requires a function to be defined, which was defined in an earlier patch.

If you want to manually define any dependencies for your patch, you can use the `--ask-deps` flag, and darcs will ask you for the patch's dependencies.

It is possible to record a patch which has no actual changes but which has specific dependencies. This type of patch can be thought of as a ``partial tag''. The `darcs tag` command will record a patch with no actual changes but which depends on the entire current inventory of the repository. The `darcs record --ask-deps` with no selected changes will record a patch that depends on only those patches selected via the `--ask-deps` operation, resulting in a patch which describes a set of patches; the presence of this primary patch in a repository implies the presence of (at least) the depended-upon patches.

--no-test, --test

If you configure darcs to run a test suite, darcs will run this test on the recorded repository to make sure it is valid. Darcs first creates a pristine copy of the source tree (in a temporary directory), then it runs the test, using its return value to decide if the record is valid. If it is not valid, the record will be aborted. This is a handy way to avoid making stupid mistakes like forgetting to `darcs add' a new file. It also can be tediously slow, so there is an option (`--no-test`) to skip the test.

--set-scripts-executable

If you pass `--set-scripts-executable` to `darcs record`, darcs will set scripts executable in the test directory before running the test.

--pipe

If you run record with the `--pipe` option, you will be prompted for the patch date, author, and the long comment. The long comment will extend until the end of file or stdin is reached (ctrl-D on Unixy systems, ctrl-Z on systems running a Microsoft OS).

This interface is intended for scripting darcs, in particular for writing repository conversion scripts. The prompts are intended mostly as a useful guide (since scripts won't need them), to help you understand the format in which to provide the input. Here's an example of what the `--pipe` prompts look like:

     What is the date? Mon Nov 15 13:38:01 EST 2004
     Who is the author? David Roundy
     What is the log? One or more comment lines

--interactive

By default, `record` works interactively. Probably the only thing you need to know about using this is that you can press `?` at the prompt to be shown a list of the rest of the options and what they do. The rest should be clear from there. Here's a ``screenshot'' to demonstrate:

    hunk ./hello.pl +2
    +#!/usr/bin/perl
    +print "Hello World!\n";
    Shall I record this patch? (2/2) [ynWsfqadjk], or ? for help: ?
    How to use record...
    y: record this patch
    n: don't record it
    w: wait and decide later, defaulting to no

    s: don't record the rest of the changes to this file
    f: record the rest of the changes to this file

    d: record selected patches
    a: record all the remaining patches
    q: cancel record

    j: skip to next patch
    k: back up to previous patch
    h or ?: show this help

    <Space>: accept the current default (which is capitalized)

What you can't see in that ``screenshot'' is that `darcs` will also try to use color in your terminal to make the output even easier to read.

## darcs pull

`Usage: darcs pull [OPTION]... [REPOSITORY]...`

Options:

`--matches PATTERN`

select patches matching PATTERN

`-p`

`--patches REGEXP`

select patches matching REGEXP

`-t`

`--tags REGEXP`

select tags matching REGEXP

`-a`

`--all`

answer yes to all patches

`-i`

`--interactive`

prompt user interactively

`--mark-conflicts`

mark conflicts [DEFAULT]

`--allow-conflicts`

allow conflicts, but don't mark them

`--dont-allow-conflicts`

fail on patches that create conflicts

`--external-merge COMMAND`

use external tool to merge conflicts

`--test`

run the test script

`--no-test`

don't run the test script

`--dry-run`

don't actually take the action

`--xml-output`

generate XML formatted output

`-s`

`--summary`

summarize changes

`--no-summary`

don't summarize changes

`--no-deps`

don't automatically fulfill dependencies

`--dont-prompt-for-dependencies`

don't ask about patches that are depended on by matched patches (with -match or -patch)

`--prompt-for-dependencies`

prompt about patches that are depended on by matched patches [DEFAULT]

`--set-default`

set default repository [DEFAULT]

`--no-set-default`

don't set default repository

`--repodir DIRECTORY`

specify the repository directory in which to run

`--ignore-unrelated-repos`

do not check if repositories are unrelated

Advanced options:

`--intersection`

take intersection of all repositories

`--union`

take union of all repositories [DEFAULT]

`--complement`

take complement of repositories (in order listed)

`--compress`

create compressed patches

`--dont-compress`

don't create compressed patches

`--nolinks`

do not link repository or pristine to sibling

`--ignore-times`

don't trust the file modification times

`--remote-repo URL`

specify the remote repository URL to work with

`--set-scripts-executable`

make scripts executable

`--dont-set-scripts-executable`

don't make scripts executable

`--umask UMASK`

specify umask to use when writing

`--ssh-cm`

use SSH ControlMaster feature

`--no-ssh-cm`

don't use SSH ControlMaster feature [DEFAULT]

`--http-pipelining`

enable HTTP pipelining

`--no-http-pipelining`

disable HTTP pipelining [DEFAULT]

`--no-cache`

don't use patch caches

Pull is used to bring changes made in another repository into the current repository (that is, either the one in the current directory, or the one specified with the -repodir option). Pull allows you to bring over all or some of the patches that are in that repository but not in this one. Pull accepts arguments, which are URLs from which to pull, and when called without an argument, pull will use the repository from which you have most recently either pushed or pulled.

--intersection, --union [DEFAULT], --complement

If you provide more than one repository as an argument to pull, darcs' behavior is determined by the presence of the `--complement`, `--intersection`, and `--union` flags.

- The default (`--union`) behavior is to pull any patches that are in any of the specified repositories ( ).

- If you instead specify the `--intersection` flag, darcs will only pull those patches which are present in all source repositories ( ).

- If you specify the `--complement` flag, darcs will only pull elements in the first repository that do not exist in any of the remaining repositories7.4 ( )).

--external-merge

You can use an external interactive merge tool to resolve conflicts with the flag `--external-merge`. For more details see subsection .

--matches, --patches, --tags, --no-deps

The `--patches`, `--matches`, `--tags`, and `--no-deps` options can be used to select which patches to pull, as described in subsection .

--no-test, --test

If you specify the `--test` option, pull will run the test (if a test exists) on a scratch copy of the repository contents prior to actually performing the pull. If the test fails, the pull will be aborted.

--verbose

Adding the `--verbose` option causes another section to appear in the output which also displays a summary of patches that you have and the remote repository lacks. Thus, the following syntax can be used to show you all the patch differences between two repositories:

    darcs pull --dry-run --verbose

## darcs push

`Usage: darcs push [OPTION]... [REPOSITORY]`

Options:

`--matches PATTERN`

select patches matching PATTERN

`-p`

`--patches REGEXP`

select patches matching REGEXP

`-t`

`--tags REGEXP`

select tags matching REGEXP

`--no-deps`

don't automatically fulfill dependencies

`--dont-prompt-for-dependencies`

don't ask about patches that are depended on by matched patches (with -match or -patch)

`--prompt-for-dependencies`

prompt about patches that are depended on by matched patches [DEFAULT]

`-a`

`--all`

answer yes to all patches

`-i`

`--interactive`

prompt user interactively

`--sign`

sign the patch with your gpg key

`--sign-as KEYID`

sign the patch with a given keyid

`--sign-ssl IDFILE`

sign the patch using openssl with a given private key

`--dont-sign`

don't sign the patch

`--dry-run`

don't actually take the action

`--xml-output`

generate XML formatted output

`-s`

`--summary`

summarize changes

`--no-summary`

don't summarize changes

`--repodir DIRECTORY`

specify the repository directory in which to run

`--set-default`

set default repository [DEFAULT]

`--no-set-default`

don't set default repository

`--ignore-unrelated-repos`

do not check if repositories are unrelated

Advanced options:

`--apply-as USERNAME`

apply patch as another user using sudo

`--apply-as-myself`

don't use sudo to apply as another user [DEFAULT]

`--nolinks`

do not link repository or pristine to sibling

`--remote-repo URL`

specify the remote repository URL to work with

`--ssh-cm`

use SSH ControlMaster feature

`--no-ssh-cm`

don't use SSH ControlMaster feature [DEFAULT]

`--http-pipelining`

enable HTTP pipelining

`--no-http-pipelining`

disable HTTP pipelining [DEFAULT]

`--no-cache`

don't use patch caches

Push is the opposite of pull. Push allows you to copy changes from the current repository into another repository.

For obvious reasons, you can only push to repositories to which you have write access. In addition, you can only push to repos that you access either on the local file system or with ssh. In order to apply with ssh, darcs must also be installed on the remote computer. The command invoked to run ssh may be configured by the `DARCS_SSH` environment variable (see subsection ). The command invoked via ssh is always `darcs`, i.e. the darcs executable must be in the default path on the remote machine.

Push works by creating a patch bundle, and then running darcs apply in the target repository using that patch bundle. This means that the default options for apply in the target repository (such as, for example, `--test`) will affect the behavior of push. This also means that push is somewhat less efficient than pull.

When you receive an error message such as

    bash: darcs: command not found

then this means that the darcs on the remote machine could not be started. Make sure that the darcs executable is called `darcs` and is found in the default path. The default path can be different in interactive and in non-interactive shells. Say

    ssh login@remote.machine darcs

to try whether the remote darcs can be found, or

    ssh login@remote.machine 'echo $PATH'

(note the single quotes) to check the default path.

--apply-as

If you give the `--apply-as` flag, darcs will use sudo to apply the changes as a different user. This can be useful if you want to set up a system where several users can modify the same repository, but you don't want to allow them full write access. This isn't secure against skilled malicious attackers, but at least can protect your repository from clumsy, inept or lazy users.

--matches, --patches, --tags, --no-deps

The `--patches`, `--matches`, `--tags`, and `--no-deps` options can be used to select which patches to push, as described in subsection .

When there are conflicts, the behavior of push is determined by the default flags to `apply` in the target repository. Most commonly, for pushed-to repositories, you'd like to have `--dont-allow-conflicts` as a default option to apply (by default, it is already the default...). If this is the case, when there are conflicts on push, darcs will fail with an error message. You can then resolve by pulling the conflicting patch, recording a resolution and then pushing the resolution together with the conflicting patch.

Darcs does not have an explicit way to tell you which patch conflicted, only the file name. You may want to pull all the patches from the remote repository just to be sure. If you don't want to do this in your working directory, you can create another darcs working directory for this purpose.

If you want, you could set the target repository to use `--allow-conflicts`. In this case conflicting patches will be applied, but the conflicts will not be marked in the working directory.

If, on the other hand, you have `--mark-conflicts` specified as a default flag for apply in the target repository, when there is a conflict, it will be marked in the working directory of the target repository. In this case, you should resolve the conflict in the target repository itself.

## darcs send

`Usage: darcs send [OPTION]... [REPOSITORY]`

Options:

`--matches PATTERN`

select patches matching PATTERN

`-p`

`--patches REGEXP`

select patches matching REGEXP

`-t`

`--tags REGEXP`

select tags matching REGEXP

`--no-deps`

don't automatically fulfill dependencies

`--dont-prompt-for-dependencies`

don't ask about patches that are depended on by matched patches (with -match or -patch)

`--prompt-for-dependencies`

prompt about patches that are depended on by matched patches [DEFAULT]

`-a`

`--all`

answer yes to all patches

`-i`

`--interactive`

prompt user interactively

`--from EMAIL`

specify email address

`-A`

`--author EMAIL`

specify author id

`--to EMAIL`

specify destination email

`--cc EMAIL`

mail results to additional EMAIL(s). Requires -reply

`--subject SUBJECT`

specify mail subject

`--in-reply-to EMAIL`

specify in-reply-to header

`-o`

`--output FILE`

specify output filename

`-O`

`--output-auto-name[=DIRECTORY]`

output to automatically named file in DIRECTORY, default: current directory

`--sign`

sign the patch with your gpg key

`--sign-as KEYID`

sign the patch with a given keyid

`--sign-ssl IDFILE`

sign the patch using openssl with a given private key

`--dont-sign`

don't sign the patch

`--dry-run`

don't actually take the action

`--xml-output`

generate XML formatted output

`-s`

`--summary`

summarize changes

`--no-summary`

don't summarize changes

`--edit-description`

edit the patch bundle description

`--dont-edit-description`

don't edit the patch bundle description

`--set-default`

set default repository [DEFAULT]

`--no-set-default`

don't set default repository

`--repodir DIRECTORY`

specify the repository directory in which to run

`--sendmail-command COMMAND`

specify sendmail command

`--ignore-unrelated-repos`

do not check if repositories are unrelated

Advanced options:

`--logfile FILE`

give patch name and comment in file

`--delete-logfile`

delete the logfile when done

`--remote-repo URL`

specify the remote repository URL to work with

`--context FILENAME`

send to context stored in FILENAME

`--ssh-cm`

use SSH ControlMaster feature

`--no-ssh-cm`

don't use SSH ControlMaster feature [DEFAULT]

`--http-pipelining`

enable HTTP pipelining

`--no-http-pipelining`

disable HTTP pipelining [DEFAULT]

`--no-cache`

don't use patch caches

Send is used to prepare a bundle of patches that can be applied to a target repository. Send accepts the URL of the repository as an argument. When called without an argument, send will use the most recent repository that was either pushed to, pulled from or sent to. By default, the patch bundle is sent by email, although you may save it to a file.

Do not confuse the `--author` options with the return address that `darcs send` will set for your patch bundle.

For example, if you have two email addresses A and B:

  If you use `--author A` but your machine is configured to send mail from address B by default, then the return address on your message will be B.

  If you use `--from A` and your mail client supports setting the From: address arbitrarily (some non-Unix-like mail clients, especially, may not support this), then the return address will be A; if it does not support this, then the return address will be B.

  If you supply neither `--from` nor `--author`, then the return address will be B.

In addition, unless you specify the sendmail command with `--sendmail-command`, darcs sends email using the default email command on your computer. This default command is determined by the `configure` script. Thus, on some non-Unix-like OSes, `--from` is likely to not work at all.

--output, --to, --cc

The `--output`, `--output-auto-name`, and `--to` flags determine what darcs does with the patch bundle after creating it. If you provide an `--output` argument, the patch bundle is saved to that file. If you specify `--output-auto-name`, the patch bundle is saved to a file with an automatically generated name. If you give one or more `--to` arguments, the bundle of patches is sent to those locations. The locations may either be email addresses or urls that the patch should be submitted to via HTTP.

If you don't provide any of these options, darcs will look at the contents of the `_darcs/prefs/email` file in the target repository (if it exists), and send the patch by email to that address. In this case, you may use the `--cc` option to specify additional recipients without overriding the default repository email address.

If `_darcs/prefs/post` exists in the target repository, darcs will upload to the URL contained in that file, which may either be a `mailto:` URL, or an `http://` URL. In the latter case, the patch is posted to that URL.

If there is no email address associated with the repository, darcs will prompt you for an email address.

--subject

Use the `--subject` flag to set the subject of the e-mail to be sent. If you don't provide a subject on the command line, darcs will make one up based on names of the patches in the patch bundle.

--in-reply-to

Use the `--in-reply-to` flag to set the In-Reply-To and References headers of the e-mail to be sent. By default no additional headers are included so e-mail will not be treated as reply by mail readers.

--matches, --patches, --tags, --no-deps

The `--patches`, `--matches`, `--tags`, and `--no-deps` options can be used to select which patches to send, as described in subsection .

--edit-description

If you want to include a description or explanation along with the bundle of patches, you need to specify the `--edit-description` flag, which will cause darcs to open up an editor with which you can compose a message to go along with your patches.

--sendmail-command

If you want to use a command different from the default one for sending email, you need to specify a command line with the `--sendmail-command` option. The command line can contain some format specifiers which are replaced by the actual values. Accepted format specifiers are `%s` for subject, `%t` for to, `%c` for cc, `%b` for the body of the mail, `%f` for from, `%a` for the patch bundle and the same specifiers in uppercase for the URL-encoded values. Additionally you can add `%<` to the end of the command line if the command expects the complete email message on standard input. E.g. the command lines for evolution and msmtp look like this:

    evolution "mailto:%T?subject=%S&attach=%A&cc=%C&body=%B"
    msmtp -t %<

## darcs apply

`Usage: darcs apply [OPTION]... <PATCHFILE>`

Options:

`--verify PUBRING`

verify that the patch was signed by a key in PUBRING

`--verify-ssl KEYS`

verify using openSSL with authorized keys from file KEYS

`--no-verify`

don't verify patch signature

`-a`

`--all`

answer yes to all patches

`-i`

`--interactive`

prompt user interactively

`--dry-run`

don't actually take the action

`--xml-output`

generate XML formatted output

`--mark-conflicts`

mark conflicts

`--allow-conflicts`

allow conflicts, but don't mark them

`--no-resolve-conflicts`

equivalent to -dont-allow-conflicts, for backwards compatibility

`--dont-allow-conflicts`

fail on patches that create conflicts [DEFAULT]

`--external-merge COMMAND`

use external tool to merge conflicts

`--no-test`

don't run the test script

`--test`

run the test script

`--leave-test-directory`

don't remove the test directory

`--remove-test-directory`

remove the test directory

`--repodir DIRECTORY`

specify the repository directory in which to run

Advanced options:

`--reply FROM`

reply to email-based patch using FROM address

`--cc EMAIL`

mail results to additional EMAIL(s). Requires -reply

`--happy-forwarding`

forward unsigned messages without extra header

`--sendmail-command COMMAND`

specify sendmail command

`--ignore-times`

don't trust the file modification times

`--compress`

create compressed patches

`--dont-compress`

don't create compressed patches

`--set-scripts-executable`

make scripts executable

`--dont-set-scripts-executable`

don't make scripts executable

`--umask UMASK`

specify umask to use when writing

Apply is used to apply a bundle of patches to this repository. Such a bundle may be created using send.

Darcs apply accepts a single argument, which is the name of the patch file to be applied. If you omit this argument, the patch is read from standard input. Darcs also interprets an argument of `' to mean it should read the file from standard input. This allows you to use apply with a pipe from your email program, for example.

--verify

If you specify the `--verify PUBRING` option, darcs will check that the patch was GPG-signed by a key which is in `PUBRING` and will refuse to apply the patch otherwise.

--cc, --reply

If you give the `--reply FROM` option to `darcs apply`, it will send the results of the application to the sender of the patch. This only works if the patch is in the form of email with its headers intact, so that darcs can actually know the origin of the patch. The reply email will indicate whether or not the patch was successfully applied. The `FROM` flag is the email address that will be used as the ``from'' address when replying. If the darcs apply is being done automatically, it is important that this address not be the same as the address at which the patch was received, in order to avoid automatic email loops.

If you want to also send the apply email to another address (for example, to create something like a ``commits'' mailing list), you can use the `--cc` option to specify additional recipients. Note that the `--cc` option requires the `--reply` option, which provides the ``From'' address.

The `--reply` feature of apply is intended primarily for two uses. When used by itself, it is handy for when you want to apply patches sent to you by other developers so that they will know when their patch has been applied. For example, in my `.muttrc` (the config file for my mailer) I have:

    macro pager A "<pipe-entry>darcs apply --verbose \
            --reply droundy@abridgegame.org --repodir ~/darcs

which allows me to apply a patch to darcs directly from my mailer, with the originator of that patch being sent a confirmation when the patch is successfully applied. NOTE: In an attempt to make sure no one else can read your email, mutt seems to set the umask such that patches created with the above macro are not world-readable, so use it with care.

When used in combination with the `--verify` option, the `--reply` option allows for a nice pushable repository. When these two options are used together, any patches that don't pass the verify will be forwarded to the `FROM` address of the `--reply` option. This allows you to set up a repository so that anyone who is authorized can push to it and have it automatically applied, but if a stranger pushes to it, the patch will be forwarded to you. Please (for your own sake!) be certain that the `--reply FROM` address is different from the one used to send patches to a pushable repository, since otherwise an unsigned patch will be forwarded to the repository in an infinite loop.

If you use `darcs apply --verify PUBRING --reply` to create a pushable repository by applying patches automatically as they are received by email, you will also want to use the `--dont-allow-conflicts` option.

--dont-allow-conflicts
The `--dont-allow-conflicts` flag causes apply to fail when applying a patch would cause conflicts. This flag is recommended on repositories which will be pushed to or sent to.

--allow-conflicts

`--allow-conflicts` will allow conflicts, but will keep the local and recorded versions in sync on the repository. This means the conflict will exist in both locations until it is resolved.

--mark-conflicts

`--mark-conflicts` will add conflict markers to illustrate the the conflict.

--external-merge

You can use an external interactive merge tool to resolve conflicts with the flag `--external-merge`. For more details see subsection .

--all, --interactive

If you provide the `--interactive` flag, darcs will ask you for each change in the patch bundle whether or not you wish to apply that change. The opposite is the `--all` flag, which can be used to override an `interactive` which might be set in your ``defaults'' file.

--sendmail-command

If you want to use a command different from the default one for sending mail, you need to specify a command line with the `--sendmail-command` option. The command line can contain the format specifier `%t` for to and you can add `%<` to the end of the command line if the command expects the complete mail on standard input. For example, the command line for msmtp looks like this:

    msmtp -t %<

--no-test, --test

If you specify the `--test` option, apply will run the test (if a test exists) prior to applying the patch. If the test fails, the patch is not applied. In this case, if the `--reply` option was used, the results of the test are sent in the reply email. You can also specify the `--no-test` option, which will override the `--test` option, and prevent the test from being run. This is helpful when setting up a pushable repository, to keep users from running code.

# Seeing what you've done

##
darcs whatsnew

`Usage: darcs whatsnew [OPTION]... [FILE or DIRECTORY]...`

Options:

`-s`

`--summary`

summarize changes

`--no-summary`

don't summarize changes

`-u`

`--unified`

output patch in a darcs-specific format similar to diff -u

`-l`

`--look-for-adds`

look for (non-boring) files that could be added

`--dont-look-for-adds`

don't look for any files that could be added [DEFAULT]

`--repodir DIRECTORY`

specify the repository directory in which to run

Advanced options:

`--ignore-times`

don't trust the file modification times

`--boring`

don't skip boring files

List unrecorded changes in the working tree.

## darcs changes

`Usage: darcs changes [OPTION]... [FILE or DIRECTORY]...`

Options:

`--to-match PATTERN`

select changes up to a patch matching PATTERN

`--to-patch REGEXP`

select changes up to a patch matching REGEXP

`--to-tag REGEXP`

select changes up to a tag matching REGEXP

`--from-match PATTERN`

select changes starting with a patch matching PATTERN

`--from-patch REGEXP`

select changes starting with a patch matching REGEXP

`--from-tag REGEXP`

select changes starting with a tag matching REGEXP

`--last NUMBER`

select the last NUMBER patches

`-n`

`--index N-M`

select a range of patches

`--matches PATTERN`

select patches matching PATTERN

`-p`

`--patches REGEXP`

select patches matching REGEXP

`-t`

`--tags REGEXP`

select tags matching REGEXP

`--only-to-files`

show only changes to specified files

`--context`

give output suitable for get -context

`--xml-output`

generate XML formatted output

`--human-readable`

give human-readable output

`--number`

number the changes

`--count`

output count of changes

`-s`

`--summary`

summarize changes

`--no-summary`

don't summarize changes

`--reverse`

show changes in reverse order

`--repo URL`

specify the repository URL

`--repodir DIRECTORY`

specify the repository directory in which to run

`-a`

`--all`

answer yes to all patches

`-i`

`--interactive`

prompt user interactively

Advanced options:

`--ssh-cm`

use SSH ControlMaster feature

`--no-ssh-cm`

don't use SSH ControlMaster feature [DEFAULT]

`--http-pipelining`

enable HTTP pipelining

`--no-http-pipelining`

disable HTTP pipelining [DEFAULT]

`--no-cache`

don't use patch caches

Changes gives a changelog-style summary of the repository history, including options for altering how the patches are selected and displayed.

When given one or more files or directories as an argument, changes lists only those patches which affect those files or the contents of those directories or, of course, the directories themselves. This includes changes that happened to files before they were moved or renamed.

--from-match, --from-patch, --from-tag

If changes is given a `--from-patch`, `--from-match`, or `--from-tag` option, it outputs only those changes since that tag or patch.

Without any options to limit the scope of the changes, history will be displayed going back as far as possible.

--context, --human-readable, --xml-output

When given the `--context` flag, darcs changes outputs sufficient information to allow the current state of the repository to be recreated at a later date. This information should generally be piped to a file, and then can be used later in conjunction with `darcs get --context` to recreate the current version. Note that while the `--context` flag may be used in conjunction with `--xml-output` or `--human-readable`, in neither case will darcs get be able to read the output. On the other hand, sufficient information will be output for a knowledgeable human to recreate the current state of the repository.

## darcs show

The show command provides access to several subcommands which can be used to investigate the state of a repository.

### darcs show authors

`Usage: darcs show authors [OPTION]...`

Options:

`--repodir DIRECTORY`

specify the repository directory in which to run

The authors command writes a list of all patch authors in the repository to standard output.

### darcs show contents

`Usage: darcs show contents [OPTION]... [FILE]...`

Options:

`--match PATTERN`

select a single patch matching PATTERN

`-p`

`--patch REGEXP`

select a single patch matching REGEXP

`-t`

`--tag REGEXP`

select tag matching REGEXP

`-n`

`--index N-M`

select a range of patches

`--repodir DIRECTORY`

specify the repository directory in which to run

Show contents can be used to display an earlier version of some file(s). If you give show contents no version arguments, it displays the recorded version of the file(s).

###
darcs show files

`Usage: darcs show files [OPTION]...`

Options:

`--files`

include files in output [DEFAULT]

`--no-files`

don't include files in output

`--directories`

include directories in output [DEFAULT]

`--no-directories`

don't include directories in output

`--pending`

reflect pending patches in output [DEFAULT]

`--no-pending`

only included recorded patches in output

`-0`

`--null`

separate file names by NUL characters

`--repodir DIRECTORY`

specify the repository directory in which to run

The files command lists the version-controlled files in the working copy. The similar manifest command, lists the same files, excluding any directories.

By default (and if the `--pending` option is specified), the effect of pending patches on the repository is taken into account. In other words, if you add a file using `darcs add`, it immediately appears in the output of `query manifest`, even if it is not yet recorded. If you specify the `--no-pending` option, `query manifest` will only list recorded files (and directories).

The `--files` and `--directories` options control whether files and directories are included in the output. The `--no-files` and `--no-directories` options have the reverse effect. The default is to include files, but not directories.

If you specify the `--null` option, the file names are written to standard output in unescaped form, and separated by ASCII NUL bytes. This format is suitable for further automatic processing (for example, using `xargs -0`).

### darcs show tags

`Usage: darcs show tags [OPTION]...`

Options:

`--repodir DIRECTORY`

specify the repository directory in which to run

The tags command writes a list of all tags in the repository to standard output.

Tab characters (ASCII character 9) in tag names are changed to spaces for better interoperability with shell tools. A warning is printed if this happens.

### darcs show repo

`Usage: darcs show repo [OPTION]...`

Options:

`--repodir DIRECTORY`

specify the repository directory in which to run

`--files`

include files in output [DEFAULT]

`--no-files`

don't include files in output

`--xml-output`

generate XML formatted output

The `show repo` displays information about the current repository: the location, the type, etc.

This is provided as informational output for two purposes: curious users and scripts invoking darcs. For the latter, this information can be parsed to facilitate the script; for example, `darcs show repo | grep Root: | awk {print $2}` can be used to locate the top-level `_darcs` directory from anyplace within a darcs repository working directory.

--files, --no-files

If the `--files` option is specified (the default), then the `show repo` operation will read patch information from the repository and display the number of patches in the repository. The `--no-files` option can be used to suppress this operation (and improve performance).

--human-readable, --xml-output

By default, the `show repo` displays output in human readable form, but the `--xml-output` option can be used to obtain XML-formatted to facilitate regular parsing by external tools.

# More advanced commands

## darcs tag

Name the current repository state for future reference. `Usage: darcs tag [OPTION]... [TAGNAME]`

Options:

`-m`

`--patch-name PATCHNAME`

name of patch

`-A`

`--author EMAIL`

specify author id

`--checkpoint`

create a checkpoint file (see get -partial)

`--pipe`

ask user interactively for the patch metadata

`-i`

`--interactive`

prompt user interactively

`--edit-long-comment`

edit the long comment by default

`--skip-long-comment`

don't give a long comment

`--prompt-long-comment`

prompt for whether to edit the long comment

`--repodir DIRECTORY`

specify the repository directory in which to run

Advanced options:

`--compress`

create compressed patches

`--dont-compress`

don't create compressed patches

`--umask UMASK`

specify umask to use when writing

The `darcs tag' command names the current repository state, so that it can easily be referred to later. Every `important' state should be tagged; in particular it is good practice to tag each stable release with a number or codename. Advice on release numbering can be found at http://producingoss.com/en/development-cycle.html.

To reproduce the state of a repository `R' as at tag `t', use the command `darcs get -tag t R'. The command `darcs show tags' lists all tags in the current repository.

Tagging also provides significant performance benefits: when Darcs reaches a shared tag that depends on all antecedent patches, it can simply stop processing.

Like normal patches, a tag has a name, an author, a timestamp and an optional long description, but it does not change the working tree. A tag can have any name, but it is generally best to pick a naming scheme and stick to it.

The `darcs tag' command accepts the -pipe and -checkpoint options, which behave as described in `darcs record' and `darcs optimize' respectively.

## darcs setpref

## darcs check

`Usage: darcs check [OPTION]...`

Options:

`--complete`

get a complete copy of the repository

`--partial`

get partial repository using checkpoint (old-fashioned format only)

`--no-test`

don't run the test script

`--test`

run the test script

`--leave-test-directory`

don't remove the test directory

`--remove-test-directory`

remove the test directory

`--repodir DIRECTORY`

specify the repository directory in which to run

Check the repository for consistency.

If you like, you can configure your repository to be able to run a test suite of some sort. You can do this by using ``setpref'' to set the ``test'' value to be a command to run, e.g.

    % darcs setpref test "sh configure && make && make test"

Or, if you want to define a test specific to one copy of the repository, you could do this by editing the file `_darcs/prefs/prefs`.

--leave-test-directory, --remove-test-directory

Normally darcs deletes the directory in which the test was run afterwards. Sometimes (especially when the test fails) you'd prefer to be able to be able to examine the test directory after the test is run. You can do this by specifying the `--leave-test-directory` flag. Alas, there is no way to make darcs leave the test directory only if the test fails. The opposite of `--leave-test-directory` is `--remove-test-directory`, which could come in handy if you choose to make `--leave-test-directory` the default (see section ).

## darcs optimize

`Usage: darcs optimize [OPTION]...`

Options:

`--checkpoint`

create a checkpoint file (see get -partial)

`-t`

`--tag TAGNAME`

name of version to checkpoint

`--repodir DIRECTORY`

specify the repository directory in which to run

`--reorder-patches`

reorder the patches in the repository

`--sibling URL`

specify a sibling directory

`--relink`

relink random internal data to a sibling

`--relink-pristine`

relink pristine tree (not recommended)

Advanced options:

`--compress`

create compressed patches

`--dont-compress`

don't create compressed patches

`--uncompress`

uncompress patches

`--umask UMASK`

specify umask to use when writing

Optimize can help to improve the performance of your repository in a number of cases.

Optimize always writes out a fresh copy of the inventory that minimizes the amount of inventory that need be downloaded when people pull from the repository.

Specifically, it breaks up the inventory on the most recent tag. This speeds up most commands when run remotely, both because a smaller file needs to be transfered (only the most recent inventory). It also gives a guarantee that all the patches prior to a given tag are included in that tag, so less commutation and history traversal is needed. This latter issue can become very important in large repositories.

--checkpoint, --tag

If you use the `--checkpoint` option, optimize creates a checkpoint patch for a tag. You can specify the tag with the `--tag` option, or just let darcs choose the most recent tag. Note that optimize `--checkpoint` will fail when used on a ``partial'' repository. Also, the tag that is to be checkpointed must not be preceded by any patches that are not included in that tag. If that is the case, no checkpointing is done.

The created checkpoint is used by the `--partial` flag to `get` and `check`. This allows for users to retrieve a working repository with limited history with a savings of disk space and bandwidth.

--compress, --dont-compress, --uncompress

Some compression options are available, and are independent of the `--checkpoint` option.

By default the patches in the repository are compressed. These use less disk space, which translates into less bandwidth if the repository is accessed remotely.

Note that in the darcs-1.0 (also known as ``old fashioned inventory'') repository format, patches will always have the ``.gz'' extension whether they are compressed or not.

You may want to uncompress the patches when you've got enough disk space but are running out of physical memory.

If you give the `--compress` option, optimize will compress all the patches in the repository. Similarly, if you give the `--uncompress`, optimize will decompress all the patches in the repository. `--dont-compress` means ``don't compress, but don't uncompress either''. It would be useful if one of the compression options was provided as a default and you wanted to override it.

--relink

The `--relink` and `--relink-pristine` options cause Darcs to relink files from a sibling. See Section .

--reorder-patches

The `--reorder-patches` option causes Darcs to create an optimal ordering of its internal patch inventory. This may help to produce shorter `context' lists when sending patches, and may improve performance for some other operations as well. You should not run `--reorder-patches` on a repository from which someone may be simultaneously pulling or getting, as this could lead to repository corruption.

# Undoing, redoing and running in circles

## darcs amend-record

`Usage: darcs amend-record [OPTION]... [FILE or DIRECTORY]...`

Options:

`--match PATTERN`

select a single patch matching PATTERN

`-p`

`--patch REGEXP`

select a single patch matching REGEXP

`-n`

`--index N-M`

select a range of patches

`--no-test`

don't run the test script

`--test`

run the test script

`--leave-test-directory`

don't remove the test directory

`--remove-test-directory`

remove the test directory

`-a`

`--all`

answer yes to all patches

`-i`

`--interactive`

prompt user interactively

`-A`

`--author EMAIL`

specify author id

`-m`

`--patch-name PATCHNAME`

name of patch

`--edit-long-comment`

edit the long comment by default

`--skip-long-comment`

don't give a long comment

`--prompt-long-comment`

prompt for whether to edit the long comment

`-l`

`--look-for-adds`

look for (non-boring) files that could be added

`--dont-look-for-adds`

don't look for any files that could be added [DEFAULT]

`--repodir DIRECTORY`

specify the repository directory in which to run

Advanced options:

`--compress`

create compressed patches

`--dont-compress`

don't create compressed patches

`--ignore-times`

don't trust the file modification times

`--umask UMASK`

specify umask to use when writing

`--set-scripts-executable`

make scripts executable

`--dont-set-scripts-executable`

don't make scripts executable

Amend-record updates a `draft' patch with additions or improvements, resulting in a single `finished' patch. This is better than recording the additions and improvements as separate patches, because then whenever the `draft' patch is copied between repositories, you would need to make sure all the extra patches are copied, too.

Do not copy draft patches between repositories, because a finished patch cannot be copied into a repository that contains a draft of the same patch. If this has already happened, `darcs obliterate' can be used to remove the draft patch.

Do not run amend-record in repository that other developers can pull from, because if they pull while an amend-record is in progress, their repository may be corrupted.

When recording a draft patch, it is a good idea to start the name with `DRAFT:' so that other developers know it is not finished. When finished, remove it with `darcs amend-record -edit-description'.

Like `darcs record', if you call amend-record with files as arguments, you will only be asked about changes to those files. So to amend a patch to foo.c with improvements in bar.c, you would run:

darcs amend-record -match 'touch foo.c' bar.c

It is usually a bad idea to amend another developer's patch. To make amend-record only ask about your own patches by default, you can add something like `amend-record match David Roundy' to /.darcs/defaults, where `David Roundy' is your name.

## darcs rollback

`Usage: darcs rollback [OPTION]... [FILE or DIRECTORY]...`

Options:

`--from-match PATTERN`

select changes starting with a patch matching PATTERN

`--from-patch REGEXP`

select changes starting with a patch matching REGEXP

`--from-tag REGEXP`

select changes starting with a tag matching REGEXP

`--last NUMBER`

select the last NUMBER patches

`--matches PATTERN`

select patches matching PATTERN

`-p`

`--patches REGEXP`

select patches matching REGEXP

`-t`

`--tags REGEXP`

select tags matching REGEXP

`-a`

`--all`

answer yes to all patches

`-i`

`--interactive`

prompt user interactively

`-A`

`--author EMAIL`

specify author id

`-m`

`--patch-name PATCHNAME`

name of patch

`--edit-long-comment`

edit the long comment by default

`--skip-long-comment`

don't give a long comment

`--prompt-long-comment`

prompt for whether to edit the long comment

`--no-test`

don't run the test script

`--test`

run the test script

`--leave-test-directory`

don't remove the test directory

`--remove-test-directory`

remove the test directory

`--repodir DIRECTORY`

specify the repository directory in which to run

Advanced options:

`--compress`

create compressed patches

`--dont-compress`

don't create compressed patches

`--umask UMASK`

specify umask to use when writing

Rollback is used to undo the effects of one or more patches without actually deleting them. Instead, it creates a new patch reversing selected portions. of those changes. Unlike obliterate and unrecord (which accomplish a similar goal) rollback is perfectly safe, since it leaves in the repository a record of its changes. If you decide you didn't want to roll back a patch after all, you can reverse its effect by obliterating the rolled-back patch.

Rollback can actually allow you to roll back a subset of the changes made by the selected patch or patches. Many of the options available in rollback behave similarly to the options for unrecord and record .

##
darcs unrecord

`Usage: darcs unrecord [OPTION]...`

Options:

`--from-match PATTERN`

select changes starting with a patch matching PATTERN

`--from-patch REGEXP`

select changes starting with a patch matching REGEXP

`--from-tag REGEXP`

select changes starting with a tag matching REGEXP

`--last NUMBER`

select the last NUMBER patches

`--matches PATTERN`

select patches matching PATTERN

`-p`

`--patches REGEXP`

select patches matching REGEXP

`-t`

`--tags REGEXP`

select tags matching REGEXP

`--no-deps`

don't automatically fulfill dependencies

`--dont-prompt-for-dependencies`

don't ask about patches that are depended on by matched patches (with -match or -patch)

`--prompt-for-dependencies`

prompt about patches that are depended on by matched patches [DEFAULT]

`-a`

`--all`

answer yes to all patches

`-i`

`--interactive`

prompt user interactively

`--repodir DIRECTORY`

specify the repository directory in which to run

Advanced options:

`--compress`

create compressed patches

`--dont-compress`

don't create compressed patches

`--umask UMASK`

specify umask to use when writing

Unrecord does the opposite of record in that it makes the changes from patches active changes again which you may record or revert later. The working copy itself will not change. Beware that you should not use this command if you are going to re-record the changes in any way and there is a possibility that another user may have already pulled the patch.

Unrecord can be thought of as undo-record. If a record is followed by an unrecord, everything looks like before the record; all the previously unrecorded changes are back, and can be recorded again in a new patch. The unrecorded patch however is actually removed from your repository, so there is no way to record it again to get it back.7.5.

If you want to remove the changes from the working copy too (where they otherwise will show up as unrecorded changes again), you'll also need to `darcs revert`. To do unrecord and revert in one go, you can use `darcs obliterate`.

If you don't revert after unrecording, then the changes made by the unrecorded patches are left in your working tree. If these patches are actually from another repository, interaction (either pushes or pulls) with that repository may be massively slowed down, as darcs tries to cope with the fact that you appear to have made a large number of changes that conflict with those present in the other repository. So if you really want to undo the result of a pull operation, use obliterate! Unrecord is primarily intended for when you record a patch, realize it needs just one more change, but would rather not have a separate patch for just that one change.

WARNING: Unrecord should not be run when there is a possibility that another user may be pulling from the same repository. Attempting to do so may cause repository corruption.

--from-match, --from-patch, --from-tag, --last

Usually you only want to unrecord the latest changes, and almost never would you want to unrecord changes before a tag--you would have to have unrecorded the tag as well to do that. Therefore, and for efficiency, darcs only prompts you for the latest patches, after some optimal tag.

If you do want to unrecord more patches in one go, there are the `--from` and `--last` options to set the earliest patch selectable to unrecord.

--matches, --patches, --tags, --no-deps

The `--patches`, `--matches`, `--tags`, and `--no-deps` options can be used to select which patches to unrecord, as described in subsection .

With these options you can specify what patch or patches to be prompted for by unrecord. This is especially useful when you want to unrecord patches with dependencies, since all the dependent patches (but no others) will be included in the choices. Or if you use `--no-deps` you won't be asked about patches that can't be unrecorded due to depending patches.

Selecting patches can be slow, so darcs cuts the search at the last optimized tag. Use the `--from` or `--last` options to search more or fewer patches.

## darcs obliterate

`Usage: darcs obliterate [OPTION]...`

Options:

`--from-match PATTERN`

select changes starting with a patch matching PATTERN

`--from-patch REGEXP`

select changes starting with a patch matching REGEXP

`--from-tag REGEXP`

select changes starting with a tag matching REGEXP

`--last NUMBER`

select the last NUMBER patches

`--matches PATTERN`

select patches matching PATTERN

`-p`

`--patches REGEXP`

select patches matching REGEXP

`-t`

`--tags REGEXP`

select tags matching REGEXP

`--no-deps`

don't automatically fulfill dependencies

`--dont-prompt-for-dependencies`

don't ask about patches that are depended on by matched patches (with -match or -patch)

`--prompt-for-dependencies`

prompt about patches that are depended on by matched patches [DEFAULT]

`-a`

`--all`

answer yes to all patches

`-i`

`--interactive`

prompt user interactively

`--repodir DIRECTORY`

specify the repository directory in which to run

Advanced options:

`--compress`

create compressed patches

`--dont-compress`

don't create compressed patches

`--ignore-times`

don't trust the file modification times

`--umask UMASK`

specify umask to use when writing

Obliterate completely removes recorded patches from your local repository. The changes will be undone in your working copy and the patches will not be shown in your changes list anymore. Beware that you can lose precious code by obliterating!

Obliterate deletes a patch from the repository and removes those changes from the working directory. It is therefore a very dangerous command. When there are no local changes, obliterate is equivalent to an unrecord followed by a revert, except that revert can be unreverted. In the case of tags, obliterate removes the tag itself, not any other patches.

Note that unpull was the old name for obliterate. Unpull is still an hidden alias for obliterate.

WARNING: Obliterate should not be run when there is a possibility that another user may be pulling from the same repository. Attempting to do so may cause repository corruption.

--from-match, --from-patch, --from-tag, --last

Usually you only want to obliterate the latest changes, and almost never would you want to obliterate changes before a tag--you would have to have obliterated the tag as well to do that. Therefore, and for efficiency, darcs only prompts you for the latest patches, after some optimal tag.

If you do want to obliterate more patches in one go, there are the `--from` and `--last` options to set the earliest patch selectable to obliterate.

--matches, --patches, --tags, --no-deps

The `--patches`, `--matches`, `--tags`, and `--no-deps` options can be used to select which patches to obliterate, as described in subsection .

With these options you can specify what patch or patches to be prompted for by obliterate. This is especially useful when you want to obliterate patches with dependencies, since all the dependent patches (but no others) will be included in the choices. Or if you use `--no-deps` you won't be asked about patches that can't be obliterated due to depending patches.

Selecting patches can be slow, so darcs cuts the search at the last optimized tag. Use the `--from` or `--last` options to search more or fewer patches.

## darcs revert

`Usage: darcs revert [OPTION]... [FILE or DIRECTORY]...`

Options:

`-a`

`--all`

answer yes to all patches

`-i`

`--interactive`

prompt user interactively

`--repodir DIRECTORY`

specify the repository directory in which to run

Advanced options:

`--ignore-times`

don't trust the file modification times

`--umask UMASK`

specify umask to use when writing

Revert is used to undo changes made to the working copy which have not yet been recorded. You will be prompted for which changes you wish to undo. The last revert can be undone safely using the unrevert command if the working copy was not modified in the meantime. The actions of a revert may be reversed using the unrevert command (see subsection ). However, if you've made changes since the revert your mileage may vary, so please be careful.

You can give revert optional arguments indicating files or directories. If you do so it will only prompt you to revert changes in those files or in files in those directories.

##
darcs unrevert

`Usage: darcs unrevert [OPTION]...`

Options:

`--ignore-times`

don't trust the file modification times

`-a`

`--all`

answer yes to all patches

`-i`

`--interactive`

prompt user interactively

`--repodir DIRECTORY`

specify the repository directory in which to run

Advanced options:

`--umask UMASK`

specify umask to use when writing

Unrevert is a rescue command in case you accidentally reverted something you wanted to keep (for example, accidentally typing `darcs rev -a' instead of `darcs rec -a').

This command may fail if the repository has changed since the revert took place. Darcs will ask for confirmation before executing an interactive command that will *definitely* prevent unreversion.

# Advanced examination of the repository

## darcs diff

`Usage: darcs diff [OPTION]... [FILE or DIRECTORY]...`

Options:

`--to-match PATTERN`

select changes up to a patch matching PATTERN

`--to-patch REGEXP`

select changes up to a patch matching REGEXP

`--to-tag REGEXP`

select changes up to a tag matching REGEXP

`--from-match PATTERN`

select changes starting with a patch matching PATTERN

`--from-patch REGEXP`

select changes starting with a patch matching REGEXP

`--from-tag REGEXP`

select changes starting with a tag matching REGEXP

`--match PATTERN`

select a single patch matching PATTERN

`-p`

`--patch REGEXP`

select a single patch matching REGEXP

`--last NUMBER`

select the last NUMBER patches

`-n`

`--index N-M`

select a range of patches

`--diff-command COMMAND`

specify diff command (ignores -diff-opts)

`--diff-opts OPTIONS`

options to pass to diff

`-u`

`--unified`

pass -u option to diff

`--repodir DIRECTORY`

specify the repository directory in which to run

`--store-in-memory`

do patch application in memory rather than on disk

Diff can be used to create a diff between two versions which are in your repository. Specifying just -from-patch will get you a diff against your working copy. If you give diff no version arguments, it gives you the same information as whatsnew except that the patch is formatted as the output of a diff command

--diff-opts

Diff calls an external ``diff'' command to do the actual work, and passes any unrecognized flags to this diff command. Thus you can call

    % darcs diff -t 0.9.8 -t 0.9.10 -- -u

to get a diff in the unified format. Actually, thanks to the wonders of getopt you need the ```--`'' shown above before any arguments to diff. You can also specify additional arguments to diff using the `--diff-opts` flag. The above command would look like this:

    % darcs diff --diff-opts -u -t 0.9.8 -t 0.9.10

This may not seem like an improvement, but it really pays off when you want to always give diff the same options. You can do this by adding

    % diff diff-opts -udp

to your `_darcs/prefs/defaults` file.

If you want to view only the differences to one or more files, you can do so with a command such as

    % darcs diff foo.c bar.c baz/

--diff-command

You can use a different program to view differences by including the flag `--diff-command`, e.g.

    --diff-command 'opendiff %1 %2'.

The `%1` and `%2` are replaced with the two versions to be merged. The above example works with the FileMerge.app tool that comes with Apple's developer tools. To use xxdiff, you would use

    --diff-command 'xxdiff %1 %2'

To use `kdiff3`, you can use

    --diff-command 'kdiff3 %1 %2'

Note that the command is split into space-separated words and the first one is `exec`ed with the rest as arguments--it is not a shell command. Also the substitution of the `%` escapes is only done on complete words. See for how you might work around this fact, for example, with Emacs' Ediff package.

Note also that the `--diff-opts` flag is ignored if you use this option.

##
darcs annotate

`Usage: darcs annotate [OPTION]... [FILE or DIRECTORY]...`

Options:

`-s`

`--summary`

summarize changes

`--no-summary`

don't summarize changes

`-u`

`--unified`

output patch in a darcs-specific format similar to diff -u

`--human-readable`

give human-readable output

`--xml-output`

generate XML formatted output

`--match PATTERN`

select a single patch matching PATTERN

`-p`

`--patch REGEXP`

select a single patch matching REGEXP

`-t`

`--tag REGEXP`

select tag matching REGEXP

`-n`

`--index N-M`

select a range of patches

`--creator-hash HASH`

specify hash of creator patch (see docs)

`--repodir DIRECTORY`

specify the repository directory in which to run

Display which patch last modified something. Annotate displays which patches created or last modified a directory file or line. It can also display the contents of a particular patch in darcs format.

--human-readable, --summary, --unified, --xml--output

When called with just a patch name, annotate outputs the patch in darcs format, which is the same as `--human-readable`.

`--xml-output` is the alternative to `--human-readable`.

`--summary` can be used with either the `--xml-output` or the `--human-readable` options to alter the results. It is documented fully in the `common options' portion of the manual.

Giving the `--unified` flag implies `--human-readable`, and causes the output to remain in a darcs-specific format that is similar to that produced by `diff --unified`.

If a directory name is given, annotate will output details of the last modifying patch for each file in the directory and the directory itself. The details look like this:

     # Created by [bounce handling patch
     # mark**20040526202216]  as ./test/m7/bounce_handling.pl
        bounce_handling.pl

If a patch name and a directory are given, these details are output for the time after that patch was applied. If a directory and a tag name are given, the details of the patches involved in the specified tagged version will be output.

If a file name is given, the last modifying patch details of that file will be output, along with markup indicating patch details when each line was last (and perhaps next) modified.

If a patch name and a file name are given, these details are output for the time after that patch was applied.

--creator-hash HASH

The `--creator-hash` option should only be used in combination with a file or directory to be annotated. In this case, the name of that file or directory is interpreted to be its name at the time it was created, and the hash given along with `--creator-hash` indicates the patch that created the file or directory. This allows you to (relatively) easily examine a file even if it has been renamed multiple times.

## darcs show

The show command provides access to several subcommands which can be used to investigate the state of a repository.

### darcs show authors

`Usage: darcs show authors [OPTION]...`

Options:

`--repodir DIRECTORY`

specify the repository directory in which to run

The authors command writes a list of all patch authors in the repository to standard output.

### darcs show contents

`Usage: darcs show contents [OPTION]... [FILE]...`

Options:

`--match PATTERN`

select a single patch matching PATTERN

`-p`

`--patch REGEXP`

select a single patch matching REGEXP

`-t`

`--tag REGEXP`

select tag matching REGEXP

`-n`

`--index N-M`

select a range of patches

`--repodir DIRECTORY`

specify the repository directory in which to run

Show contents can be used to display an earlier version of some file(s). If you give show contents no version arguments, it displays the recorded version of the file(s).

###
darcs show files

`Usage: darcs show files [OPTION]...`

Options:

`--files`

include files in output [DEFAULT]

`--no-files`

don't include files in output

`--directories`

include directories in output [DEFAULT]

`--no-directories`

don't include directories in output

`--pending`

reflect pending patches in output [DEFAULT]

`--no-pending`

only included recorded patches in output

`-0`

`--null`

separate file names by NUL characters

`--repodir DIRECTORY`

specify the repository directory in which to run

The files command lists the version-controlled files in the working copy. The similar manifest command, lists the same files, excluding any directories.

By default (and if the `--pending` option is specified), the effect of pending patches on the repository is taken into account. In other words, if you add a file using `darcs add`, it immediately appears in the output of `query manifest`, even if it is not yet recorded. If you specify the `--no-pending` option, `query manifest` will only list recorded files (and directories).

The `--files` and `--directories` options control whether files and directories are included in the output. The `--no-files` and `--no-directories` options have the reverse effect. The default is to include files, but not directories.

If you specify the `--null` option, the file names are written to standard output in unescaped form, and separated by ASCII NUL bytes. This format is suitable for further automatic processing (for example, using `xargs -0`).

### darcs show tags

`Usage: darcs show tags [OPTION]...`

Options:

`--repodir DIRECTORY`

specify the repository directory in which to run

The tags command writes a list of all tags in the repository to standard output.

Tab characters (ASCII character 9) in tag names are changed to spaces for better interoperability with shell tools. A warning is printed if this happens.

### darcs show repo

`Usage: darcs show repo [OPTION]...`

Options:

`--repodir DIRECTORY`

specify the repository directory in which to run

`--files`

include files in output [DEFAULT]

`--no-files`

don't include files in output

`--xml-output`

generate XML formatted output

The `show repo` displays information about the current repository: the location, the type, etc.

This is provided as informational output for two purposes: curious users and scripts invoking darcs. For the latter, this information can be parsed to facilitate the script; for example, `darcs show repo | grep Root: | awk {print $2}` can be used to locate the top-level `_darcs` directory from anyplace within a darcs repository working directory.

--files, --no-files

If the `--files` option is specified (the default), then the `show repo` operation will read patch information from the repository and display the number of patches in the repository. The `--no-files` option can be used to suppress this operation (and improve performance).

--human-readable, --xml-output

By default, the `show repo` displays output in human readable form, but the `--xml-output` option can be used to obtain XML-formatted to facilitate regular parsing by external tools.

# Rarely needed and obscure commands

## darcs convert

`Usage: darcs convert [OPTION]... <REPOSITORY> [<DIRECTORY>]`

Options:

`--repo-name DIRECTORY`,`--repodir DIRECTORY`

path of output directory

`--set-scripts-executable`

make scripts executable

`--dont-set-scripts-executable`

don't make scripts executable

Advanced options:

`--ssh-cm`

use SSH ControlMaster feature

`--no-ssh-cm`

don't use SSH ControlMaster feature [DEFAULT]

`--http-pipelining`

enable HTTP pipelining

`--no-http-pipelining`

disable HTTP pipelining [DEFAULT]

`--no-cache`

don't use patch caches

You may specify the name of the repository created by providing a second argument to convert, which is a directory name.

## darcs mark-conflicts

`Usage: darcs mark-conflicts [OPTION]...`

Options:

`--ignore-times`

don't trust the file modification times

`--repodir DIRECTORY`

specify the repository directory in which to run

Advanced options:

`--umask UMASK`

specify umask to use when writing

Darcs requires human guidance to unify changes to the same part of a source file. When a conflict first occurs, darcs will add both choices to the working tree, delimited by markers.

However, you might revert or manually delete these markers without actually resolving the conflict. In this case, `darcs mark-conflicts' is useful to show where any unresolved conflicts. It is also useful if `darcs apply' is called with -apply-conflicts, where conflicts aren't marked initially.

Any unrecorded changes to the working tree *will* be lost forever when you run this command! You will be prompted for confirmation before this takes place.

This command was historically called `resolve', and this deprecated alias still exists for backwards-compatibility.

## darcs dist

`Usage: darcs dist [OPTION]...`

Options:

`-d`

`--dist-name DISTNAME`

name of version

`--repodir DIRECTORY`

specify the repository directory in which to run

`--match PATTERN`

select a single patch matching PATTERN

`-p`

`--patch REGEXP`

select a single patch matching REGEXP

`-t`

`--tag REGEXP`

select tag matching REGEXP

`-n`

`--index N-M`

select a range of patches

`--store-in-memory`

do patch application in memory rather than on disk

The `darcs dist' command creates a compressed archive (a `tarball') in the repository's root directory, containing the recorded state of the working tree (unrecorded changes and the _darcs directory are excluded).

If a predist command is set (see `darcs setpref'), that command will be run on the tarball contents prior to archiving. For example, autotools projects would set it to `autoconf && automake'.

By default, the tarball (and the top-level directory within the tarball) has the same name as the repository, but this can be overridden with the -dist-name option.

## darcs trackdown

`Usage: darcs trackdown [OPTION]... [[INITIALIZATION] COMMAND]`

Options:

`--repodir DIRECTORY`

specify the repository directory in which to run

Advanced options:

`--set-scripts-executable`

make scripts executable

`--dont-set-scripts-executable`

don't make scripts executable

Trackdown tries to find the most recent version in the repository which passes a test. Given no arguments, it uses the default repository test. Given one argument, it treats it as a test command. Given two arguments, the first is an initialization command with is run only once, and the second is the test command.

Trackdown is helpful for locating when something was broken. It creates a temporary directory with the latest repository content in it and cd to it. First, and only once, it runs the initialization command if any, for example

    'autoconf; ./configure >/dev/null'

Then it runs the test command, for example

    'make && cd tests && sh /tmp/test.sh'

While the test command exits with an error return code, darcs ``unapplies'' one patch from the version controlled files to retrieve an earlier version, and repeats the test command. If the test command finally succeeds, the name of the hunted down patch is found in the output before the last test run.

FIXME: It is still rather primitive. Currently it just goes back over the history in reverse order trying each version. I'd like for it to explore different patch combinations, to try to find the minimum number of patches that you would need to obliterate in order to make the test succeed.

FIXME: I also would like to add an interface by which you can tell it which patches it should consider not including. Without such a feature, the following command:

    % darcs trackdown 'make && false'

would result in compiling every version in the repository-which is a rather tedious prospect.

### Example usage

If you want to find the last version of darcs that had a FIXME note in the file Record.lhs, you could run

    % darcs trackdown 'grep FIXME Record.lhs'

To find the latest version that compiles, you can run

    % darcs trackdown 'autoconf' './configure && make'

Trackdown can also be used to see how other features of the code changed with time. For example

    % darcs trackdown 'autoconf; ./configure' \
       "make darcs > /dev/null && cd ~/darcs && time darcs check && false"

would let you see how long `darcs check' takes to run on each previous version of darcs that will actually compile. The ```&& false`'' ensures that trackdown keeps going.

## darcs repair

`Usage: darcs repair [OPTION]...`

Options:

`--repodir DIRECTORY`

specify the repository directory in which to run

Advanced options:

`--umask UMASK`

specify umask to use when writing

The `darcs repair' command attempts to fix corruption in the current repository. Currently it can only repair damage to the pristine tree, which is where most corruption occurs.