Subsections
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
.
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 |
pull |
yes |
yes |
apply |
yes |
yes |
rollback |
yes |
no |
unrecord |
yes |
no |
unpull |
yes |
yes |
revert |
no |
yes |
unrevert |
no |
yes |
push5.1 |
no |
no |
send5.2 |
no |
no |
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
Most commands also accept the --verbose
option, which tells darcs to
provide additional output. The amount of verbosity varies from command to
command.
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 repo directory when calling the
command. This is useful when running darcs as a pipe, as might be the case
when running apply from a mailer.
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 (exclusive) or up to (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.
Currently --match
accepts three 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 regular expression which is checked against
the patch name. The syntax is
darcs annotate --summary --match 'name foo'
If you want to include spaces in the regular expression, it must be
enclosed in double quotes (`"'), and currently there is no provision for
escaping a double quote, so you have to choose between matching double
quotes and matching spaces.
The second match type matches the darcs hash for each patch:
darcs annotate --summary --match \
'hash 20040403105958-53a90-c719567e92c3b0ab9eddd5290b705712b8b918ef'
This is intended to be used, for example, by programs allowing you to view
darcs repositories (e.g. cgi scripts like viewCVS).
There is also now rudimentary 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 yesterday'
darcs changes --from-match 'date "Sat Jun 30 11:31:30 EDT 2004"'
currently date matching always matches only the day itself. FIXME: It
should be extended to match the time as well if the time is specified. In
general, a lot of cleanup is needed in the date matching code.
Because the date matching is only by day, you may prefer to combine it with
a more specific pattern.
darcs annotate --summary --match 'date "last week" && name foo'
The --match
pattern can include the logical operators &&
,
||
and not
, as well as grouping of patters with parentheses.
For example
darcs annotate --summary --match 'name record && not name overrode'
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 repo 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 explicitely.
Several commands need to be able to identify you. Conventionally, you
provide an email address for this purpose. The easiest way to do this is
to define an environment variable EMAIL
or DARCS_EMAIL
(with
the latter overriding the former). You can also override this using the
--author
flag to any command. Alternatively, you could set your
email address on a per-repository basis using the ``defaults'' mechanism
for ``ALL'' commands, as described in Appendix B.
Or, you could specify the author on a per-repository basis using the
_darcs/prefs/author
file as described in section 4.1.3.
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.
Certain commands may have an optional graphical user interface. If such
commands are supported, you can activate the graphical user interface by
calling darcs with the --gui
flag.
Resolution of conflicts
To resolve conflicts using an external tool, you need to specify a command
to use via something like
--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 version.
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'
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 your defaults file _darcs/prefs/defaults
(see
4.1.1) a line such as
ALL external-merge kdiff3 --output %o %a %1 %2
Note that the defaults file does not want quotes around the command.
Calling darcs with just ``-help'' as an argument gives a brief
summary of what commands are available.
The ``-extended-help'' option gives a more technical summary of
what the commands actually do.
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.
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.
No description available!
Generally you will only call initialize once for each project you work on,
and calling it is just about the first thing you do. Just make sure you
are in the main directory of the project, and initialize will set up all the
directories and files darcs needs in order to start keeping track of
revisions for your project.
initialize actually follows a very simple procedure. It simply creates
the directories _darcs, _darcs/current and _darcs/patches, and then creates an empty file, _darcs/inventory.
However, it is strongly recommended that you use darcs initialize to do
this, as this procedure may change in a future version of darcs.
|
--boring |
|
|
--case-ok |
don't refuse to add files differing only in case |
|
-r |
--recursive |
add contents of subdirectories |
|
|
--not-recursive |
don't add contents of subdirectories |
|
-v |
--verbose |
|
-q |
--quiet |
suppress informational output |
|
|
--standard-verbosity |
neither verbose nor quiet output |
|
|
--repodir DIRECTORY |
specify the repository directory in which to run |
|
Add needs to be called whenever you add a new file or directory to
your project. Of course, it also needs to be called when you first
create the project, to let darcs know which files should be kept
track of.
Darcs will refuse to add a file or directory that differs from an existing
one only in case. This is because the HFS+ file system used on under MacOS
treats such files as being one and the same.
-v |
--verbose |
|
|
--standard-verbosity |
don't give verbose output |
|
|
--repodir DIRECTORY |
specify the repository directory in which to run |
|
Remove should be called when you want to remove a file from your project,
but don't actually want to delete the file. Otherwise just delete the
file or directory, and darcs will notice that it has been removed.
Be aware that the file WILL be deleted from any other copy of the repo
to which you later apply the patch.
darcs whatsnew
-v |
--verbose |
|
|
--standard-verbosity |
don't give verbose output |
|
-s |
--summary |
|
|
--no-summary |
|
-u |
--unified |
output patch in format similar to diff -u |
|
|
--ignore-times |
don't trust the file modification times |
|
-l |
--look-for-adds |
Add any new files or directories in the working dir |
|
|
--dont-look-for-adds |
Don't add any files or directories automatically |
|
|
--boring |
|
|
--repodir DIRECTORY |
specify the repository directory in which to run |
|
Display unrecorded changes in the working directory.
What's-new gives you a view of what changes you've made in your working
directory that haven't yet been recorded. The changes are displayed in
darcs patch format.
Darcs whatsnew will return a non-zero value if
there are no changes, which can be useful if you just want to see in a
script if anything has been modified. If you want to see some context
around your changes, you can use the -u
option, to get output
similar to the unidiff format.
If you give one or more file or directory names as an argument to whatsnew,
darcs whatsnew will output only changes to those files or to files in those
directories.
|
--complete |
check the entire repository |
|
|
--partial |
check patches since latest checkpoint |
|
-v |
--verbose |
|
-q |
--quiet |
suppress informational output |
|
|
--standard-verbosity |
neither verbose nor quiet output |
|
|
--no-test |
don't run the test script |
|
|
--test |
|
|
--leave-test-directory |
don't remove the test directory |
|
|
--remove-test-directory |
remove the test directory |
|
Check the repository for consistency.
Check verifies that the patches stored in the repository, when successively
applied to an empty tree, properly recreate the stored current tree.
If you have a checkpoint of the repository (as is the case if you got the
repo originally using darcs get --partial
), by default darcs check
will only verify the contents since the most recent checkpoint. You can
change this behavior using the --complete
flag.
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
.
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 4.1.1).
If you just want to check the consistency of your repository without
running the test, you can call darcs check with the --no-test
option.
-m |
--patch-name PATCHNAME |
|
-A |
--author EMAIL |
|
|
--logfile FILE |
give long description using logfile |
|
-v |
--verbose |
|
|
--standard-verbosity |
don't give verbose output |
|
|
--no-test |
don't run the test script |
|
|
--test |
|
|
--leave-test-directory |
don't remove the test directory |
|
|
--remove-test-directory |
remove the test directory |
|
|
--compress |
create compressed patches |
|
|
--dont-compress |
don't create compressed patches |
|
-a |
--all |
answer yes to all patches |
|
|
--pipe |
Expect to receive input from a pipe |
|
|
--interactive |
Prompt user interactively |
|
|
--ask-deps |
|
|
--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 |
|
|
--ignore-times |
don't trust the file modification times |
|
-l |
--look-for-adds |
Add any new files or directories in the working dir |
|
|
--dont-look-for-adds |
Don't add any files or directories automatically |
|
|
--repodir DIRECTORY |
specify the repository directory in which to run |
|
Record is used to name a set of changes and record the patch to the
repository. If you provide one or more files or directories as additional
arguments to record, you will only be prompted to changes in those files or
directories.
Each patch is given a name, which typically would consist of a brief
description of the changes. This name is later used to describe the patch.
The name must fit on one line (i.e. cannot have any embedded newlines). If
you have more to say, stick it in the log.
The patch is also flagged with the author of the change, taken by default
from the DARCS_EMAIL
environment variable, and if that doesn't
exist, from the EMAIL
environment variable. The date on which the
patch was recorded is also included. Currently there is no provision for
keeping track of when a patch enters a given repository.
Finally, each changeset should have a full log (which may be empty). This
log is for detailed notes which are too lengthy to fit in the name. If you
answer that you do want to create a comment file, darcs will open an editor
so that you can enter the comment in. The choice of editor proceeds as
follows. If one of the $DARCS_EDITOR
, $VISUAL
or
$EDITOR
environment variables is defined, its value is used (with
precedence proceeding in the order listed). If not, ``vi'', ``emacs'',
``emacs -nw'' and ``nano'' are tried in that order.
There is a problem that shows up with at least some versions of vi which
keep them from working properly with darcs. An (ugly) solution to this is
to tell vi to use the tty as stdin and stdout:
export DARCS_EDITOR="vi </dev/tty >/dev/tty"
If you wish, you may specify the patch name and log using the
--logfile
flag. If you do so, the first line of the specified file
will be taken to be the patch name, and the remainder will be the ``long
comment''. This feature can be especially handy if you have a test that
fails several times on the record (thus aborting the record), so you don't
have to type in the long comment multiple times.
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 repo. 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.
If you configure darcs to run a test suite, darcs will run this test on the
recorded repo to make sure it is valid. Darcs first creates a pristine
copy of the source tree (in /tmp
), then it runs the test, using its
return value to decide if the record is valid. If it is not valid, the
record will be aborted. This is a handy way to avoid making stupid
mistakes like forgetting to `darcs add' a new file. It also can be
tediously slow, so there is an option (--no-test
) to skip the test.
If you run record with the --pipe
option, you will be prompted for
the patch name, patch date and the long comment. The long comment will
extend until the end of file of stdin is reached (ctrl-D on unixy systems).
This interface is intended for scripting darcs, in particular for writing
repository conversion scripts. The prompts are intended mostly as useful
guide (since scripts won't need them), to help you understand the format in
which to provide the input.
|
--repo-name REPONAME |
name of output repository |
|
|
--partial |
get partial repository using checkpoint |
|
|
--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 |
|
|
--tag REGEXP |
select tag matching REGEXP |
|
|
--context FILENAME |
version specified by the context in FILENAME |
|
-v |
--verbose |
|
-q |
--quiet |
suppress informational output |
|
|
--standard-verbosity |
neither verbose nor quiet output |
|
|
--set-default |
set default repository [DEFAULT] |
|
|
--no-set-default |
don't set default repository |
|
Get is used to get a local copy of a repository.
I recommend using the --verbose
flag to get, as
this command can take a while, and with no feedback, that can be rather
boring.
If the remote repo and the current directory are in the same filesystem and
that filesystem supports hard links, get will create hard links for the
patch files, which means that the additional storage space needed will be
minimal. This is very good for your disk usage (and for the speed
of running get), so if you want multiple copies of a repository, I strongly
recommend first running darcs get
to get yourself one copy, and then
running darcs get
on that copy to make any more you like. The only
catch is that the first time you run darcs push
or darcs pull
from any of these second copies, by default they will access your first
copy--which may not be what you want.
If you want to get a specific version of a repository, you have a few
options. You can either use the --tag
, --to-patch
or
--to-match
options, or you can use the --context=FILENAME
option, which specifies a file containing a context generated with
darcs changes --context
. This allows you (for example) to include in
your compiled program an option to output the precise version of the
repository from which it was generated, and then perhaps ask users to
include this information in bug reports.
Note that when specifying --to-patch
or --to-match
, you may
get a version of your code that has never before been seen, if the patches
have gotten themselves reordered. If you ever want to be able to precisely
reproduce a given version, you need either to tag it or create a context
file.
|
--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 |
|
|
--interactive |
Prompt user interactively |
|
|
--external-merge COMMAND |
Use external tool to merge conflicts |
|
|
--compress |
create compressed patches |
|
|
--dont-compress |
don't create compressed patches |
|
|
--test |
|
|
--no-test |
don't run the test script |
|
|
--dry-run |
don't actually make any changes |
|
-v |
--verbose |
|
-q |
--quiet |
suppress informational output |
|
|
--standard-verbosity |
neither verbose nor quiet output |
|
|
--ignore-times |
don't trust the file modification times |
|
|
--no-deps |
don't automatically fulfill dependencies |
|
|
--set-default |
set default repository [DEFAULT] |
|
|
--no-set-default |
don't set default repository |
|
Pull is used to bring changes made in another repo into the current repo
(that is, the one that is the current directory). Pull allows you to bring
over all or some of the patches that are in that repo but not in the
current one. Pull accepts an argument, which is the URL 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.
You can use an external interactive merge tool to resolve conflicts via the
flag --external-merge
. For more details see
section 5.1.10.
The --patches
, --matches
, and --tags
options can be
used to select which patches to pull, as described in
section 5.1.4. darcs will silently pull along any other patches
upon which the selected patches depend. So --patches bugfix
means
``pull all the patches with `bugfix' in their name, along with any patches
they require.'' If you really only want the patches with `bugfix' in their
name, you should use the --no-deps
option, which makes darcs pull in
only the selected patches which have no dependencies (apart from other
selected patches).
If you specify the --test
option, pull will run the test (if a test
exists) on a scratch copy of the repo contents prior to actually performing
the pull. If the test fails, the pull will be aborted.
-v |
--verbose |
|
-q |
--quiet |
suppress informational output |
|
|
--standard-verbosity |
neither verbose nor quiet output |
|
|
--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 |
|
|
--interactive |
Prompt user interactively |
|
|
--apply-as USERNAME |
apply patch as another user using sudo |
|
|
--apply-as-myself |
don't use sudo to apply as another user [DEFAULT] |
|
|
--dry-run |
don't actually make any 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 |
|
Push is the opposite of pull. Push allows you to move changes from the
current repository into another repository.
For obvious reasons, you can only push to repositories to which you have
write access. In addition, you can only push to repos that you access
either via the local file system or via ssh. In order to apply via ssh,
darcs must also be installed on the remote computer. The command invoked
to run ssh may be configured via the DARCS_SSH
environment variable
(see section
.
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.
The --patches
, --matches
, and --tags
options can be
used to select which patches to push, as described in
section 5.1.4. darcs will silently push along any other patches
upon which the selected patches depend.
-v |
--verbose |
|
-q |
--quiet |
suppress informational output |
|
|
--standard-verbosity |
neither verbose nor quiet output |
|
|
--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 |
|
|
--interactive |
Prompt user interactively |
|
|
--from EMAIL |
|
-A |
--author EMAIL |
|
|
--to EMAIL |
specify destination email |
|
|
--cc EMAIL |
specify email address to cc |
|
-o |
--output FILE |
|
|
--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 |
|
-u |
--unified |
output patch in format similar to diff -u |
|
|
--dry-run |
don't actually make any changes |
|
|
--context FILENAME |
send to context stored in FILENAME |
|
|
--edit-description |
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 |
|
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 via email, although you may save it to a file.
If you want to create a patches having context, you can use the
--unified
option, which create output vaguely reminiscent of
``diff -u''.
The --output
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 give one or more
--to
arguments, the bundle of patches is emailed to those addresses.
If you don't provide either a --output
or a --to
flag, 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 there is no email address associated with the repository, darcs will
prompt you for an email address.
The --patches
, --matches
, and --tags
options can be
used to select which patches to send, as described in
section 5.1.4. darcs will silently send along any other patches
upon which the selected patches depend.
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 an email
to go along with your patches.
|
--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 |
|
|
--reply FROM |
|
|
--cc EMAIL |
specify email address to cc |
|
|
--external-merge COMMAND |
Use external tool to merge conflicts |
|
-v |
--verbose |
|
|
--standard-verbosity |
don't give verbose output |
|
|
--ignore-times |
don't trust the file modification times |
|
|
--compress |
create compressed patches |
|
|
--dont-compress |
don't create compressed patches |
|
-a |
--all |
answer yes to all patches |
|
|
--interactive |
Prompt user interactively |
|
|
--no-resolve-conflicts |
don't try to resolve conflicts |
|
|
--resolve-conflicts |
|
|
--no-test |
don't run the test script |
|
|
--test |
|
|
--happy-forwarding |
forward unsigned messages without extra header |
|
|
--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 |
|
Apply is used to apply a bundle of patches to this repository.
Such a bundle may be created using send.
Darcs apply accepts a single argument, which is the name of the patch file
to be applied. If you omit this argument, the patch is read from standard
input.5.3 This
allows you to use apply with a pipe from your email program, for example.
If you specify the --verify PUBRING
option, darcs will check that
the patch was gpg-signed by a key which is in PUBRING
, and will
refuse to apply the patch otherwise.
If you give the --reply FROM
option to darcs apply, it will send the
results of the application to the sender of the patch. This only works if
the patch is in the form of an email with its headers intact, so that darcs
can actually know the origin of the patch. The reply email will indicate
whether or not the patch was successfully applied. The FROM
flag is
the email address that will be used as the ``from'' address when replying.
If the darcs apply is being done automatically, it is important that this
address not be the same as the address at which the patch was received in
order to avoid automatic email loops.
If you want to also send the apply email to another address (for example,
to create something like a ``commits'' mailing list), you can use the
--cc
option to specify additional recipients.
The --reply
feature of apply is intended primarily for two uses.
When used by itself, it is handy for when you want to apply patches sent to
you by other developers so that they will know when their patch has been
applied. For example, in my .muttrc
(the config file for my mailer)
I have:
macro pager A "<pipe-entry>darcs apply --verbose \
--reply droundy@abridgegame.org --repodir ~/darcs
which allows me to apply a patch to darcs directly from my mailer, with the
originator of that patch being sent a confirmation when the patch is
successfully applied. NOTE: For some reason mutt seems to set the umask
such that patches created with the above macro are not world-readable. I'm
not sure why this is, but use it with care.
You can use an external interactive merge tool to resolve conflicts via the
flag --external-merge
. For more details see
section 5.1.10.
If you provide the --interactive
or --gui
flag, darcs will
ask you for each change in the patch bundle whether or not you wish to
apply that change. The opposite is the --all
flag, which can be
used to override an interactive or gui which might be set in your
``defaults'' file.
When used in combination with the --verify
option, the
--reply
option allows for a nice pushable repository. When these
two options are used together, any patches that don't pass the verify will
be forwarded to the FROM
address of the --reply
option. This
allows you to set up a repository so that anyone who is authorized can push
to it and have it automatically applied, but if a stranger pushes to it,
the patch will be forwarded to you. Please (for your own sake!) be certain
that the --reply FROM
address is different from the one used to send
patches to a pushable repository, since otherwise an unsigned patch will be
forwarded to the repository in an infinite loop.
If you use `darcs apply --verify PUBRING --reply
' to create a
pushable repo by applying patches automatically as they are recieved via
email, you will also want to use the --no-resolve-conflicts
option,
which will keep the local and recorded versions in sync on the repo.
If you specify the --test
option, apply will run the test (if a test
exists) prior to applying the patch. If the test fails, the patch is not
applied. In this case, if the --reply
option was used, the results
of the test are send in the reply email. You can also specify the
--no-test
option, which will override the --test
option, and
prevent the test from being run. This is helpful when setting up a
pushable repository, to keep users from running code.
|
--match PATTERN |
select patch matching PATTERN |
|
-p |
--patch REGEXP |
select patch matching REGEXP |
|
|
--compress |
create compressed patches |
|
|
--dont-compress |
don't create compressed patches |
|
-v |
--verbose |
|
|
--standard-verbosity |
don't give verbose output |
|
|
--repodir DIRECTORY |
specify the repository directory in which to run |
|
Rollback is used to undo the effects of a single patch without actually
deleting that patch. Instead, it applies the inverse patch as a new patch.
Unlike unpull and unrecord (which accomplish a similar goal) rollback is
perfectly safe, since it leaves in the repository a record of the patch it
is removing.
If you decide you didn't want to roll back a patch
after all, you probably should use unrecord to undo the rollback, since
like rollback, unrecord doesn't affect the working directory.
|
--match PATTERN |
select patch matching PATTERN |
|
-p |
--patch REGEXP |
select patch matching REGEXP |
|
-t |
--tag REGEXP |
select tag matching REGEXP |
|
-v |
--verbose |
|
|
--standard-verbosity |
don't give verbose output |
|
|
--compress |
create compressed patches |
|
|
--dont-compress |
don't create compressed patches |
|
|
--repodir DIRECTORY |
specify the repository directory in which to run |
|
Unrecord is used to undo a single recorded patch. It will prompt you
for which patch to unrecord, and then will undo that patch.
Unrecord actually removes the unrecorded patch from
your repository, so there is no way to ``rerecord'' an unrecorded
patch5.4. Note that unrecord doesn't
affect your working copy of the tree at all, so if you want to completely
undo the change, you'll also need to darcs revert
, or do an unpull.
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 on the other repository. So if you really want
to undo the result of a pull operation, use unpull! 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.
|
--match PATTERN |
select patch matching PATTERN |
|
-p |
--patch REGEXP |
select patch matching REGEXP |
|
-t |
--tag REGEXP |
select tag matching REGEXP |
|
-v |
--verbose |
|
|
--standard-verbosity |
don't give verbose output |
|
|
--compress |
create compressed patches |
|
|
--dont-compress |
don't create compressed patches |
|
|
--ignore-times |
don't trust the file modification times |
|
|
--repodir DIRECTORY |
specify the repository directory in which to run |
|
Unpull is used to undo a single patch that has been pulled from another
repository. It will prompt you for which patch to unpull, and then will
undo that patch. Beware that unpull undoes the patch both from the repo
records AND from the current working directory, and does NOT check that
the patch originated with a pull. In other words, you could lose precious
code by unpulling!
Like unrecord, unpull does not just apply an inverse patch to the
repository, it actually deletes the patch from the repository. This makes
unpull a particularly dangerous command, as it not only deletes the patch
from the repo, but also removes the changes from the working directory. It
is equivalent to an unrecord followed by a revert, except that revert can
be unreverted.
Contrary to what its name suggests, there is nothing in unpull that
requires that the ``unpulled'' patch originate from different repository.
The name was chosen simply to suggest a situation in which it is ``safe''
to used unpull. If the patch was originally from another repo, then
unpulling is safe, because you can always pull the patch again if you
decide you want it after all. If you unpull a locally recorded patch, all
record of that change is lost, which is what makes this a ``dangerous''
command, and thus deserving of a obscure name which is more suggestive of
when it is safe to use than precisely what it does.
|
--match PATTERN |
select patch matching PATTERN |
|
-p |
--patch REGEXP |
select patch matching REGEXP |
|
-v |
--verbose |
|
|
--standard-verbosity |
don't give verbose output |
|
|
--no-test |
don't run the test script |
|
|
--test |
|
|
--leave-test-directory |
don't remove the test directory |
|
|
--remove-test-directory |
remove the test directory |
|
|
--compress |
create compressed patches |
|
|
--dont-compress |
don't create compressed patches |
|
-a |
--all |
answer yes to all patches |
|
|
--interactive |
Prompt user interactively |
|
|
--ignore-times |
don't trust the file modification times |
|
-l |
--look-for-adds |
Add any new files or directories in the working dir |
|
|
--dont-look-for-adds |
Don't add any files or directories automatically |
|
|
--repodir DIRECTORY |
specify the repository directory in which to run |
|
Rerecord is used to add additional changes to a patch which has already
been recorded. Despite its name, rerecord is NOT the opposite of unrecord.
If you provide one or more files or directories as additional arguments to
rerecord, you will only be prompted to changes in those files or
directories.
Rerecord will modify the date of the recorded patch. WARNING: You should
ONLY rerecord patches which only exist in a single repository!
If you configure darcs to run a test suite, darcs will run this test on the
rerecorded repo to make sure it is valid. Darcs first creates a pristine
copy of the source tree (in /tmp
), then it runs the test, using its
return value to decide if the rerecord is valid.
-v |
--verbose |
|
|
--standard-verbosity |
don't give verbose output |
|
|
--ignore-times |
don't trust the file modification times |
|
-a |
--all |
answer yes to all patches |
|
|
--interactive |
Prompt user interactively |
|
|
--repodir DIRECTORY |
specify the repository directory in which to run |
|
Revert is used to undo changes made to the local tree which have
not yet been recorded. You will be prompted for which changes you
wish to undo.
The actions of a revert may be reversed using the
unrevert command (see section 5.18). However, if you've made
changes since the revert your mileage may vary, so please be careful.
You can give revert optional arguments indicating files or directories. If
you do so it will only prompt you to revert changes in those files or in
files in those directories.
darcs unrevert
-v |
--verbose |
|
|
--standard-verbosity |
don't give verbose output |
|
|
--ignore-times |
don't trust the file modification times |
|
|
--repodir DIRECTORY |
specify the repository directory in which to run |
|
Unrevert is used to undo the results of a revert command.
While this is only guaranteed to work properly if you haven't made any
changes since the revert was performed, it makes a best effort to merge the
unreversion with any changes you have since made. In fact, unrevert should
even work if you've recorded changes since reverting.
-d |
--dist-name DISTNAME |
|
-v |
--verbose |
|
|
--standard-verbosity |
don't give verbose output |
|
Create a distribution tarball.
Dist is a handy tool for implementing a ``make dist'' target in your
makefile. It creates a tarball of the recorded edition of your tree.
Basically, you will typically use it via a makefile
rule such as
dist:
./darcs dist --dist-name darcs-`./darcs --version`
darcs dist
then simply creates a clean copy of the source tree,
which it then tars and gzips. If you use programs such as autoconf or
automake, you really should run them on the clean tree before tarring it up
and distributing it. You can do this using the pref value ``predist'',
which is a shell command that is run prior to tarring up the distribution:
% darcs setpref predist "autoconf && automake"
|
--case-ok |
don't refuse to add files differing only in case |
|
-v |
--verbose |
|
|
--standard-verbosity |
don't give verbose output |
|
|
--repodir DIRECTORY |
specify the repository directory in which to run |
|
Darcs mv needs to be called whenever you want to rename or move a file or
directory. Unlike remove, mv actually performs the move itself in your
working directory.
This is why ``mv'' isn't called ``move'', since it is
really almost equivalent to the unix command ``mv''. I could add an
equivalent command named ``move'' for those who like vowels.
Darcs mv will by default refuse to rename a file if there already exists a
file having the same name apart from case. This is because doing so could
create a repository that could not be used on file systems that are case
insensitive (such as Apples HFS+). You can override this by with the flag
--case-ok
.
|
--token-chars "[CHARS]" |
define token to contain these characters |
|
|
--force |
proceed with replace even if 'new' token already exists |
|
|
--no-force |
don't force the replace if it looks scary |
|
-v |
--verbose |
|
|
--standard-verbosity |
don't give verbose output |
|
Replace allows you to change a specified token wherever it
occurs in the specified files. Tokens here are defined by a
regexp specifying the characters which are allowed. By default
a token corresponds to a C identifier.
The default regexp is [A-Za-z_0-9]
), and if one of your tokens
contains a `-' or `.', you will then (by default) get the ``filename''
regexp, which is [A-Za-z_0-9\-\.]
. If you prefer to choose a
different set of characters to define your token (perhaps because you are
programming in some other language), you may do so with the
--token-chars
option. You may prefer to define tokens in terms of
delimiting characters instead of allowed characters using a flag such as
--token-chars '[^ \n\t]'
, which would define a token as being
white-space delimited.
If you do choose a non-default token definition, I recommend using
_darcs/prefs/defaults
to always specify the same
--token-chars
, since your replace patches will be better behaved (in
terms of commutation and merges) if they have tokens defined in the same
way.
When using darcs replace, the ``new'' token may not already appear in the
file--if that is the case, the replace change would not be invertible.
This limitation holds both on the working copy of the file
and on the already recorded version of the file.
There is a potentially confusing difference, however, when a replace is
used to make another replace possible:
% darcs replace newtoken aaack ./foo.c
% darcs replace oldtoken newtoken ./foo.c
% darcs record
will be valid, even if newtoken
and oldtoken
are both present
in the recorded version of foo.c, while the sequence
% [manually edit foo.c replacing newtoken with aaack]
% darcs replace oldtoken newtoken ./foo.c
will fail because ``newtoken'' still exists in the recorded version of
foo.c
. The reason for the difference is that when recording, a
``replace'' patch always is recorded before any manual changes,
which is usually what you want, since often you will introduce new
occurences of the ``newtoken'' in your manual changes. In contrast,
``replace'' changes are recorded in the order in which they were made.
-m |
--patch-name PATCHNAME |
|
-A |
--author EMAIL |
|
|
--checkpoint |
|
|
--pipe |
Expect to receive input from a pipe |
|
|
--interactive |
Prompt user interactively |
|
-v |
--verbose |
|
|
--standard-verbosity |
don't give verbose output |
|
Tag is used to name a version of the tree.
Tag differs from record in that it doesn't record any
new changes, and it always depends on all patches residing in the
repository when it is tagged. This means that one can later reproduce this
version of the repository by calling, for example:
% darcs get --tag-name "darcs 3.14" REPOLOCATION
Each tagged version has a version name.
The version is also flagged with the person who tagged it (taken by default
from the `DARCS_EMAIL' or `EMAIL' environment variable). The date is also
included in the version information.
A tagged version automatically depends on all patches in the repo. This
allows you to later reproduce precisely that version. The tag does this by
depending on all patches in the repo, except for those which are depended
upon by other tags already in the repo. In the common case of a sequential
series of tags, this means that the tag depends on all patches since the
last tag, plus that tag itself.
If you run tag with the --pipe
option, you will be prompted for the
tag name and date. This interface is intended for scripting darcs, in
particular for writing repository conversion scripts. The prompts are
intended mostly as useful guide (since scripts won't need them), to help
you understand the format in which to provide the input.
|
--from-match PATTERN |
select changes after a patch matching PATTERN |
|
|
--from-patch REGEXP |
select changes after a patch matching REGEXP |
|
|
--from-tag REGEXP |
select changes after a tag matching REGEXP |
|
|
--last NUMBER |
select the last NUMBER patches |
|
|
--context |
give output suitable for get -context |
|
|
--xml-output |
generate XML formatted output |
|
|
--human-readable |
give human-readable output |
|
-s |
--summary |
|
|
--no-summary |
|
|
--reverse |
show changes in reverse order |
|
|
--repo URL |
specify the repository URL |
|
Changes gives a human-readable list of changes between versions
suitable for use as a changelog.
When given one or more files or directories as an argument, changes lists
only those patches which affect those files or the contents of those
directories, or of course the directories themselves.
If changes is given a --from-patch
, --from-match
, or
--from-tag
option, it outputs only those changes since that tag or
patch.
When given the --context
flag, darcs changes outputs sufficient
information which will allow the current state of the repository to be
recreated at a later date. This information should generally be piped to a
file, and then can be used later in conjunction with
darcs get --context
to recreate the current version. Note that
while the --context
flag may be used in conjunction with
--xml-output
or --human-readable
, in neither case will darcs
get be able to read the output. On the other hand, sufficient information
will be output for a knowledgeable human to recreate the current
state of the repository.
|
--from-match PATTERN |
select changes after a patch matching PATTERN |
|
|
--from-patch REGEXP |
select changes after a patch matching REGEXP |
|
|
--from-tag REGEXP |
select changes after a tag matching REGEXP |
|
|
--last NUMBER |
select the last NUMBER patches |
|
|
--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 |
|
|
--diff-opts OPTIONS |
|
-u |
--unified |
|
|
--repodir DIRECTORY |
specify the repository directory in which to run |
|
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 the version in your working directory. If you give
diff no version arguments, it gives you the same information as
whatsnew except that the patch is formatted as the output of a
diff command.
Diff 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/
FIXME: I should allow the user to specify the external diff command.
Currently it is hardwired to "diff".
Usage example:
% darcs setpref test "echo I am not really testing anything."
Setpref allows you to set a preferences value in a way
that will propagate to other repositories.
Valid preferences are: test predist boringfile binariesfile.
If you just want to set the pref value in your
repository only, you can just edit ``_darcs/prefs/prefs
''. Changes
you make in that file will be preserved.
The ``_darcs/prefs/prefs
'' holds the only preferences information
that can propagate between repositories via pushes and pulls, and the only
way this happens is when the setprefs command is used. Note that although
prefs settings are included in patches, they are not fully version
controlled. In particular, depending on the order in which a series of
merges is perform, you may end up with a different final prefs
configuration. In practice I don't expect this to be a problem, as the
prefs usually won't be changed very often.
The following values are valid preferences options which can be configured
using setpref:
- ``test'' -- the command to run as a test script.
- ``predist'' -- a command to run prior to tarring up a distribution
tarball. Typically this would consist of autoconf and/or automake.
- ``boringfile'' -- the name of a file to read instead of the
``boring'' prefs file.
- ``binariesfile'' -- the name of a file to read instead of the
``binaries'' prefs file.
-v |
--verbose |
|
|
--standard-verbosity |
don't give verbose output |
|
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.
When given no options, trackdown tries to find the
latest version that passes the test (i.e. the test that is run under 'darcs
record'). If you give it a single argument, it is interpereted as a shell
command to be run as a test. If you give it two arguments, the first is a
shell command that is run only once (e.g. autoconf, perhaps) and the second
is the ``test command''.
Trackdown is helpful for locating when something was broken. 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 unpull 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.
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'
-v |
--verbose |
|
|
--standard-verbosity |
don't give verbose output |
|
|
--ignore-times |
don't trust the file modification times |
|
|
--repodir DIRECTORY |
specify the repository directory in which to run |
|
Resolve is used to mark and resolve any conflicts that may exist in a
repository. Note that this trashes any unrecorded changes in the working
directory.
|
--checkpoint |
|
|
--compress |
create compressed patches |
|
|
--dont-compress |
don't create compressed patches |
|
|
--uncompress |
|
-t |
--tag-name TAGNAME |
|
-v |
--verbose |
|
|
--standard-verbosity |
don't give verbose output |
|
Optimize reorganizes your repository data to make it more efficient to access
Optimize will always write out a fresh copy of the inventory that minimizes
the amount of inventory that need be downloaded when people pull from the
repo.
If you use the --checkpoint
flag optimize creates a checkpoint patch
for a tag. You can specify the tag with the --tag-name
option, or
just let darcs choose the most recent tag.
If you give the compress
flag, optimize will compress all the
patches in the repository. Similarly, if you give the uncompress
or
dont-compress
flag, optimize will decompress all the patches in the
repository. You might want to do this on large repositories if you have
plenty of disk space but run into memory pressure, since it will allow
darcs to open the patch files via mmap.
darcs annotate
-v |
--verbose |
|
|
--standard-verbosity |
don't give verbose output |
|
-s |
--summary |
|
|
--no-summary |
|
-u |
--unified |
output patch in format similar to diff -u |
|
|
--human-readable |
give human-readable output |
|
|
--xml-output |
generate XML formatted output |
|
|
--match PATTERN |
select patch matching PATTERN |
|
-p |
--patch REGEXP |
select patch matching REGEXP |
|
-t |
--tag REGEXP |
select tag matching REGEXP |
|
|
--repodir DIRECTORY |
specify the repository directory in which to run |
|
Display useful information about the repository history.
Annotate allows you to extract all sorts of interesting information from
your repository.
When called with just a patch name, annotate outputs the patch in darcs
format. The --summary
, --human-readable
or --unified
options may be used to modify the format with which it is displayed.
If a directory name is given, annotate will output the contents of that
directory. If a patch name is given, the contents of that directory after
that patch was applied will be output. If a tag name is given, the
contents of that directory in the specified tagged version will be output.
If a file name is given, the contents of that file will be output, along
with markup indicating when each line was last (and perhaps next) modified.
-v |
--verbose |
|
-q |
--quiet |
suppress informational output |
|
|
--standard-verbosity |
neither verbose nor quiet output |
|
Repair attempts to fix corruption that may have entered your
repository.
Repair currently will only repair damage to the _darcs/current
directory. Fortunately this is just the sort of corruption that is most
likely to happen.
Isaac Jones
2004-08-31