Next: Building darcs Up: Darcs User Manual Previous: Repository Formats Contents
Subsections

- - - - Command overview
- Common options to darcs commands
  - Selecting patches
  - Match
    - DARCS_EMAIL and EMAIL
    - Resolution of conflicts
    - SENDMAIL
  - Posthooks
  - Prehooks
- 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 move
  - 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
- Switching from CVS
  - Darcs commands for CVS users
  - Migrating CVS repositories to darcs
- Switching from arch
  - Darcs commands for arch users
  - Migrating arch repositories to darcs

# 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
push6.1 | no | no
send6.2 | no | no
put6.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` also accept `--quiet`, which surpresses non-error output, and `--normal-verbosity` 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 libcurl.

--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 eight 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"'

Only English date specifications are supported--specifically you must use English day and month names. Also, only a limited set of time zones is supported (compatible with GNU coreutils' date parsing). Unrecognized zones are treated as UTC, which may result in the timestamps printed in change entries not being recognized by the date matching. You can avoid this problem on a POSIX-like system by running darcs in the UTC zone to get the times initially, e.g.:

    TZ=UTC darcs changes

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 seventh match type accepts a regular expression which is checked against every hunk. The syntax is

    darcs annotate --summary --match 'hunk "^instance .* Foo where$"'

The eight match type accepts a regular expression which is checked against the long comment. The syntax is

    darcs annotate --summary --match 'comment "remote repository"'

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, --no-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

####
DARCS_EMAIL and EMAIL

Each patch is attributed to its author, usually by email address (for example, `Fred Bloggs <fred@example.net>'). Darcs looks in several places for this author string: the -author option, the files _darcs/prefs/author (in the repository) and /.darcs/author (in your home directory), and the environment variables $DARCS_EMAIL and $EMAIL. If none of those exist, Darcs will prompt you for an author string and write it to _darcs/prefs/author.

--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 , on MS Windows ) 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

####
SENDMAIL

On Unix, the `darcs send' command relies on sendmail(8). The `-sendmail-command' or $SENDMAIL environment variable can be used to provide an explicit path to this program; otherwise the standard locations /usr/sbin/sendmail and /usr/lib/sendmail will be tried.

## Posthooks

--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.

## Prehooks

--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 libcurl (version 7.18.0 and above), darcs can use HTTP pipelining. It is enabled by default for libcurl (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.

--dont-restrict-paths, --restrict-paths
By default darcs is only allowed to manage and modify files and directories contained inside the current repository and not being part of any darcs repository's meta data (including the current one). This is mainly for security, to protect you from spoofed patches modifying arbitrary files with sensitive data--say, in your home directory--or tampering with any repository's meta data to switch off this safety guard.

But sometimes you may want to manage a group of ``sub'' repositories' preference files with a global repository, or use darcs in some other advanced way. The best way is probably to put `ALL dont-restrict-paths` in `_darcs/prefs/defaults`. This turns off all sanity checking for file paths in patches.

Path checking can be temporarily turned on with `--restrict-paths` on the command line, when pulling or applying unknown patches.

--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.

--just-this-repo
This option limits the check or repair to the current repo and omits any caches or other repos listed as a source of patches.

--check
This option specifies checking mode.

--repair
This option specifies repair mode.

# Options apart from darcs commands

--help
Calling darcs with just `--help` as an argument gives a brief summary of what commands are available.
--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

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.

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

Options:

Display help about darcs and darcs commands.

# Creating repositories

##
darcs initialize

The `darcs initialize' command turns the current directory into a Darcs repository. Any existing files and subdirectories become UNSAVED changes in the working tree: record them with `darcs add -r' and `darcs record'.

When converting a project to Darcs from some other VCS, translating the full revision history to native Darcs patches is recommended. (The Darcs wiki lists utilities for this.) Because Darcs is optimized for small patches, simply importing the latest revision as a single large patch can PERMANENTLY degrade Darcs performance in your repository by an order of magnitude.

This command creates the `_darcs' directory, which stores version control metadata. It also contains per-repository settings in _darcs/prefs/, which you can read about in the user manual.

In addition to the default `darcs-2' format, there are two backward compatibility formats for the _darcs directory. These formats are only useful if some of your contributors do not have access to Darcs 2.0 or higher. In that case, you need to use the original format (called `old-fashioned inventory' or `darcs-1') for any repositories those contributors access.

As patches cannot be shared between darcs-2 and darcs-1 repositories, you cannot use the darcs-2 format for private branches of such a project. Instead, you should use the `hashed' format, which provides most of the features of the darcs-2 format, while retaining the ability to share patches with darcs-1 repositories. The `darcs get' command will do this by default.

Once all contributors have access to Darcs 2.0 or higher, a darcs-1 project can be migrated to darcs-2 using the `darcs convert' command.

Darcs will create a hashed repository by default when you `darcs get' a repository in old-fashioned inventory format. Once all contributors have upgraded to Darcs 2.0 or later, use `darcs convert' to convert the project to the darcs-2 format.

Initialize is commonly abbreviated to `init'.

`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

Make the current directory a repository.

##
darcs get

Get creates a local copy of a repository. The optional second argument specifies a destination directory for the new copy; if omitted, it is inferred from the source location.

By default Darcs will copy every patch from the original repository. This means the copy is completely independent of the original; you can operate on the new repository even when the original is inaccessible. If you expect the original repository to remain accessible, you can use -lazy to avoid copying patches until they are needed (`copy on demand'). This is particularly useful when copying a remote repository with a long history that you don't care about.

The -lazy option isn't as useful for local copies, because Darcs will automatically use `hard linking' where possible. As well as saving time and space, you can move or delete the original repository without affecting a complete, hard-linked copy. Hard linking requires that the copy be on the same filesystem and the original repository, and that the filesystem support hard linking. This includes NTFS, HFS+ and all general-purpose Unix filesystems (such as ext3, UFS and ZFS). FAT does not support hard links.

Darcs get will not copy unrecorded changes to the source repository's working tree.

It is often desirable to make a copy of a repository that excludes some patches. For example, if releases are tagged then `darcs get -tag .' would make a copy of the repository as at the latest release.

An untagged repository state can still be identified unambiguously by a context file, as generated by `darcs changes -context'. Given the name of such a file, the -context option will create a repository that includes only the patches from that context. When a user reports a bug in an unreleased version of your project, the recommended way to find out exactly what version they were running is to have them include a context file in the bug report.

You can also make a copy of an untagged state using the -to-patch or -to-match options, which exclude patches `after' the first matching patch. Because these options treat the set of patches as an ordered sequence, you may get different results after reordering with `darcs optimize', so tagging is preferred.

If the source repository is in a legacy darcs-1 format and contains at least one checkpoint (see `darcs optimize'), the -partial option will create a partial repository. A partial repository discards history from before the checkpoint in order to reduce resource requirements. For modern darcs-2 repositories, -partial is a deprecated alias for the -lazy option.

A repository created by `darcs get' will be in the best available format: it will be able to exchange patches with the source repository, but will not be directly readable by Darcs binaries older than 2.0.0. Use the `-old-fashioned-inventory' option if the latter is required.

`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`,`--no-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
| `--remote-darcs COMMAND` |
name of the darcs executable on the remote server

Create a local copy of a repository.

##
darcs put

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.

`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`,`--no-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
| `--no-apply-as` |
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
| `--remote-darcs COMMAND` |
name of the darcs executable on the remote server

Makes a copy of the repository

# Modifying the contents of a repository

##
darcs add

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.

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

Options:

| `--boring` |
don't skip boring files
| `--no-boring` |
skip borign files [DEFAULT]
| `--case-ok` |
don't refuse to add files differing only in case
| `--no-case-ok` |
refuse to add files whose name differ only in case [DEFAULT]
| `--reserved-ok` |
don't refuse to add files with Windows-reserved names
| `--no-reserved-ok` |
refuse to add files with Windows-reserved names [DEFAULT]
`-r` | `--recursive` |
add contents of subdirectories
| `--not-recursive`,`--no-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

Add one or more new files or directories.

##
darcs remove

The `darcs remove' command exists primarily for symmetry with `darcs add', as the normal way to remove a file from version control is simply to delete it from the working tree. This command is only useful in the unusual case where one wants to record a removal patch WITHOUT deleting the copy in the working tree (which can be re-added).

Note that applying a removal patch to a repository (e.g. by pulling the patch) will ALWAYS affect the working tree of that repository.

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

Options:

| `--repodir DIRECTORY` |
specify the repository directory in which to run
`-r` | `--recursive` |
recurse into subdirectories
| `--not-recursive`,`--no-recursive` |
don't recurse into subdirectories

Advanced options:

| `--umask UMASK` |
specify umask to use when writing

Remove files from version control.

##
darcs move

Darcs cannot reliably distinguish between a file being deleted and a new one added, and a file being moved. Therefore Darcs always assumes the former, and provides the `darcs mv' command to let Darcs know when you want the latter. This command will also move the file in the working tree (unlike `darcs remove'), unless it has already been moved.

Darcs will not rename a 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!

`Usage: darcs move [OPTION]... <SOURCE> ... <DESTINATION>`

Options:

| `--case-ok` |
don't refuse to add files differing only in case
| `--no-case-ok` |
refuse to add files whose name differ only in case [DEFAULT]
| `--reserved-ok` |
don't refuse to add files with Windows-reserved names
| `--no-reserved-ok` |
refuse to add files with Windows-reserved names [DEFAULT]
| `--repodir DIRECTORY` |
specify the repository directory in which to run

Advanced options:

| `--umask UMASK` |
specify umask to use when writing

Move or rename files.

##
darcs replace

In addition to line-based patches, Darcs supports a limited form of lexical substitution. Files are treated as sequences of words, and each occurrence of the old word is replaced by the new word. This is intended to provide a clean way to rename a function or variable. Such renamings typically affect lines all through the source code, so a traditional line-based patch would be very likely to conflict with other branches, requiring manual merging.

Files are tokenized according to one simple rule: words are strings of valid token characters, and everything between them (punctuation and whitespace) is discarded. By default, valid token characters are letters, numbers and the underscore (i.e. [A-Za-z0-9_]). However if the old and/or new token contains either a hyphen or period, BOTH hyphen and period are treated as valid (i.e. [A-Za-z0-9_.-]).

The set of valid characters can be customized using the -token-chars option. The argument must be surrounded by square brackets. If a hyphen occurs between two characters in the set, it is treated as a set range. For example, in most locales [A-Z] denotes all uppercase letters. If the first character is a caret, valid tokens are taken to be the complement of the remaining characters. For example, [^:n] could be used to match fields in the passwd(5), where records and fields are separated by newlines and colons respectively.

If you choose to use -token-chars, you are STRONGLY encouraged to do so consistently. The consequences of using multiple replace patches with different -token-chars arguments on the same file are not well tested nor well understood.

By default Darcs will refuse to perform a replacement if the new token is already in use, because the replacements would be not be distinguishable from the existing tokens. This behaviour can be overridden by supplying the -force option, but an attempt to `darcs rollback' the resulting patch will affect these existing tokens.

Limitations:

The tokenizer treats files as byte strings, so it is not possible for -token-chars to include multi-byte characters, such as the non-ASCII parts of UTF-8. Similarly, trying to replace a `high-bit' character from a unibyte encoding will also result in replacement of the same byte in files with different encodings. For example, an acute a from ISO 8859-1 will also match an alpha from ISO 8859-7.

Due to limitations in the patch file format, -token-chars arguments cannot contain literal whitespace. For example, [^ nt] cannot be used to declare all characters except the space, tab and newline as valid within a word, because it contains a literal space.

Unlike POSIX regex(7) bracket expressions, character classes (such as [[:alnum:]]) are NOT supported by -token-chars, and will be silently treated as a simple set of characters.

`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
| `--no-ignore-times` |
trust modification times to find modified files [DEFAULT]
| `--umask UMASK` |
specify umask to use when writing

Substitute one word for another. 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

The `darcs record' command is used to create a patch from changes in the working tree. If you specify a set of files and directories, changes to other files will be skipped.

Every patch has a name, an optional description, an author and a date.

The patch name should be a short sentence that concisely describes the patch, such as `Add error handling to main event loop.' You can supply it in advance with the -m option, or provide it when prompted.

The patch description is an optional block of free-form text. It is used to supply additional information that doesn't fit in the patch name. For example, it might include a rationale of WHY the change was necessary. By default Darcs asks if you want to add a description; the -edit-long-comment and -skip-long-comment can be used to answer `yes' or `no' (respectively) to this prompt. Finally, the -logfile option allows you to supply a file that already contains the patch name (first line) and patch description (subsequent lines). This is useful if a previous record failed and left a darcs-record-0 file.

Each patch is attributed to its author, usually by email address (for example, `Fred Bloggs <fred@example.net>'). Darcs looks in several places for this author string: the -author option, the files _darcs/prefs/author (in the repository) and /.darcs/author (in your home directory), and the environment variables $DARCS_EMAIL and $EMAIL. If none of those exist, Darcs will prompt you for an author string and write it to _darcs/prefs/author.

The patch date is generated automatically. It can only be spoofed by using the -pipe option.

If a test command has been defined with `darcs setpref', attempting to record a patch will cause the test command to be run in a clean copy of the working tree (that is, including only recorded changes). If the test fails, the record operation will be aborted.

The -set-scripts-executable option causes scripts to be made executable in the clean copy of the working tree, prior to running the test. See `darcs get' for an explanation of the script heuristic.

If your test command is tediously slow (e.g. `make all') and you are recording several patches in a row, you may wish to use -no-test to skip all but the final test.

`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`,`--no-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
| `--no-delete-logfile` |
keep the logfile when done [DEFAULT]
| `--compress` |
create compressed patches
| `--dont-compress`,`--no-compress` |
don't create compressed patches
| `--ignore-times` |
don't trust the file modification times
| `--no-ignore-times` |
trust modification times to find modified files [DEFAULT]
| `--umask UMASK` |
specify umask to use when writing
| `--set-scripts-executable` |
make scripts executable
| `--dont-set-scripts-executable`,`--no-set-scripts-executable` |
don't make scripts executable

Create a patch from unrecorded changes.

--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.

--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

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.

`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`,`--no-allow-conflicts` |
fail if there patches that would create conflicts
| `--skip-conflicts` |
filter out any patches that would 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`,`--no-compress` |
don't create compressed patches
| `--nolinks` |
do not link repository or pristine to sibling
| `--ignore-times` |
don't trust the file modification times
| `--no-ignore-times` |
trust modification times to find modified files [DEFAULT]
| `--remote-repo URL` |
specify the remote repository URL to work with
| `--set-scripts-executable` |
make scripts executable
| `--dont-set-scripts-executable`,`--no-set-scripts-executable` |
don't make scripts executable
| `--umask UMASK` |
specify umask to use when writing
| `--restrict-paths` |
don't allow darcs to touch external files or repo metadata
| `--dont-restrict-paths`,`--no-restrict-paths` |
allow darcs to modify any file or directory (unsafe)
| `--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
| `--remote-darcs COMMAND` |
name of the darcs executable on the remote server

Copy and apply patches from another repository to this one.

--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 repositories6.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

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

`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`,`--no-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
| `--no-apply-as` |
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
| `--remote-darcs COMMAND` |
name of the darcs executable on the remote server

Copy and apply patches from this repository to another one.

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

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.

`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)
| `--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`,`--no-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`,`--no-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
| `--no-delete-logfile` |
keep the logfile when done [DEFAULT]
| `--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
| `--remote-darcs COMMAND` |
name of the darcs executable on the remote server

Send by email a bundle of one or more patches.

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

The `darcs apply' command takes a patch bundle and attempts to insert it into the current repository. In addition to invoking it directly on bundles created by `darcs send', it is used internally by `darcs push' and `darcs put' on the remote end of an SSH connection.

If no file is supplied, the bundle is read from standard input.

If given an email instead of a patch bundle, Darcs will look for the bundle as a MIME attachment to that email. Currently this will fail if the MIME boundary is rewritten, such as in Courier and Mail.app.

If the `-reply noreply@example.net' option is used, and the bundle is attached to an email, Darcs will send a report (indicating success or failure) to the sender of the bundle (the To field). The argument to noreply is the address the report will appear to originate FROM.

The -cc option will cause the report to be CC'd to another address, for example `-cc reports@lists.example.net,admin@lists.example.net'. Using -cc without -reply is undefined.

If gpg(1) is installed, you can use `-verify pubring.gpg' to reject bundles that aren't signed by a key in pubring.gpg.

If -test is supplied and a test is defined (see `darcs setpref'), the bundle will be rejected if the test fails after applying it. In that case, the rejection email from -reply will include the test output.

A patch bundle may introduce unresolved conflicts with existing patches or with the working tree. By default, Darcs will add conflict markers (see `darcs mark-conflicts').

The -allow-conflicts option will skip conflict marking; this is useful when you want to treat a repository as just a bunch of patches, such as using `darcs pull -union' to download of your co-workers patches before going offline.

This can mess up unrecorded changes in the working tree, forcing you to resolve the conflict immediately. To simply reject bundles that introduce unresolved conflicts, using the -dont-allow-conflicts option. Making this the default in push-based workflows is strongly recommended.

Unlike most Darcs commands, `darcs apply' defaults to -all. Use the -interactive option to pick which patches to apply from a bundle.

`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`,`--no-allow-conflicts` |
fail if there are patches that would create conflicts [DEFAULT]
| `--skip-conflicts` |
filter out any patches that would create conflicts
| `--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
| `--no-happy-forwarding` |
don't forward unsigned messages without extra header [DEFAULT]
| `--sendmail-command COMMAND` |
specify sendmail command
| `--ignore-times` |
don't trust the file modification times
| `--no-ignore-times` |
trust modification times to find modified files [DEFAULT]
| `--compress` |
create compressed patches
| `--dont-compress`,`--no-compress` |
don't create compressed patches
| `--set-scripts-executable` |
make scripts executable
| `--dont-set-scripts-executable`,`--no-set-scripts-executable` |
don't make scripts executable
| `--umask UMASK` |
specify umask to use when writing
| `--restrict-paths` |
don't allow darcs to touch external files or repo metadata
| `--dont-restrict-paths`,`--no-restrict-paths` |
allow darcs to modify any file or directory (unsafe)

Apply a patch bundle created by `darcs 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

--external-merge

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

--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 %<

# Seeing what you've done

##
darcs whatsnew

The `darcs whatsnew' command lists unrecorded changes to the working tree. If you specify a set of files and directories, only unrecorded changes to those files and directories are listed.

With the -summary option, the changes are condensed to one line per file, with mnemonics to indicate the nature and extent of the change. The -look-for-adds option causes candidates for `darcs add' to be included in the summary output. Summary mnemonics are as follows:

`A f' and `A d/' respectively mean an added file or directory. `R f' and `R d/' respectively mean a removed file or directory. `M f -N +M rP' means a modified file, with N lines deleted, M lines added, and P lexical replacements. `f -> g' means a moved file or directory.

An exclamation mark (!) as in `R! foo.c', means the hunk is known to conflict with a hunk in another patch. The phrase `duplicated' means the hunk is known to be identical to a hunk in another patch.

By default, `darcs whatsnew' uses Darcs' internal format for changes. To see some context (unchanged lines) around each change, use the -unified option. To view changes in conventional `diff' format, use the `darcs diff' command; but note that `darcs whatsnew' is faster.

This command exits unsuccessfully (returns a non-zero exit status) if there are no unrecorded changes.

`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
| `--no-unified` |
output patch in darcs' usual format
`-l` | `--look-for-adds` |
look for (non-boring) files that could be added
| `--dont-look-for-adds`,`--no-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
| `--no-ignore-times` |
trust modification times to find modified files [DEFAULT]
| `--boring` |
don't skip boring files
| `--no-boring` |
skip borign files [DEFAULT]
| `--no-cache` |
don't use patch caches

List unrecorded changes in the working tree.

##
darcs changes

The `darcs changes' command lists the patches that constitute the current repository or, with -repo, a remote repository. Without options or arguments, ALL patches will be listed.

When given one or more files or directories as arguments, only patches which affect those files or directories are listed. This includes changes that happened to files before they were moved or renamed.

When given a -from-tag, -from-patch or -from-match, only changes since that tag or patch are listed. Similarly, the -to-tag, -to-patch and -to-match options restrict the list to older patches.

The -last and -max-count options both limit the number of patches listed. The former applies BEFORE other filters, whereas the latter applies AFTER other filters. For example `darcs changes foo.c -max-count 3' will print the last three patches that affect foo.c, whereas `darcs changes -last 3 foo.c' will, of the last three patches, print only those that affect foo.c.

Three output formats exist. The default is -human-readable. You can also select -context, which is the internal format (as seen in patch bundles) that can be re-read by Darcs (e.g. `darcs get -context').

Finally, there is -xml-output, which emits valid XML... unless a the patch metadata (author, name or description) contains a non-ASCII character and was recorded in a non-UTF8 locale.

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.

`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
| `--max-count NUMBER` |
return only NUMBER results
| `--only-to-files` |
show only changes to specified files
| `--no-only-to-files` |
show changes to all files [DEFAULT]
| `--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
| `--no-reverse` |
show changes in the usual order [DEFAULT]
| `--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
| `--remote-darcs COMMAND` |
name of the darcs executable on the remote server

List patches in 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

The `darcs show authors' command lists the authors of the current repository, sorted by the number of patches contributed. With the -verbose option, this command simply lists the author of each patch (without aggregation or sorting).

An author's name or email address may change over time. To tell Darcs when multiple author strings refer to the same individual, create an `.authorspellings' file in the root of the working tree. Each line in this file begins with an author's canonical name and address, and may be followed by a comma separated list of extended regular expressions. Blank lines and lines beginning with two hyphens are ignored. The format of .authorspelling can be described by this pattern:

name <address> [, regexp ]*

There are some pitfalls concerning special characters: Whitespaces are stripped, if you need space in regexp use [ ]. Because comma serves as a separator you have to escape it if you want it in regexp. Note that .authorspelingfile use extended regular expressions so +, ? and so on are metacharacters and you need to escape them to be interpreted literally.

Any patch with an author string that matches the canonical address or any of the associated regexps is considered to be the work of that author. All matching is case-insensitive and partial (it can match a substring). Use ^,$ to match the whole string in regexps

Currently this canonicalization step is done only in `darcs show authors'. Other commands, such as `darcs changes' use author strings verbatim.

An example .authorspelling file is:

- This is a comment. Fred Nurk <fred@example.com> John Snagge <snagge@bbc.co.uk>, John, snagge@, js@(si|mit).edu Chuck Jones, Jr. <chuck@pobox.com>, cj+user@example.com

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

Options:

| `--repodir DIRECTORY` |
specify the repository directory in which to run

List authors by patch count.

###
darcs show contents

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).

`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` |
select one patch
| `--repodir DIRECTORY` |
specify the repository directory in which to run

Outputs a specific version of a file.

###
darcs show files

The `darcs show files' command lists those files and directories in the working tree that are under version control. This command is primarily for scripting purposes; end users will probably want `darcs whatsnew -summary'.

A file is `pending' if it has been added but not recorded. By default, pending files (and directories) are listed; the -no-pending option prevents this.

By default `darcs show files' lists both files and directories, but the alias `darcs show manifest' only lists files. The -files, -directories, -no-files and -no-directories modify this behaviour.

By default entries are one-per-line (i.e. newline separated). This can cause problems if the files themselves contain newlines or other control characters. To get aroudn this, the -null option uses the null character instead. The script interpreting output from this command needs to understand this idiom; `xargs -0' is such a command.

For example, to list version-controlled files by size:

darcs show files -0 | xargs -0 ls -ldS

`Usage: darcs show files [OPTION]... [FILE or DIRECTORY]...`

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
| `--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` |
select one patch
| `--repodir DIRECTORY` |
specify the repository directory in which to run

Show version-controlled files in the working copy.

###
darcs show tags

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.

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

Options:

| `--repodir DIRECTORY` |
specify the repository directory in which to run

Show all tags in the repository.

###
darcs show repo

The `darcs show repo' command displays statistics about the current repository, allowing third-party scripts to access this information without inspecting _darcs directly (and without breaking when the _darcs format changes).

By default, the number of patches is shown. If this data isn't needed, use -no-files to accelerate this command from O(n) to O(1).

By default, output is in a human-readable format. The -xml-output option can be used to generate output for machine postprocessing.

`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

Show repository summary information

# More advanced commands

##
darcs tag

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 option, which behaves as described in `darcs record'.

`Usage: darcs tag [OPTION]... [TAGNAME]`

Options:

`-m` | `--patch-name PATCHNAME` |
name of patch
`-A` | `--author EMAIL` |
specify author id
| `--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`,`--no-compress` |
don't create compressed patches
| `--umask UMASK` |
specify umask to use when writing

Name the current repository state for future reference.

##
darcs setpref

When working on project with multiple repositories and contributors, it is sometimes desirable for a preference to be set consistently project-wide. This is achieved by treating a preference set with `darcs setpref' as an unrecorded change, which can then be recorded and then treated like any other patch.

Valid preferences are:

test - a shell command that runs regression tests predist - a shell command to run before `darcs dist' boringfile - the path to a version-controlled boring file binariesfile - the path to a version-controlled binaries file

For example, a project using GNU autotools, with a `make test' target to perform regression tests, might enable Darcs' integrated regression testing with the following command:

darcs setpref test 'autoconf && ./configure && make && make test'

Note that merging is not currently implemented for preferences: if two patches attempt to set the same preference, the last patch applied to the repository will always take precedence. This is considered a low-priority bug, because preferences are seldom set.

`Usage: darcs setpref [OPTION]... <PREF> <VALUE>`

Options:

| `--repodir DIRECTORY` |
specify the repository directory in which to run

Advanced options:

| `--umask UMASK` |
specify umask to use when writing

Set a preference (test, predist, boringfile or binariesfile).

##
darcs check

This command verifies that the patches in the repository, when applied successively to an empty tree, result in the pristine tree. If not, the differences are printed and Darcs exits unsucessfully (with a non-zero exit status).

If the repository is in darcs-1 format and has a checkpoint, you can use the -partial option to start checking from the latest checkpoint. This is the default for partial darcs-1 repositories; the -complete option to forces a full check.

If a regression test is defined (see `darcs setpref') it will be run by `darcs check'. Use the -no-test option to disable this.

`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
| `--ignore-times` |
don't trust the file modification times
| `--no-ignore-times` |
trust modification times to find modified files [DEFAULT]

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

The `darcs optimize' command modifies the current repository in an attempt to reduce its resource requirements. By default a single fast, safe optimization is performed; additional optimization techniques can be enabled by passing options to `darcs optimize'.

The default optimization moves recent patches (those not included in the latest tag) to the `front', reducing the amount that a typical remote command needs to download. It should also reduce the CPU time needed for some operations.

The `darcs optimize -relink' command hard-links patches that the current repository has in common with its peers. Peers are those repositories listed in _darcs/prefs/sources, or defined with the `-sibling' option (which can be used multiple times).

Darcs uses hard-links automatically, so this command is rarely needed. It is most useful if you used `cp -r' instead of `darcs get' to copy a repository, or if you pulled the same patch from a remote repository into multiple local repositories.

A `darcs optimize -relink-pristine' command is also available, but generally SHOULD NOT be used. It results in a relatively small space saving at the cost of making many Darcs commands MUCH slower.

By default patches are compressed with zlib (RFC 1951) to reduce storage (and download) size. In exceptional circumstances, it may be preferable to avoid compression. In this case the `-dont-compress' option can be used (e.g. with `darcs record') to avoid compression.

The `darcs optimize -uncompress' and `darcs optimize -compress' commands can be used to ensure existing patches in the current repository are respectively uncompressed or compressed. Note that repositories in the legacy `old-fashioned-inventory' format have a .gz extension on patch files even when uncompressed.

There is one more optimization which CAN NOT be performed by this command. Every time your record a patch, a new inventory file is written to _darcs/inventories/, and old inventories are never reaped.

If _darcs/inventories/ is consuming a relatively large amount of space, you can safely reclaim it by using `darcs get' to make a complete copy of the repo. When doing so, don't forget to copy over any unsaved changes you have made to the working tree or to unversioned files in _darcs/prefs/ (such as _darcs/prefs/author).

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

Options:

| `--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)
| `--upgrade` |
upgrade repository to latest compatible format
| `--pristine` |
optimize hashed pristine layout

Advanced options:

| `--compress` |
create compressed patches
| `--dont-compress`,`--no-compress` |
don't create compressed patches
| `--uncompress` |
uncompress patches
| `--umask UMASK` |
specify umask to use when writing

Optimize the repository.
--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.

The `--upgrade` option for `darcs optimize` performs an inplace upgrade of your repository to the lastest compatible format. Right now means that darcs 1 old-fashioned repositories will be upgraded to darcs-1 hashed repositories (and notably, not to darcs 2 repositories as that would not be compatible; see `darcs convert`).

# Undoing, redoing and running in circles

##
darcs amend-record

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-long-comment'. To change the patch name without starting an editor, use -patch-name.

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. On Windows use C:/Documents And Settings/user/Application Data/darcs/defaults

`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` |
select one patch
| `--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`,`--no-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`,`--no-compress` |
don't create compressed patches
| `--ignore-times` |
don't trust the file modification times
| `--no-ignore-times` |
trust modification times to find modified files [DEFAULT]
| `--umask UMASK` |
specify umask to use when writing
| `--set-scripts-executable` |
make scripts executable
| `--dont-set-scripts-executable`,`--no-set-scripts-executable` |
don't make scripts executable

Improve a patch before it leaves your repository.

##
darcs rollback

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.

`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`,`--no-compress` |
don't create compressed patches
| `--umask UMASK` |
specify umask to use when writing

Record a new patch reversing some recorded changes.

##
darcs unrecord

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.

`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`,`--no-compress` |
don't create compressed patches
| `--umask UMASK` |
specify umask to use when writing

Remove recorded patches without changing the working copy.

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.6.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

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!

`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
`-s` | `--summary` |
summarize changes
| `--no-summary` |
don't summarize changes
| `--dry-run` |
don't actually take the action
| `--xml-output` |
generate XML formatted output

Advanced options:

| `--compress` |
create compressed patches
| `--dont-compress`,`--no-compress` |
don't create compressed patches
| `--ignore-times` |
don't trust the file modification times
| `--no-ignore-times` |
trust modification times to find modified files [DEFAULT]
| `--umask UMASK` |
specify umask to use when writing

Delete selected patches from the repository. (UNSAFE!) 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

The `darcs revert' command discards unrecorded changes the working tree. As with `darcs record', you will be asked which hunks (changes) to revert. The -all switch can be used to avoid such prompting. If files or directories are specified, other parts of the working tree are not reverted.

In you accidentally reverted something you wanted to keep (for example, typing `darcs rev -a' instead of `darcs rec -a'), you can immediately run `darcs unrevert' to restore it. This is only guaranteed to work if the repository has not changed since `darcs revert' ran.

`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
| `--no-ignore-times` |
trust modification times to find modified files [DEFAULT]
| `--umask UMASK` |
specify umask to use when writing

Discard unrecorded changes.

##
darcs unrevert

Unrevert is a rescue command in case you accidentally reverted something you wanted to keep (for example, 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.

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

Options:

| `--ignore-times` |
don't trust the file modification times
| `--no-ignore-times` |
trust modification times to find modified files [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:

| `--umask UMASK` |
specify umask to use when writing

Undo the last revert (may fail if changes after the revert).

# Advanced examination of the repository

##
darcs diff

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

`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
| `--no-unified` |
output patch in diff's dumb format
| `--repodir DIRECTORY` |
specify the repository directory in which to run
| `--store-in-memory` |
do patch application in memory rather than on disk
| `--no-store-in-memory` |
do patch application on disk [DEFAULT]

Create a diff between two versions of the repository.

--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

The `darcs annotate' command provides two unrelated operations. When called on a file, it will find the patch that last modified each line in that file. When called on a patch (e.g. using -patch), it will print the internal representation of that patch.

The -summary option will result in a summarized patch annotation, similar to `darcs whatsnew'. It has no effect on file annotations.

By default, output is in a human-readable format. The -xml-output option can be used to generate output for machine postprocessing.

`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
| `--no-unified` |
output patch in darcs' usual format
| `--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` |
select one patch
| `--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. 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

The `darcs show authors' command lists the authors of the current repository, sorted by the number of patches contributed. With the -verbose option, this command simply lists the author of each patch (without aggregation or sorting).

An author's name or email address may change over time. To tell Darcs when multiple author strings refer to the same individual, create an `.authorspellings' file in the root of the working tree. Each line in this file begins with an author's canonical name and address, and may be followed by a comma separated list of extended regular expressions. Blank lines and lines beginning with two hyphens are ignored. The format of .authorspelling can be described by this pattern:

name <address> [, regexp ]*

There are some pitfalls concerning special characters: Whitespaces are stripped, if you need space in regexp use [ ]. Because comma serves as a separator you have to escape it if you want it in regexp. Note that .authorspelingfile use extended regular expressions so +, ? and so on are metacharacters and you need to escape them to be interpreted literally.

Any patch with an author string that matches the canonical address or any of the associated regexps is considered to be the work of that author. All matching is case-insensitive and partial (it can match a substring). Use ^,$ to match the whole string in regexps

Currently this canonicalization step is done only in `darcs show authors'. Other commands, such as `darcs changes' use author strings verbatim.

An example .authorspelling file is:

- This is a comment. Fred Nurk <fred@example.com> John Snagge <snagge@bbc.co.uk>, John, snagge@, js@(si|mit).edu Chuck Jones, Jr. <chuck@pobox.com>, cj+user@example.com

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

Options:

| `--repodir DIRECTORY` |
specify the repository directory in which to run

List authors by patch count.

###
darcs show contents

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).

`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` |
select one patch
| `--repodir DIRECTORY` |
specify the repository directory in which to run

Outputs a specific version of a file.

###
darcs show files

The `darcs show files' command lists those files and directories in the working tree that are under version control. This command is primarily for scripting purposes; end users will probably want `darcs whatsnew -summary'.

A file is `pending' if it has been added but not recorded. By default, pending files (and directories) are listed; the -no-pending option prevents this.

By default `darcs show files' lists both files and directories, but the alias `darcs show manifest' only lists files. The -files, -directories, -no-files and -no-directories modify this behaviour.

By default entries are one-per-line (i.e. newline separated). This can cause problems if the files themselves contain newlines or other control characters. To get aroudn this, the -null option uses the null character instead. The script interpreting output from this command needs to understand this idiom; `xargs -0' is such a command.

For example, to list version-controlled files by size:

darcs show files -0 | xargs -0 ls -ldS

`Usage: darcs show files [OPTION]... [FILE or DIRECTORY]...`

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
| `--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` |
select one patch
| `--repodir DIRECTORY` |
specify the repository directory in which to run

Show version-controlled files in the working copy.

###
darcs show tags

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.

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

Options:

| `--repodir DIRECTORY` |
specify the repository directory in which to run

Show all tags in the repository.

###
darcs show repo

The `darcs show repo' command displays statistics about the current repository, allowing third-party scripts to access this information without inspecting _darcs directly (and without breaking when the _darcs format changes).

By default, the number of patches is shown. If this data isn't needed, use -no-files to accelerate this command from O(n) to O(1).

By default, output is in a human-readable format. The -xml-output option can be used to generate output for machine postprocessing.

`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

Show repository summary information

# Rarely needed and obscure commands

##
darcs convert

The current repository format is called `darcs-2'. It was introduced in Darcs 2.0 and became the default for new projects in Darcs 2.2. The `darcs convert' command allows existing projects to migrate to this format from the older `darcs-1' format.

This command DOES NOT modify the source repository; a new destination repository is created. It is safe to run this command more than once on a repository (e.g. for testing), before the final conversion.

WARNING: the repository produced by this command is not understood by Darcs 1.x, and patches cannot be exchanged between repositories in darcs-1 and darcs-2 formats.

Furthermore, darcs 2 repositories created by different invocations of this command SHOULD NOT exchange patches, unless those repositories had no patches in common when they were converted. (That is, within a set of repos that exchange patches, no patch should be converted more than once.)

Due to this limitation, migrating a multi-branch project is a little awkward. Sorry! Here is the recommended process:

1. for each branch `foo', tag that branch with `foo-final'; 2. merge all branches together (-allow-conflicts may help); 3. run `darcs optimize -reorder' on the result; 4. run `darcs convert' to create a merged darcs-2 repository; 5. re-create each branch by calling `darcs get -tag foo-final' on the darcs-2 repository; and finally 6. use `darcs obliterate' to delete the foo-final tags.

`Usage: darcs convert [OPTION]... <SOURCE> [<DESTINATION>]`

Options:

| `--repo-name DIRECTORY`,`--repodir DIRECTORY` |
path of output directory
| `--set-scripts-executable` |
make scripts executable
| `--dont-set-scripts-executable`,`--no-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
| `--remote-darcs COMMAND` |
name of the darcs executable on the remote server

Convert a repository from a legacy format.

##
darcs mark-conflicts

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 the markers `v v v', `* * *' and `^ ^ ^'.

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.

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

Options:

| `--ignore-times` |
don't trust the file modification times
| `--no-ignore-times` |
trust modification times to find modified files [DEFAULT]
| `--repodir DIRECTORY` |
specify the repository directory in which to run

Advanced options:

| `--umask UMASK` |
specify umask to use when writing

Mark unresolved conflicts in working tree, for manual resolution.

##
darcs dist

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.

`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` |
select one patch
| `--store-in-memory` |
do patch application in memory rather than on disk
| `--no-store-in-memory` |
do patch application on disk [DEFAULT]

Create a distribution tarball.

##
darcs trackdown

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.

`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`,`--no-set-scripts-executable` |
don't make scripts executable

Locate the most recent version lacking an error.

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

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.

`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

Repair a corrupted repository.

# Switching from CVS

Darcs is refreshingly different from CVS.

CVS keeps version controlled data in a central repository, and requires that users check out a working directory whenever they wish to access the version-controlled sources. In order to modify the central repository, a user needs to have write access to the central repository; if he doesn't, CVS merely becomes a tool to get the latest sources.

In darcs there is no distinction between working directories and repositories. In order to work on a project, a user makes a local copy of the repository he wants to work in; he may then harness the full power of version control locally. In order to distribute his changes, a user who has write access can push them to the remote repository; one who doesn't can simply send them by e-mail in a format that makes them easy to apply on the remote system.

#### Darcs commands for CVS users

Because of the different models used by cvs and darcs, it is difficult to provide a complete equivalence between cvs and darcs. A rough correspondence for the everyday commands follows:

`cvs checkout`
  `darcs get`
`cvs update`
  `darcs pull`
`cvs -n update`
  `darcs pull `--dry-run`` (summarize remote changes)
`cvs -n update`
  `darcs whatsnew `--summary`` (summarize local changes)
`cvs -n update | grep '?'`
  `darcs whatsnew -ls | grep `^a`` (list potential files to add)
`rm foo.txt; cvs update foo.txt`
  `darcs revert foo.txt` (revert to foo.txt from repo)
`cvs diff`
  `darcs whatsnew` (if checking local changes)
`cvs diff`
  `darcs diff` (if checking recorded changes)
`cvs commit`
  `darcs record` (if committing locally)
`cvs commit`
  `darcs tag` (if marking a version for later use)
`cvs commit`
  `darcs push` or `darcs send` (if committing remotely)
`cvs diff | mail`
  `darcs send`
`cvs add`
  `darcs add`
`cvs tag -b`
  `darcs get`
`cvs tag`
  `darcs tag`

#### Migrating CVS repositories to darcs

Tools and instructions for migrating CVS repositories to darcs are provided on the darcs community website: http://wiki.darcs.net/DarcsWiki/ConvertingFromCvs

# Switching from arch

Although arch, like darcs, is a distributed system, and the two systems have many similarities (both require no special server, for example), their essential organization is very different.

Like CVS, arch keeps data in two types of data structures: repositories (called ``archives'') and working directories. In order to modify a repository, one must first check out a corresponding working directory. This requires that users remember a number of different ways of pushing data around -- `tla` `get`, `update`, `commit`, `archive-mirror` and so on.

In darcs, on the other hand, there is no distinction between working directories and repositories, and just checking out your sources creates a local copy of a repository. This allows you to harness the full power of version control in any scratch copy of your sources, and also means that there are just two ways to push data around: `darcs` `record`, which stores edits into your local repository, and `pull`, which moves data between repositories. (`darcs` `push` is merely the opposite of `pull`; `send` and `apply` are just the two halves of `push`).

#### Darcs commands for arch users

Because of the different models used by arch and darcs, it is difficult to provide a complete equivalence between arch and darcs. A rough correspondence for the everyday commands follows:

`tla init-tree`
  `darcs initialize`
`tla get`
  `darcs get`
`tla update`
  `darcs pull`
`tla file-diffs f | patch -R`
  `darcs revert`
`tla changes -diffs`
  `darcs whatsnew`
`tla logs`
  `darcs changes`
`tla file-diffs`
  `darcs diff -u`
`tla add`
  `darcs add`
`tla mv`
  `darcs move` (not `tla move`)
`tla commit`
  `darcs record` (if committing locally)
`tla commit`
  `darcs tag` (if marking a version for later use)
`tla commit`
  `darcs push` or `darcs send` (if committing remotely)
`tla archive-mirror`
  `darcs pull` or `darcs push`
`tla tag`
  `darcs get` (if creating a branch)
`tla tag`
  `darcs tag` (if creating a tag).

#### Migrating arch repositories to darcs

Tools and instructions for migrating arch repositories to darcs are provided on the darcs community website: http://wiki.darcs.net/DarcsWiki/ConvertingFromArch

Next: Building darcs Up: Darcs User Manual Previous: Repository Formats Contents