%% This file was automatically generated by preproc. % Copyright (C) 2002-2003 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \documentclass{book} %\usepackage{color} \usepackage{verbatim} \usepackage{html} \usepackage{fancyvrb} \newenvironment{code}{\comment}{\endcomment} % \newenvironment{code}{\color{blue}\verbatim}{\endverbatim} \begin{document} % Definition of title page: \title{ Darcs 2.2.0 (release)\\ {\Large\itshape Darcs} } \author{ David Roundy } \maketitle \tableofcontents \chapter{Introduction} Darcs is a revision control system, along the lines of CVS or arch. That means that it keeps track of various revisions and branches of your project, allows for changes to propagate from one branch to another. Darcs is intended to be an ``advanced'' revision control system. Darcs has two particularly distinctive features which differ from other revision control systems: 1) each copy of the source is a fully functional branch, and 2) underlying darcs is a consistent and powerful theory of patches. \paragraph{Every source tree a branch} The primary simplifying notion of darcs is that \emph{every} copy of your source code is a full repository. This is dramatically different from CVS, in which the normal usage is for there to be one central repository from which source code will be checked out. It is closer to the notion of arch, since the `normal' use of arch is for each developer to create his own repository. However, darcs makes it even easier, since simply checking out the code is all it takes to create a new repository. This has several advantages, since you can harness the full power of darcs in any scratch copy of your code, without committing your possibly destabilizing changes to a central repository. \paragraph{Theory of patches} The development of a simplified theory of patches is what originally motivated me to create darcs. This patch formalism means that darcs patches have a set of properties, which make possible manipulations that couldn't be done in other revision control systems. First, every patch is invertible. Secondly, sequential patches (i.e.\ patches that are created in sequence, one after the other) can be reordered, although this reordering can fail, which means the second patch is dependent on the first. Thirdly, patches which are in parallel (i.e.\ both patches were created by modifying identical trees) can be merged, and the result of a set of merges is independent of the order in which the merges are performed. This last property is critical to darcs' philosophy, as it means that a particular version of a source tree is fully defined by the list of patches that are in it, i.e.\ there is no issue regarding the order in which merges are performed. For a more thorough discussion of darcs' theory of patches, see Appendix~\ref{Patch}. \paragraph{A simple advanced tool} Besides being ``advanced'' as discussed above, darcs is actually also quite simple. Versioning tools can be seen as three layers. At the foundation is the ability to manipulate changes. On top of that must be placed some kind of database system to keep track of the changes. Finally, at the very top is some sort of distribution system for getting changes from one place to another. Really, only the first of these three layers is of particular interest to me, so the other two are done as simply as possible. At the database layer, darcs just has an ordered list of patches along with the patches themselves, each stored as an individual file. Darcs' distribution system is strongly inspired by that of arch. Like arch, darcs uses a dumb server, typically apache or just a local or network file system when pulling patches. darcs has built-in support for using \verb!ssh! to write to a remote file system. A darcs executable is called on the remote system to apply the patches. Arbitrary other transport protocols are supported, through an environment variable describing a command that will run darcs on the remote system. See the documentation for DARCS\_APPLY\_FOO in Chapter~\ref{configuring} for details. The recommended method is to send patches through gpg-signed email messages, which has the advantage of being mostly asynchronous. \paragraph{Keeping track of changes rather than versions} In the last paragraph, I explained revision control systems in terms of three layers. One can also look at them as having two distinct uses. One is to provide a history of previous versions. The other is to keep track of changes that are made to the repository, and to allow these changes to be merged and moved from one repository to another. These two uses are distinct, and almost orthogonal, in the sense that a tool can support one of the two uses optimally while providing no support for the other. Darcs is not intended to maintain a history of versions, although it is possible to kludge together such a revision history, either by making each new patch depend on all previous patches, or by tagging regularly. In a sense, this is what the tag feature is for, but the intention is that tagging will be used only to mark particularly notable versions (e.g.\ released versions, or perhaps versions that pass a time consuming test suite). Other revision control systems are centered upon the job of keeping track of a history of versions, with the ability to merge changes being added as it was seen that this would be desirable. But the fundamental object remained the versions themselves. In such a system, a patch (I am using patch here to mean an encapsulated set of changes) is uniquely determined by two trees. Merging changes that are in two trees consists of finding a common parent tree, computing the diffs of each tree with their parent, and then cleverly combining those two diffs and applying the combined diff to the parent tree, possibly at some point in the process allowing human intervention, to allow for fixing up problems in the merge such as conflicts. In the world of darcs, the source tree is \emph{not} the fundamental object, but rather the patch is the fundamental object. Rather than a patch being defined in terms of the difference between two trees, a tree is defined as the result of applying a given set of patches to an empty tree. Moreover, these patches may be reordered (unless there are dependencies between the patches involved) without changing the tree. As a result, there is no need to find a common parent when performing a merge. Or, if you like, their common parent is defined by the set of common patches, and may not correspond to any version in the version history. One useful consequence of darcs' patch-oriented philosophy is that since a patch need not be uniquely defined by a pair of trees (old and new), we can have several ways of representing the same change, which differ only in how they commute and what the result of merging them is. Of course, creating such a patch will require some sort of user input. This is a Good Thing, since the user \emph{creating} the patch should be the one forced to think about what he really wants to change, rather than the users merging the patch. An example of this is the token replace patch (See Section~\ref{token_replace}). This feature makes it possible to create a patch, for example, which changes every instance of the variable ``stupidly\_named\_var'' to ``better\_var\_name'', while leaving ``other\_stupidly\_named\_var'' untouched. When this patch is merged with any other patch involving the ``stupidly\_named\_var'', that instance will also be modified to ``better\_var\_name''. This is in contrast to a more conventional merging method which would not only fail to change new instances of the variable, but would also involve conflicts when merging with any patch that modifies lines containing the variable. By more using additional information about the programmer's intent, darcs is thus able to make the process of changing a variable name the trivial task that it really is, which is really just a trivial search and replace, modulo tokenizing the code appropriately. The patch formalism discussed in Appendix~\ref{Patch} is what makes darcs' approach possible. In order for a tree to consist of a set of patches, there must be a deterministic merge of any set of patches, regardless of the order in which they must be merged. This requires that one be able to reorder patches. While I don't know that the patches are required to be invertible as well, my implementation certainly requires invertibility. In particular, invertibility is required to make use of Theorem~\ref{merge_thm}, which is used extensively in the manipulation of merges. \section{Features} \paragraph{Record changes locally} In darcs, the equivalent of a cvs ``commit'' is called record, because it doesn't put the change into any remote or centralized repository. Changes are always recorded locally, meaning no net access is required in order to work on your project and record changes as you make them. Moreover, this means that there is no need for a separate ``disconnected operation'' mode. \paragraph{Interactive records} You can choose to perform an interactive record, in which case darcs will prompt you for each change you have made and ask if you wish to record it. Of course, you can tell darcs to record all the changes in a given file, or to skip all the changes in a given file, or go back to a previous change, or whatever. There is also an experimental graphical interface, which allows you to view and choose changes even more easily, and in whichever order you like. \paragraph{Unrecord local changes} As a corollary to the ``local'' nature of the record operation, if a change hasn't yet been published to the world---that is, if the local repository isn't accessible by others---you can safely unrecord a change (even if it wasn't the most recently recorded change) and then re-record it differently, for example if you forgot to add a file, introduced a bug or realized that what you recorded as a single change was really two separate changes. \paragraph{Interactive everything else} Most darcs commands support an interactive interface. The ``revert'' command, for example, which undoes unrecorded changes has the same interface as record, so you can easily revert just a single change. Pull, push, send and apply all allow you to view and interactively select which changes you wish to pull, push, send or apply. \paragraph{Test suites} Darcs has support for integrating a test suite with a repository. If you choose to use this, you can define a test command (e.g.\ ``make check'') and have darcs run that command on a clean copy of the project either prior to recording a change or prior to applying changes---and to reject changes that cause the test to fail. \paragraph{Any old server} Darcs does not require a specialized server in order to make a repository available for read access. You can use http, ftp, or even just a plain old ssh server to access your darcs repository. \paragraph{You decide write permissions} Darcs doesn't try to manage write access. That's your business. Supported push methods include direct ssh access (if you're willing to \emph{give} direct ssh access away), using sudo to allow users who already have shell access to only apply changes to the repository, or verification of gpg-signed changes sent by email against a list of allowed keys. In addition, there is good support for submission of patches by email that are not automatically applied, but can easily be applied with a shell escape from a mail reader (this is how I deal with contributions to darcs). \paragraph{Symmetric repositories} Every darcs repository is created equal (well, with the exception of a ``partial'' repository, which doesn't contain a full history\ldots), and every working directory has an associated repository. As a result, there is a symmetry between ``uploading'' and ``downloading'' changes---you can use the same commands (push or pull) for either purpose. \paragraph{CGI script} Darcs has a CGI script that allows browsing of the repositories. \paragraph{Portable} Darcs runs on UNIX (or UNIX-like) systems (which includes Mac~OS~X) as well as on Microsoft Windows. \paragraph{File and directory moves} Renames or moves of files and directories, of course are handled properly, so when you rename a file or move it to a different directory, its history is unbroken, and merges with repositories that don't have the file renamed will work as expected. \paragraph{Token replace} You can use the ``darcs replace'' command to modify all occurrences of a particular token (defined by a configurable set of characters that are allowed in ``tokens'') in a file. This has the advantage that merges with changes that introduce new copies of the old token will have the effect of changing it to the new token---which comes in handy when changing a variable or function name that is used throughout a project. \paragraph{Configurable defaults} You can easily configure the default flags passed to any command on either a per-repository or a per-user basis or a combination thereof. \section{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 \emph{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. \paragraph{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:\\ % The \hspace commands force a line break in the postscript output, % but they are effectively ignored in the html output. \begin{description}\addtolength{\itemsep}{-0.5\baselineskip} \item[{\tt cvs checkout}\hspace*{100em}] {\tt darcs get} \item[{\tt cvs update}\hspace*{100em}] {\tt darcs pull} \item[{\tt cvs -n update}\hspace*{100em}] {\tt darcs pull \verb!--dry-run!} (summarize remote changes) \item[{\tt cvs -n update}\hspace*{100em}] {\tt darcs whatsnew \verb!--summary!} (summarize local changes) \item[{\tt cvs -n update | grep '?'}\hspace*{100em}] {\tt darcs whatsnew -ls | grep \verb!^a! } (list potential files to add) \item[{\tt rm foo.txt; cvs update foo.txt}\hspace*{100em}] {\tt darcs revert foo.txt} (revert to foo.txt from repo) \item[{\tt cvs diff}\hspace*{100em}] {\tt darcs whatsnew} (if checking local changes) \item[{\tt cvs diff}\hspace*{100em}] {\tt darcs diff} (if checking recorded changes) \item[{\tt cvs commit}\hspace*{100em}] {\tt darcs record} (if committing locally) \item[{\tt cvs commit}\hspace*{100em}] {\tt darcs tag} (if marking a version for later use) \item[{\tt cvs commit}\hspace*{100em}] {\tt darcs push} or {\tt darcs send} (if committing remotely) \item[{\tt cvs diff | mail}\hspace*{100em}] {\tt darcs send} \item[{\tt cvs add}\hspace*{100em}] {\tt darcs add} \item[{\tt cvs tag -b}\hspace*{100em}] {\tt darcs get} \item[{\tt cvs tag}\hspace*{100em}] {\tt darcs tag} \end{description} \paragraph{Migrating CVS repositories to darcs} Tools and instructions for migrating CVS repositories to darcs are provided on the darcs community website: \htmladdnormallinkfoot{http://darcs.net/DarcsWiki/ConvertingFromCvs}{http://darcs.net/DarcsWiki/ConvertingFromCvs} \section{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 --- \verb|tla| \verb|get|, \verb|update|, \verb|commit|, \verb|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: \verb|darcs| \verb|record|, which stores edits into your local repository, and \verb|pull|, which moves data between repositories. (\verb|darcs| \verb|push| is merely the opposite of \verb|pull|; \verb|send| and \verb|apply| are just the two halves of \verb|push|). \paragraph{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:\\ \begin{description}\addtolength{\itemsep}{-0.5\baselineskip} \item[{\tt tla init-tree}\hspace*{100em}] {\tt darcs initialize} \item[{\tt tla get}\hspace*{100em}] {\tt darcs get} \item[{\tt tla update}\hspace*{100em}] {\tt darcs pull} \item[{\tt tla file-diffs f | patch -R }\hspace*{100em}] {\tt darcs revert} \item[{\tt tla changes --diffs}\hspace*{100em}] {\tt darcs whatsnew} \item[{\tt tla logs}\hspace*{100em}] {\tt darcs changes} \item[{\tt tla file-diffs}\hspace*{100em}] {\tt darcs diff -u} \item[{\tt tla add}\hspace*{100em}] {\tt darcs add} \item[{\tt tla mv}\hspace*{100em}] {\tt darcs mv} (not {\tt tla move}) \item[{\tt tla commit}\hspace*{100em}] {\tt darcs record} (if committing locally) \item[{\tt tla commit}\hspace*{100em}] {\tt darcs tag} (if marking a version for later use) \item[{\tt tla commit}\hspace*{100em}] {\tt darcs push} or {\tt darcs send} (if committing remotely) \item[{\tt tla archive-mirror}\hspace*{100em}] {\tt darcs pull} or {\tt darcs push} \item[{\tt tla tag}\hspace*{100em}] {\tt darcs get} (if creating a branch) \item[{\tt tla tag}\hspace*{100em}] {\tt darcs tag} (if creating a tag). \end{description} \paragraph{Migrating arch repositories to darcs} Tools and instructions for migrating arch repositories to darcs are provided on the darcs community website: \htmladdnormallinkfoot{http://darcs.net/DarcsWiki/ConvertingFromArch}{http://darcs.net/DarcsWiki/ConvertingFromArch} \chapter{Building darcs} This chapter should walk you through the steps necessary to build darcs for yourself. There are in general two ways to build darcs. One is for building released versions from tarballs, and the other is to build the latest and greatest darcs, from the darcs repo itself. Please let me know if you have any problems building darcs, or don't have problems described in this chapter and think there's something obsolete here, so I can keep this page up-to-date. \section{Prerequisites} To build darcs you will need to have {\tt ghc}, the Glorious Glasgow Haskell Compiler. You should have at the very minimum version 6.4. It is a good idea (but not required) to have software installed that provide darcs network access. The {\tt libwww-dev}, {\tt libwww-ssl-dev} or {\tt libcurl} packages newer than than 7.18.0 are recommended because they provide pipelining support speed up HTTP access. They have to be explicitly chosen with {\tt --with-libwww} or {\tt --with-curl-pipelining}. Otherwise, darcs will automatically look for one of libcurl, {\tt curl} or {\tt wget}. You also might want to have scp available if you want to grab your repos over ssh\ldots To use the \verb!diff! command of darcs, a \verb!diff! program supporting options \verb!-r! (recursive diff) and \verb!-N! (show new files as differences against an empty file) is required. The \verb!configure! script will look for \verb!gdiff!, \verb!gnudiff! and \verb!diff! in this order. You can force the use of another program by setting the \verb!DIFF! environment variable before running \verb!configure!. To rebuild the documentation (which should not be necessary since it is included in html form with the tarballs), you will need to have latex installed, as well as latex2html if you want to build it in html form. \section{Building on Mac~OS~X} To build on Mac~OS~X, you will need the Apple Developer Tools and the ghc 6.4 package installed. \section{Building on Microsoft Windows} To build on Microsoft Windows, you will need: \begin{itemize} \item \htmladdnormallinkfoot{MinGW}{http://www.mingw.org/} which provides the GCC toolchain for win32. \item \htmladdnormallinkfoot{MSYS}{http://www.mingw.org/msys.shtml} which provides a unix build environment for win32. Be sure to download the separate msysDTK, autoconf and automake. \item \htmladdnormallinkfoot{zlib-1.2.1+}{http://www.gzip.org/zlib/} library and headers. \item \htmladdnormallinkfoot{curl-7.12.2+}{http://curl.haxx.se/} library and headers. \item If building with an SSL enabled curl you will need the OpenSSL libraries, unofficial builds are available at\\ \htmladdnormallink{http://www.slproweb.com/products/Win32OpenSSL.html}{http://www.slproweb.com/products/Win32OpenSSL.html}. \end{itemize} Copy the zlib and curl libraries and headers to both GHC and MinGW. GHC stores C headers in \verb!<ghc-dir>/gcc-lib/include! and libraries in \verb!<ghc-dir>/gcc-lib!. MinGW stores headers in \verb!<mingw-dir>/include! and libraries in \verb!<mingw-dir>/lib!. Set PATH to include the \verb!<msys-dir>/bin!, \verb!<mingw-dir>/bin!, \verb!<curl-dir>!, and a directory containing a pre-built darcs.exe if you want the build's patch context stored for `\verb!darcs --exact-version!'. \begin{verbatim} C:\darcs> cd <darcs-source-dir> C:\darcs> sh $ export GHC=/c/<ghc-dir>/bin/ghc.exe $ autoconf $ ./configure --target=mingw $ make \end{verbatim} \section{Building from tarball} If you get darcs from a tarball, the procedure (after unpacking the tarball itself) is as follows: \begin{verbatim} % ./configure % make # Optional, but recommended % make test % make install \end{verbatim} There are options to configure that you may want to check out with \begin{verbatim} % ./configure --help \end{verbatim} If your header files are installed in a non-standard location, you may need to define the \verb!CFLAGS! and \verb!CPPFLAGS! environment variables to include the path to the headers. e.g. on NetBSD, you may need to run \begin{verbatim} % CFLAGS=-I/usr/pkg/include CPPFLAGS=-I/usr/pkg/include ./configure \end{verbatim} \section{Building darcs from the repository} To build the latest darcs from its repository, you will first need a working copy of Darcs 2. You can get darcs using: \begin{verbatim} % darcs get -v http://darcs.net/ \end{verbatim} and once you have the darcs repository you can bring it up to date with a \begin{verbatim} % darcs pull \end{verbatim} The repository doesn't hold automatically generated files, which include the configure script and the HTML documentation, so you need to run \verb!autoconf! first. You'll need \verb!autoconf! 2.50 or higher. Some systems have more than one version of \verb!autoconf! installed. For example, \verb!autoconf! may point to version 2.13, while \verb!autoconf259! runs version 2.59. Also note that \verb!make! is really "GNU make". On some systems, such as the *BSDs, you may need to type \verb!gmake! instead of make for this to work. If you want to create readable documentation you'll need to have latex installed. \begin{verbatim} % autoconf % ./configure % make % make install \end{verbatim} If you want to tweak the configure options, you'll need to run {\tt ./configure} yourself after the make, and then run make again. \section{Submitting patches to darcs} I know, this doesn't really belong in this chapter, but if you're using the repository version of darcs it's really easy to submit patches to me using darcs. In fact, even if you don't know any Haskell, you could submit fixes or additions to this document (by editing \verb!building_darcs.tex!) based on your experience building darcs\ldots To do so, just record your changes (which you made in the darcs repository) \begin{verbatim} % darcs record --no-test \end{verbatim} making sure to give the patch a nice descriptive name. The \verb!--no-test! options keeps darcs from trying to run the unit tests, which can be rather time-consuming. Then you can send the patch to the darcs-devel mailing list by email by \begin{verbatim} % darcs send \end{verbatim} If you are using darcs 2.0.0 or earlier, please use \begin{verbatim} % darcs send -u \end{verbatim} instead. The darcs repository stores the email address to which patches should be sent by default. The email address you see is actually my own, but when darcs notices that you haven't signed the patch with my GPG key, it will forward the message to darcs-devel. \chapter{Getting started} This chapter will lead you through an example use of darcs, which hopefully will allow you to get started using darcs with your project. \section{Creating your repository} Creating your repository in the first place just involves telling darcs to create the special directory (called {\tt \_darcs}) in your project tree, which will hold the revision information. This is done by simply calling from the root directory of your project: \begin{verbatim} % cd my_project/ % darcs initialize \end{verbatim} This creates the \verb|_darcs| directory and populates it with whatever files and directories are needed to describe an empty project. You now need to tell darcs what files and directories in your project should be under revision control. You do this using the command \verb|darcs add|% \footnote{Note that darcs does not do wildcard expansion, instead relying on the command shell. The Windows port of darcs has a limited form of expansion provided by the C runtime}: \begin{verbatim} % darcs add *.c Makefile.am configure.ac \end{verbatim} When you have added all your files (or at least, think you have), you will want to record your changes. ``Recording'' always includes adding a note as to why the change was made, or what it does. In this case, we'll just note that this is the initial version. \begin{verbatim} % darcs record --all What is the patch name? Initial revision. \end{verbatim} Note that since we didn't specify a patch name on the command line we were prompted for one. If the environment variable `EMAIL' isn't set, you will also be prompted for your email address. Each patch that is recorded is given a unique identifier consisting of the patch name, its creator's email address, and the date when it was created. \section{Making changes} Now that we have created our repository, make a change to one or more of your files. After making the modification run: \begin{verbatim} % darcs whatsnew \end{verbatim} This should show you the modifications that you just made, in the darcs patch format. If you prefer to see your changes in a different format, read Section~\ref{whatsnew}, which describes the whatsnew command in detail. Let's say you have now made a change to your project. The next thing to do is to record a patch. Recording a patch consists of grouping together a set of related changes, and giving them a name. It also tags the patch with the date it was recorded and your email address. To record a patch simply type: \begin{verbatim} % darcs record \end{verbatim} darcs will then prompt you with all the changes that you have made that have not yet been recorded, asking you which ones you want to include in the new patch. Finally, darcs will ask you for a name for the patch. You can now rerun whatsnew, and see that indeed the changes you have recorded are no longer marked as new. \section{Making your repository visible to others} How do you let the world know about these wonderful changes? Obviously, they must be able to see your repository. Currently the easiest way to do this is typically by http using any web server. The recommended way to do this (using apache in a UNIX environment) is to create a directory called {\tt /var/www/repos}, and then put a symlink to your repository there: \begin{verbatim} % cd /var/www/repos % ln -s /home/username/myproject . \end{verbatim} As long as you're running a web server and making your repository available to the world, you may as well make it easy for people to see what changes you've made. You can do this by running \verb!make installserver!, which installs the program \verb|darcs_cgi| at \verb|/usr/lib/cgi-bin/darcs|. You also will need to create a cache directory named \verb!/var/cache/darcs_cgi!, and make sure the owner of that directory is the same user that your web server runs its cgi scripts as. For me, this is www-data. Now your friends and enemies should be able to easily browse your repositories by pointing their web browsers at \verb|http://your.server.org/cgi-bin/darcs|. \section{Getting changes made to another repository} Ok, so I can now browse your repository using my web browser\ldots\ so what? How do I get your changes into \emph{my} repository, where they can do some good? It couldn't be easier. I just \verb|cd| into my repository, and there type: \begin{verbatim} % darcs pull http://your.server.org/repos/yourproject \end{verbatim} Darcs will check to see if you have recorded any changes that aren't in my current repository. If so, it'll prompt me for each one, to see which ones I want to add to my repository. Note that you may see a different series of prompts depending on your answers, since sometimes one patch depends on another, so if you answer yes to the first one, you won't be prompted for the second if the first depends on it. Of course, maybe I don't even have a copy of your repository. In that case I'd want to do a \begin{verbatim} % darcs get http://your.server.org/repos/yourproject \end{verbatim} which gets the whole repository. I could instead create an empty repository and fetch all of your patches with pull. Get is just a more efficient way to clone a whole repository. Get, pull and push also work over ssh. Ssh-paths are of the same form accepted by scp, namely \verb|[username@]host:/path/to/repository|. \section{Moving patches from one repository to another} Darcs is flexible as to how you move patches from one repository to another. This section will introduce all the ways you can get patches from one place to another, starting with the simplest and moving to the most complicated. \subsection{All pulls} The simplest method is the ``all-pull'' method. This involves making each repository readable (by http, ftp, nfs-mounted disk, whatever), and you run \verb|darcs pull| in the repository you want to move the patch to. This is nice, as it doesn't require you to give write access to anyone else, and is reasonably simple. \subsection{Send and apply manually} Sometimes you have a machine on which it is not convenient to set up a web server, perhaps because it's behind a firewall or perhaps for security reasons, or because it is often turned off. In this case you can use \verb|darcs send| from that computer to generate a patch bundle destined for another repository. You can either let darcs email the patch for you, or save it as a file and transfer it by hand. Then in the destination repository you (or the owner of that repository) run \verb|darcs apply| to apply the patches contained in the bundle. This is also quite a simple method since, like the all-pull method, it doesn't require that you give anyone write access to your repository. But it's less convenient, since you have to keep track of the patch bundle (in the email, or whatever). If you use the send and apply method with email, you'll probably want to create a \verb!_darcs/prefs/email! file containing your email address. This way anyone who sends to your repository will automatically send the patch bundle to your email address. If you receive many patches by email, you probably will benefit by running darcs apply directly from your mail program. I have in my \verb!.muttrc! the following: \begin{verbatim} auto_view text/x-patch text/x-darcs-patch macro pager A "<pipe-entry>darcs apply --verbose --mark-conflicts \ --reply droundy@abridgegame.org --repodir ~/darcs" \end{verbatim} which allows me to view a sent patch, and then apply the patch directly from \verb!mutt!, sending a confirmation email to the person who sent me the patch. The autoview line relies on on the following lines, or something like them, being present in one's \verb!.mailcap!: \begin{verbatim} text/x-patch; cat; copiousoutput text/x-darcs-patch; cat; copiousoutput \end{verbatim} \subsection{Push} If you use ssh (and preferably also ssh-agent, so you won't have to keep retyping your password), you can use the push method to transfer changes (using the scp protocol for communication). This method is again not very complicated, since you presumably already have the ssh permissions set up. Push can also be used when the target repository is local, in which case ssh isn't needed. On the other hand, in this situation you could as easily run a pull, so there isn't much benefit. Note that you can use push to administer a multiple-user repository. You just need to create a user for the repository (or repositories), and give everyone with write access ssh access, perhaps using \verb!.ssh/authorized_keys!. Then they run \begin{verbatim} % darcs push repouser@repo.server:repo/directory \end{verbatim} \subsection{Push ---apply-as} Now we get more subtle. If you like the idea in the previous paragraph about creating a repository user to own a repository which is writable by a number of users, you have one other option. Push \verb!--apply-as! can run on either a local repository or one accessed with ssh, but uses \verb!sudo! to run a darcs apply command (having created a patch bundle as in send) as another user. You can add the following line in your \verb|sudoers| file to allow the users to apply their patches to a centralized repository: {\small \begin{verbatim} ALL ALL = (repo-user) NOPASSWD: /usr/bin/darcs apply --all --repodir /repo/path* \end{verbatim} } This method is ideal for a centralized repository when all the users have accounts on the same computer, if you don't want your users to be able to run arbitrary commands as repo-user. \subsection{Sending signed patches by email} Most of the previous methods are a bit clumsy if you don't want to give each person with write access to a repository an account on your server. Darcs send can be configured to send a cryptographically signed patch by email. You can then set up your mail system to have darcs verify that patches were signed by an authorized user and apply them when a patch is received by email. The results of the apply can be returned to the user by email. Unsigned patches (or patches signed by unauthorized users) will be forwarded to the repository owner (or whoever you configure them to be forwarded to\ldots). This method is especially nice when combined with the \verb!--test! option of darcs apply, since it allows you to run the test suite (assuming you have one) and reject patches that fail---and it's all done on the server, so you can happily go on working on your development machine without slowdown while the server runs the tests. Setting up darcs to run automatically in response to email is by far the most complicated way to get patches from one repository to another\ldots\ so it'll take a few sections to explain how to go about it. \paragraph{Security considerations} When you set up darcs to run apply on signed patches, you should assume that a user with write access can write to any file or directory that is writable by the user under which the apply process runs. Unless you specify the \verb!--no-test! flag to darcs apply (and this is \emph{not} the default), you are also allowing anyone with write access to that repository to run arbitrary code on your machine (since they can run a test suite---which they can modify however they like). This is quite a potential security hole. For these reasons, if you don't implicitly trust your users, it is recommended that you create a user for each repository to limit the damage an attacker can do with access to your repository. When considering who to trust, keep in mind that a security breach on any developer's machine could give an attacker access to their private key and passphrase, and thus to your repository. \paragraph{Installing necessary programs} You also must install the following programs: gnupg, a mailer configured to receive mail (e.g.\ exim, sendmail or postfix), and a web server (usually apache). If you want to be able to browse your repository on the web you must also configure your web server to run cgi scripts and make sure the darcs cgi script was properly installed (by either a darcs-server package, or `make install-server'). \paragraph{Granting access to a repository} You create your gpg key by running (as your normal user): \begin{verbatim} % gpg --gen-key \end{verbatim} You will be prompted for your name and email address, among other options. %%To add your public key to the allowed keys keyring. Of course, you can skip this step if you already have a gpg key you wish to use. You now need to export the public key so we can tell the patcher about it. You can do this with the following command (again as your normal user): \begin{verbatim} % gpg --export "email@address" > /tmp/exported_key \end{verbatim} And now we can add your key to the \verb!allowed_keys!: \begin{verbatim} (as root)> gpg --keyring /var/lib/darcs/repos/myproject/allowed_keys \ --no-default-keyring --import /tmp/exported_key \end{verbatim} You can repeat this process any number of times to authorize multiple users to send patches to the repository. You should now be able to send a patch to the repository by running as your normal user, in a working copy of the repository: \begin{verbatim} % darcs send --sign http://your.computer/repos/myproject \end{verbatim} You may want to add ``send sign'' to the file \verb!_darcs/prefs/defaults! so that you won't need to type \verb!--sign! every time you want to send\ldots If your gpg key is protected by a passphrase, then executing \verb!send! with the \verb!--sign! option might give you the following error: \begin{verbatim} darcs failed: Error running external program 'gpg' \end{verbatim} The most likely cause of this error is that you have a misconfigured gpg that tries to automatically use a non-existent gpg-agent program. GnuPG will still work without gpg-agent when you try to sign or encrypt your data with a passphrase protected key. However, it will exit with an error code 2 (\verb!ENOENT!) causing \verb!darcs! to fail. To fix this, you will need to edit your \verb!~/.gnupg/gpg.conf! file and comment out or remove the line that says: \begin{verbatim} use-agent \end{verbatim} If after commenting out or removing the \verb!use-agent! line in your gpg configuration file you still get the same error, then you probably have a modified GnuPG with use-agent as a hard-coded option. In that case, you should change \verb!use-agent! to \verb!no-use-agent! to disable it explicitly. \paragraph{Setting up a sendable repository using procmail} If you don't have root access on your machine, or perhaps simply don't want to bother creating a separate user, you can set up a darcs repository using procmail to filter your mail. I will assume that you already use procmail to filter your email. If not, you will need to read up on it, or perhaps should use a different method for routing the email to darcs. To begin with, you must configure your repository so that a darcs send to your repository will know where to send the email. Do this by creating a file in \verb!/path/to/your/repo/_darcs/prefs! called \verb!email! containing your email address. As a trick (to be explained below), we will create the email address with ``darcs repo'' as your name, in an email address of the form ``David Roundy $<$droundy@abridgegame.org$>$.'' \begin{verbatim} % echo 'my darcs repo <user@host.com>' \ > /path/to/your/repo/_darcs/prefs/email \end{verbatim} The next step is to set up a gnupg keyring containing the public keys of people authorized to send to your repository. Here I'll give a second way of going about this (see above for the first). This time I'll assume you want to give me write access to your repository. You can do this by: \begin{verbatim} gpg --no-default-keyring \ --keyring /path/to/the/allowed_keys --recv-keys D3D5BCEC \end{verbatim} This works because ``D3D5BCEC'' is the ID of my gpg key, and I have uploaded my key to the gpg keyservers. Actually, this also requires that you have configured gpg to access a valid keyserver. You can, of course, repeat this command for all keys you want to allow access to. Finally, we add a few lines to your \verb!.procmailrc!: \begin{verbatim} :0 * ^TOmy darcs repo |(umask 022; darcs apply --reply user@host.com \ --repodir /path/to/your/repo --verify /path/to/the/allowed_keys) \end{verbatim} The purpose for the ``my darcs repo'' trick is partially to make it easier to recognize patches sent to the repository, but is even more crucial to avoid nasty bounce loops by making the \verb!--reply! option have an email address that won't go back to the repository. This means that unsigned patches that are sent to your repository will be forwarded to your ordinary email. Like most mail-processing programs, Procmail by default sets a tight umask. However, this will prevent the repository from remaining world-readable; thus, the ``umask 022'' is required to relax the umask. (Alternatively, you could set Procmail's global \verb!UMASK! variable to a more suitable value.) \paragraph{Checking if your e-mail patch was applied} After sending a patch with \verb!darcs send!, you may not receive any feedback, even if the patch is applied. You can confirm whether or not your patch was applied to the remote repository by pointing \verb!darcs changes! at a remote repository: \begin{verbatim} darcs changes --last=10 --repo=http://darcs.net/ \end{verbatim} That shows you the last 10 changes in the remote repository. You can adjust the options given to \verb!changes! if a more advanced query is needed. \section{Reducing disk space usage} \label{disk-usage} A Darcs repository contains the patches that Darcs uses to store history, the working directory, and a \emph{pristine tree} (a copy of the working directory files with no local modifications). For large repositories, this can add up to a fair amount of disk usage. There are two techniques that can be used to reduce the amount of space used by Darcs repositories: linking and using no pristine tree. The former can be used on any repository; the latter is only suitable in special circumstances, as it makes some operations much slower. \subsection{Linking between repositories} A number of filesystems support \emph{linking} files, sharing a single file data between different directories. Under some circumstances, when repositories are very similar (typically because they represent different branches of the same piece of software), Darcs will use linking to avoid storing the same file multiple times. Whenever you invoke \verb|darcs get| to copy a repository from a local filesystem onto the same filesystem, Darcs will link patches whenever possible. In order to save time, \verb|darcs get| does not link pristine trees even when individual files are identical. Additionally, as you pull patches into trees, patches will become unlinked. This will result in a lot of wasted space if two repositories have been living for a long time but are similar. In such a case, you should \emph{relink} files between the two repositories. Relinking is an asymmetric operation: you relink one repository (to which you must have write access) to another repository, called the \emph{sibling}. This is done with \verb|darcs optimize --relink|, with --the \verb|--sibling| flag specifying the sibling. \begin{verbatim} $ cd /var/repos/darcs.net $ darcs optimize --relink --sibling /var/repos/darcs \end{verbatim} The \verb|--sibling| flag can be repeated multiple times, in which case Darcs will try to find a file to link to in all of the siblings. If a default repository is defined, Darcs will try, as a last resort, to link against the default repository. Additional space savings can be achieved by relinking files in the pristine tree (see below) by using the \verb|--relink-pristine| flag. However, doing this prevents Darcs from having precise timestamps on the pristine files, which carries a moderate performance penalty. \subsection{Alternate formats for the pristine tree} By default, every Darcs repository contains a complete copy of the \emph{pristine tree}, the working tree as it would be if there were no local edits. By avoiding the need to consult a possibly large number of patches just to find out if a file is modified, the pristine tree makes a lot of operations much faster than they would otherwise be. Under some circumstances, keeping a whole pristine tree is not desirable. This is the case when preparing a repository to back up, when publishing a repository on a public web server with limited space, or when storing a repository on floppies or small USB keys. In such cases, it is possible to use a repository with no pristine tree. Darcs automatically recognizes a repository with no pristine tree. In order to create such a tree, specify the \verb|--no-pristine-tree| flag to \verb|darcs initialize| or \verb|darcs get|. There is currently no way to switch an existing repository to use no pristine tree. The support for \verb|--no-pristine-tree| repositories is fairly new, and has not been extensively optimized yet. Please let us know if you use this functionality, and which operations you find are too slow. % Copyright (C) 2004 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; if not, write to the Free Software Foundation, % Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. \chapter{Configuring darcs}\label{configuring} There are several ways you can adjust darcs' behavior to suit your needs. The first is to edit files in the \verb!_darcs/prefs/! directory of a repository. Such configuration only applies when working with that repository. To configure darcs on a per-user rather than per-repository basis (but with essentially the same methods), you can edit (or create) files in the \verb!~/.darcs/! directory (or on Microsoft Windows, the C:/Documents And Settings/user/Application Data/darcs directory). Finally, the behavior of some darcs commands can be modified by setting appropriate environment variables. % Copyright (C) 2002-2003 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \section{prefs} The \verb!_darcs! directory contains a \verb!prefs! directory. This directory exists simply to hold user configuration settings specific to this repository. The contents of this directory are intended to be modifiable by the user, although in some cases a mistake in such a modification may cause darcs to behave strangely. % Copyright (C) 2003 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \paragraph{defaults}\label{defaults} Default values for darcs commands can be configured on a per-repository basis by editing (and possibly creating) the \verb!_darcs/prefs/defaults! file. Each line of this file has the following form: \begin{verbatim} COMMAND FLAG VALUE \end{verbatim} where \verb!COMMAND! is either the name of the command to which the default applies, or \verb!ALL! to indicate that the default applies to all commands accepting that flag. The \verb!FLAG! term is the name of the long argument option without the ``\verb!--!'', i.e.\ \verb!verbose! rather than \verb!--verbose!. Finally, the \verb!VALUE! option can be omitted if the flag is one such as \verb!verbose! that doesn't involve a value. If the value has spaces in it, use single quotes, not double quotes, to surround it. Each line only takes one flag. To set multiple defaults for the same command (or for \verb!ALL! commands), use multiple lines. Note that the use of \verb|ALL| easily can have unpredicted consequences, especially if commands in newer versions of darcs accepts flags that they didn't in previous versions. A command like \verb|obliterate| could be devastating with the ``wrong'' flags (for example --all). Only use safe flags with \verb|ALL|. \begin{tabular}{ll} {\tt \verb!~/.darcs/defaults!} & provides defaults for this user account \\ {\tt \verb!repo/_darcs/prefs/defaults!} & provides defaults for one project,\\ & overrules changes per user \\ \end{tabular} For example, if your system clock is bizarre, you could instruct darcs to always ignore the file modification times by adding the following line to your \verb!_darcs/prefs/defaults! file. (Note that this would have to be done for each repository!) \begin{verbatim} ALL ignore-times \end{verbatim} If you never want to run a test when recording to a particular repository (but still want to do so when running \verb'check' on that repository), and like to name all your patches ``Stupid patch'', you could use the following: \begin{verbatim} record no-test record patch-name Stupid patch \end{verbatim} If you would like a command to be run every time patches are recorded in a particular repository (for example if you have one central repository, that all developers contribute to), then you can set apply to always run a command when apply is successful. For example, if you need to make sure that the files in the repository have the correct access rights you might use the following. There are two things to note about using darcs this way: \begin{itemize} \item Without the second line you will get errors, because the sub process that runs apply cannot prompt interactively. \item Whatever script is run by the post apply command should not be added to the repository with \verb!darcs add!; doing so would allow people to modify that file and then run arbitrary scripts on your main repository, possibly damaging or violating security. \end{itemize} \begin{verbatim} apply posthook chmod -R a+r * apply run-posthook \end{verbatim} Similarly, if you need a command to run automatically before darcs performs an action you can use a prehook. Using prehooks it could be possible to canonicalize line endings before recording patches. There are some options which are meant specifically for use in \verb!_darcs/prefs/defaults!. One of them is \verb!--disable!. As the name suggests, this option will disable every command that got it as argument. So, if you are afraid that you could damage your repositories by inadvertent use of a command like amend-record, add the following line to \verb!_darcs/prefs/defaults!: \begin{verbatim} amend-record disable \end{verbatim} Also, a global preferences file can be created with the name \verb!.darcs/defaults! in your home directory. Options present there will be added to the repository-specific preferences. If they conflict with repository-specific options, the repository-specific ones will take precedence. \paragraph{repos} The \verb!_darcs/prefs/repos! file contains a list of repositories you have pulled from or pushed to, and is used for autocompletion of pull and push commands in bash. Feel free to delete any lines from this list that might get in there, or to delete the file as a whole. \paragraph{author}\label{author_prefs} The \verb!_darcs/prefs/author! file contains the email address (or name) to be used as the author when patches are recorded in this repository, e.g.\ \verb!David Roundy <droundy@abridgegame.org>!. This file overrides the contents of the environment variables \verb!$DARCS_EMAIL! and \verb!$EMAIL!. \paragraph{boring}\label{boring} The \verb!_darcs/prefs/boring! file may contain a list of regular expressions describing files, such as object files, that you do not expect to add to your project. As an example, the boring file that I use with my darcs repository is: \begin{verbatim} \.hi$ \.o$ ^\.[^/] ^_ ~$ (^|/)CVS($|/) \end{verbatim} A newly created repository has a longer boring file that includes many common source control, backup, temporary, and compiled files. You may want to have the boring file under version control. To do this you can use darcs setpref to set the value ``boringfile'' to the name of your desired boring file (e.g.\ \verb-darcs setpref boringfile .boring-, where \verb-.boring- is the repository path of a file that has been darcs added to your repository). The boringfile preference overrides \verb!_darcs/prefs/boring!, so be sure to copy that file to the boringfile. You can also set up a ``boring'' regexps file in your home directory, named \verb!~/.darcs/boring!, which will be used with all of your darcs repositories. Any file not already managed by darcs and whose repository path (such as \verb!manual/index.html!) matches any of the boring regular expressions is considered boring. The boring file is used to filter the files provided to darcs add, to allow you to use a simple \verb-darcs add newdir newdir/*- without accidentally adding a bunch of object files. It is also used when the \verb!--look-for-adds! flag is given to whatsnew or record. Note that once a file has been added to darcs, it is not considered boring, even if it matches the boring file filter. \paragraph{binaries} The \verb!_darcs/prefs/binaries! file may contain a list of regular expressions describing files that should be treated as binary files rather than text files. Darcs automatically treats files containing \verb!^Z\! or \verb!'\0'! within the first 4096 bytes as being binary files. You probably will want to have the binaries file under version control. To do this you can use darcs setpref to set the value ``binariesfile'' to the name of your desired binaries file (e.g.\ \verb'darcs setpref binariesfile ./.binaries', where \verb'.binaries' is a file that has been darcs added to your repository). As with the boring file, you can also set up a \verb!~/.darcs/binaries! file if you like. \paragraph{email} The \verb!_darcs/prefs/email! file is used to provide the e-mail address for your repository that others will use when they \verb!darcs send! a patch back to you. The contents of the file should simply be an e-mail address. \paragraph{sources} The \verb!_darcs/prefs/sources! file is used to indicate alternative locations from which to download patches when using a ``hashed'' repository. This file contains lines such as: \begin{verbatim} cache:/home/droundy/.darcs/cache readonly:/home/otheruser/.darcs/cache repo:http://darcs.net \end{verbatim} This would indicate that darcs should first look in \verb!/home/droundy/.darcs/cache! for patches that might be missing, and if the patch isn't there, it should save a copy there for future use. In that case, darcs will look in \verb!/home/otheruser/.darcs/cache! to see if that user might have downloaded a copy, but won't try to save a copy there, of course. Finally, it will look in \verb!http://darcs.net!. Note that the \verb!sources! file can also exist in \verb!~/.darcs/!. Also note that the sources mentioned in your \verb!sources! file will be tried \emph{before} the repository you are pulling from. This can be useful in avoiding downloading patches multiple times when you pull from a remote repository to more than one local repository. We strongly advise that you enable a global cache directory, which will allow darcs to avoid re-downloading patches (for example, when doing a second darcs get of the same repository), and also allows darcs to use hard links to reduce disk usage. To do this, simply \begin{verbatim} mkdir -p $HOME/.darcs/cache echo cache:$HOME/.darcs/cache > $HOME/.darcs/sources \end{verbatim} Note that the cache directory should reside on the same filesystem as your repositories, so you may need to vary this. You can also use multiple cache directories on different filesystems, if you have several filesystems on which you use darcs. % Copyright (C) 2002-2004 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \paragraph{motd}\label{motd} The \verb!_darcs/prefs/motd! file may contain a ``message of the day'' which will be displayed to users who get or pull from the repository without the \verb!--quiet! option. \section{Environment variables} There are a few environment variables whose contents affect darcs' behavior. Here is a quick list of all the variables and their documentation in the rest of the manual: \begin{tabular}{|l|r|} \hline \textbf{Variable} & \textbf{Section} \\ \hline DARCS\_EDITOR, EDITOR, VISUAL & \ref{env:DARCS_EDITOR} \\ DARCS\_PAGER, PAGER & \ref{env:DARCS_PAGER} \\ HOME & \ref{env:HOME} \\ TERM & \ref{env:TERM} \\ \hline DARCS\_EMAIL, EMAIL & \ref{env:DARCS_EMAIL} \\ \hline DARCS\_APPLY\_FOO & \ref{env:DARCS_X_FOO} \\ DARCS\_GET\_FOO & \ref{env:DARCS_X_FOO} \\ DARCS\_MGET\_FOO & \ref{env:DARCS_X_FOO} \\ DARCS\_MGETMAX & \ref{env:DARCS_MGETMAX} \\ DARCS\_PROXYUSERPWD & \ref{env:DARCS_PROXYUSERPWD} \\ DARCS\_WGET & \ref{env:DARCS_WGET} \\ DARCS\_SSH & \ref{env:DARCS_SSH} \\ DARCS\_SCP & \ref{env:DARCS_SCP} \\ DARCS\_SFTP & \ref{env:DARCS_SFTP} \\ SSH\_PORT & \ref{env:SSH_PORT} \\ \hline DARCS\_ALTERNATIVE\_COLOR & \ref{env:DARCS_ALWAYS_COLOR}\\ DARCS\_ALWAYS\_COLOR & \ref{env:DARCS_ALWAYS_COLOR}\\ DARCS\_DO\_COLOR\_LINES & \ref{env:DARCS_DO_COLOR_LINES}\\ DARCS\_DONT\_COLOR & \ref{env:DARCS_ALWAYS_COLOR} \\ DARCS\_DONT\_ESCAPE\_TRAILING\_CR & \ref{env:DARCS_DONT_ESCAPE_white}\\ DARCS\_DONT\_ESCAPE\_TRAILING\_SPACES & \ref{env:DARCS_DONT_ESCAPE_white} \\ DARCS\_DONT\_ESCAPE\_8BIT & \ref{env:DARCS_DONT_ESCAPE_nonascii}\\ DARCS\_DONT\_ESCAPE\_ANYTHING & \ref{env:DARCS_DONT_ESCAPE_nonascii}\\ DARCS\_DONT\_ESCAPE\_ISPRINT & \ref{env:DARCS_DONT_ESCAPE_nonascii}\\ DARCS\_ESCAPE\_EXTRA & \ref{env:DARCS_DONT_ESCAPE_nonascii}\\ DARCS\_DONT\_ESCAPE\_EXTRA & \ref{env:DARCS_DONT_ESCAPE_nonascii}\\ \hline \end{tabular} \section{General-purpose variables} \paragraph{DARCS\_EDITOR} \label{env:DARCS_EDITOR} When pulling up an editor (for example, when adding a long comment in record), darcs uses the contents of DARCS\_EDITOR if it is defined. If not, it tries the contents of VISUAL, and if that isn't defined (or fails for some reason), it tries EDITOR\@. If none of those environment variables are defined, darcs tries \verb!vi!, \verb!emacs!, \verb!emacs -nw! and \verb!nano! in that order. \paragraph{DARCS\_PAGER} \label{env:DARCS_PAGER} When using a pager for displaying a patch, darcs uses the contents of DARCS\_PAGER if it is defined. If not, it tries the contents of PAGER and then \verb!less!. \paragraph{DARCS\_TMPDIR} \label{env:DARCS_TMPDIR} If the environment variable DARCS\_TMPDIR is defined, darcs will use that directory for its temporaries. Otherwise it will use TMPDIR, if that is defined, and if not that then \verb!/tmp! and if \verb!/tmp! doesn't exist, it'll put the temporaries in \verb!_darcs!. This is very helpful, for example, when recording with a test suite that uses MPI, in which case using \verb!/tmp! to hold the test copy is no good, as \verb!/tmp! isn't shared over NFS and thus the \verb!mpirun! call will fail, since the binary isn't present on the compute nodes. \paragraph{DARCS\_KEEP\_TMPDIR} \label{env:DARCS_KEEP_TMPDIR} If the environment variable DARCS\_KEEP\_TMPDIR is defined, darcs will not remove temprary directories. This can be useful for darcs debugging. \paragraph{HOME} \label{env:HOME} HOME is used to find the per-user prefs directory, which is located at \verb!$HOME/.darcs!. %$ this dollar is a comment to make my emacs leave math mode... (stupid % emacs) \paragraph{TERM} \label{env:TERM} If darcs is compiled with libcurses support and support for color output, it uses the environment variable TERM to decide whether or not color is supported on the output terminal. \section{Remote repositories} \paragraph{SSH\_PORT} \label{env:SSH_PORT} When using ssh, if the SSH\_PORT environment variable is defined, darcs will use that port rather than the default ssh port (which is 22). \paragraph{DARCS\_SSH} \label{env:DARCS_SSH} The DARCS\_SSH environment variable defines the command that darcs will use when asked to run ssh. This command is \emph{not} interpreted by a shell, so you cannot use shell metacharacters, and the first word in the command must be the name of an executable located in your path. \paragraph{DARCS\_SCP and DARCS\_SFTP} \label{env:DARCS_SCP} \label{env:DARCS_SFTP} The DARCS\_SCP and DARCS\_SFTP environment variables define the commands that darcs will use when asked to run scp or sftp. Darcs uses scp and sftp to access repositories whose address is of the form \verb!user@foo.org:foo! or \verb!foo.org:foo!. Darcs will use scp to copy single files (e.g.\ repository meta-information), and sftp to copy multiple files in batches (e.g.\ patches). These commands are \emph{not} interpreted by a shell, so you cannot use shell metacharacters, and the first word in the command must be the name of an executable located in your path. By default, \verb!scp! and \verb!sftp! are used. When you can use sftp, but not scp (e.g.\ some ISP web sites), it works to set DARCS\_SCP to `sftp'. The other way around does not work, i.e.\ DARCS\_FTP must reference an sftp program, not scp. \paragraph{DARCS\_PROXYUSERPWD} \label{env:DARCS_PROXYUSERPWD} This environment variable allows DARCS and libcurl to access remote repositories via a password-protected HTTP proxy. The proxy itself is specified with the standard environment variable for this purpose, namely 'http\_proxy'. The DARCS\_PROXYUSERPWD environment variable specifies the proxy username and password. It must be given in the form \emph{username:password}. \paragraph{DARCS\_GET\_FOO, DARCS\_MGET\_FOO and DARCS\_APPLY\_FOO} \label{env:DARCS_X_FOO} When trying to access a repository with a URL beginning foo://, darcs will invoke the program specified by the DARCS\_GET\_FOO environment variable (if defined) to download each file, and the command specified by the DARCS\_APPLY\_FOO environment variable (if defined) when pushing to a foo:// URL. This method overrides all other ways of getting \verb!foo://xxx! URLs. Note that each command should be constructed so that it sends the downloaded content to STDOUT, and the next argument to it should be the URL\@. Here are some examples that should work for DARCS\_GET\_HTTP: \begin{verbatim} fetch -q -o - curl -s -f lynx -source wget -q -O - \end{verbatim} If set, DARCS\_MGET\_FOO will be used to fetch many files from a single repository simultaneously. Replace FOO and foo as appropriate to handle other URL schemes. These commands are \emph{not} interpreted by a shell, so you cannot use shell metacharacters, and the first word in the command must be the name of an executable located in your path. The GET command will be called with a URL for each file. The MGET command will be invoked with a number of URLs and is expected to download the files to the current directory, preserving the file name but not the path. The APPLY command will be called with a darcs patchfile piped into its standard input. Example: \begin{verbatim} wget -q \end{verbatim} \paragraph{DARCS\_MGETMAX} \label{env:DARCS_MGETMAX} When invoking a DARCS\_MGET\_FOO command, darcs will limit the number of URLs presented to the command to the value of this variable, if set, or 200. \paragraph{DARCS\_WGET} \label{env:DARCS_WGET} This is a very old option that is only used if libcurl is not compiled in and one of the DARCS\_GET\_FOO is not used. Using one of those is recommended instead. The DARCS\_WGET environment variable defines the command that darcs will use to fetch all URLs for remote repositories. The first word in the command must be the name of an executable located in your path. Extra arguments can be included as well, such as: \begin{verbatim} wget -q \end{verbatim} Darcs will append \verb!-i! to the argument list, which it uses to provide a list of URLS to download. This allows wget to download multiple patches at the same time. It's possible to use another command besides \verb!wget! with this environment variable, but it must support the \verb!-i! option in the same way. These commands are \emph{not} interpreted by a shell, so you cannot use shell meta-characters. \section{Highlighted output} \label{env:DARCS_ALWAYS_COLOR} \label{env:DARCS_DO_COLOR_LINES} \label{env:DARCS_DONT_ESCAPE_white} If the terminal understands ANSI color escape sequences, darcs will highlight certain keywords and delimiters when printing patches. This can be turned off by setting the environment variable DARCS\_DONT\_COLOR to 1. If you use a pager that happens to understand ANSI colors, like \verb!less -R!, darcs can be forced always to highlight the output by setting DARCS\_ALWAYS\_COLOR to 1. If you can't see colors you can set DARCS\_ALTERNATIVE\_COLOR to 1, and darcs will use ANSI codes for bold and reverse video instead of colors. In addition, there is an extra-colorful mode, which is not enabled by default, which can be activated with DARCS\_DO\_COLOR\_LINES. By default darcs will escape (by highlighting if possible) any kind of spaces at the end of lines when showing patch contents. If you don't want this you can turn it off by setting DARCS\_DONT\_ESCAPE\_TRAILING\_SPACES to 1. A special case exists for only carriage returns: DARCS\_DONT\_ESCAPE\_TRAILING\_CR. \section{Character escaping and non-ASCII character encodings} \label{env:DARCS_DONT_ESCAPE_nonascii} Darcs needs to escape certain characters when printing patch contents to a terminal. Characters like \emph{backspace} can otherwise hide patch content from the user, and other character sequences can even in some cases redirect commands to the shell if the terminal allows it. By default darcs will only allow printable 7-bit ASCII characters (including space), and the two control characters \emph{tab} and \emph{newline}. (See the last paragraph in this section for a way to tailor this behavior.) All other octets are printed in quoted form (as \verb!^<control letter>! or \verb!\!\verb!<hex code>!). Darcs has some limited support for locales. If the system's locale is a single-byte character encoding, like the Latin encodings, you can set the environment variable DARCS\_DONT\_ESCAPE\_ISPRINT to 1 and darcs will display all the printables in the current system locale instead of just the ASCII ones. NOTE: This curently does not work on some architectures if darcs is compiled with GHC~6.4. Some non-ASCII control characters might be printed and can possibly spoof the terminal. For multi-byte character encodings things are less smooth. UTF-8 will work if you set DARCS\_DONT\_ESCAPE\_8BIT to 1, but non-printables outside the 7-bit ASCII range are no longer escaped. E.g., the extra control characters from Latin-1 might leave your terminal at the mercy of the patch contents. Space characters outside the 7-bit ASCII range are no longer recognized and will not be properly escaped at line endings. As a last resort you can set DARCS\_DONT\_ESCAPE\_ANYTHING to 1. Then everything that doesn't flip code sets should work, and so will all the bells and whistles in your terminal. This environment variable can also be handy if you pipe the output to a pager or external filter that knows better than darcs how to handle your encoding. Note that \emph{all} escaping, including the special escaping of any line ending spaces, will be turned off by this setting. There are two environment variables you can set to explicitly tell darcs to not escape or escape octets. They are DARCS\_DONT\_ESCAPE\_EXTRA and DARCS\_ESCAPE\_EXTRA. Their values should be strings consisting of the verbatim octets in question. The do-escapes take precedence over the dont-escapes. Space characters are still escaped at line endings though. The special environment variable DARCS\_DONT\_ESCAPE\_TRAILING\_CR turns off escaping of carriage return last on the line (DOS style). % This file (unlike the rest of darcs) is in the public domain. \chapter{Best practices} \section{Introduction} This chapter is intended to review various scenarios and describe in each case effective ways of using darcs. There is no one ``best practice'', and darcs is a sufficiently low-level tool that there are many high-level ways one can use it, which can be confusing to new users. The plan (and hope) is that various users will contribute here describing how they use darcs in different environments. However, this is not a wiki, and contributions will be edited and reviewed for consistency and wisdom. \section{Creating patches} This section will lay down the concepts around patch creation. The aim is to develop a way of thinking that corresponds well to how darcs is behaving --- even in complicated situations. In a single darcs repository you can think of two ``versions'' of the source tree. They are called the \emph{working} and \emph{pristine} trees. \emph{Working} is your normal source tree, with or without darcs alongside. The only thing that makes it part of a darcs repository is the \verb!_darcs! directory in its root. \emph{Pristine} is the recorded state of the source tree. The pristine tree is constructed from groups of changes, called {\em patches\/} (some other version control systems use the term {\em changeset\/} instead of {\em patch\/}).\footnote{If you look inside \_darcs you will find files or directories named {\tt patches} and {\tt inventories}, which store all the patches ever recorded. If the repository holds a cached pristine tree, it is stored in a directory called {\tt pristine} or {\tt current\/}; otherwise, the fact that there is no pristine tree is marked by the presence of a file called {\tt pristine.none} or {\tt current.none}.} Darcs will create and store these patches based on the changes you make in \emph{working}. \subsection{Changes} If \emph{working} and \emph{pristine} are the same, there are ``no changes'' in the repository. Changes can be introduced (or removed) by editing the files in \emph{working}. They can also be caused by darcs commands, which can modify \emph{both} \emph{working} and \emph{pristine}. It is important to understand for each darcs command how it modifies \emph{working}, \emph{pristine} or both of them. \verb!whatsnew! (as well as \verb!diff!) can show the difference between \emph{working} and \emph{pristine} to you. It will be shown as a difference in \emph{working}. In advanced cases it need \emph{not} be \emph{working} that has changed; it can just as well have been \emph{pristine}, or both. The important thing is the difference and what darcs can do with it. \subsection{Keeping or discarding changes} If you have a difference in \emph{working}, you do two things with it: \verb!record! it to keep it, or \verb!revert! it to lose the changes.% \footnote{% Revert can undo precious work in a blink. To protect you from great grief, the discarded changes are saved temporarily so the latest revert can be undone with unrevert.} If you have a difference between \emph{working} and \emph{pristine}% ---for example after editing some files in \emph{working}---% \verb!whatsnew! will show some ``unrecorded changes''. To save these changes, use \verb!record!. It will create a new patch in \emph{pristine} with the same changes, so \emph{working} and \emph{pristine} are no longer different. To instead undo the changes in \emph{working}, use \verb!revert!. It will modify the files in \emph{working} to be the same as in \emph{pristine} (where the changes do not exist). \subsection{Unrecording changes} \verb!unrecord! is a command meant to be run only in private repositories. Its intended purpose is to allow developers the flexibility to undo patches that haven't been distributed yet. However, darcs does not prevent you from unrecording a patch that has been copied to another repository. Be aware of this danger! If you \verb!unrecord! a patch, that patch will be deleted from \emph{pristine}. This will cause \emph{working} to be different from \emph{pristine}, and \verb!whatsnew! to report unrecorded changes. The difference will be the same as just before that patch was \verb!record!ed. Think about it. \verb!record! examines what's different with \emph{working} and constructs a patch with the same changes in \emph{pristine} so they are no longer different. \verb!unrecord! deletes this patch; the changes in \emph{pristine} disappear and the difference is back. If the recorded changes included an error, the resulting flawed patch can be unrecorded. When the changes have been fixed, they can be recorded again as a new---hopefully flawless---patch. If the whole change was wrong it can be discarded from \emph{working} too, with \verb!revert!. \verb!revert! will update \emph{working} to the state of \emph{pristine}, in which the changes do no longer exist after the patch was deleted. Keep in mind that the patches are your history, so deleting them with \verb!unrecord! makes it impossible to track what changes you \emph{really} made. Redoing the patches is how you ``cover the tracks''. On the other hand, it can be a very convenient way to manage and organize changes while you try them out in your private repository. When all is ready for shipping, the changes can be reorganized in what seems as useful and impressive patches. Use it with care. All patches are global, so don't \emph{ever} replace an already ``shipped'' patch in this way! If an erroneous patch is deleted and replaced with a better one, you have to replace it in \emph{all} repositories that have a copy of it. This may not be feasible, unless it's all private repositories. If other developers have already made patches or tags in their repositories that depend on the old patch, things will get complicated. \subsection{Special patches and pending} The patches described in the previous sections have mostly been hunks. A \emph{hunk} is one of darcs' primitive patch types, and it is used to remove old lines and/or insert new lines. There are other types of primitive patches, such as \emph{adddir} and \emph{addfile} which add new directories and files, and \emph{replace} which does a search-and-replace on tokens in files. Hunks are always calculated in place with a diff algorithm just before \verb!whatsnew! or \verb!record!. But other types of primitive patches need to be explicitly created with a darcs command. They are kept in \emph{pending}% \footnote{In the file {\tt\_darcs/patches/pending}.} until they are either recorded or reverted. \emph{Pending} can be thought of as a special extension of \emph{working}. When you issue, e.g., a darcs \verb!replace! command, the replace is performed on the files in \emph{working} and at the same time a replace patch is put in \emph{pending}. Patches in \emph{pending} describe special changes made in \emph{working}. The diff algorithm will fictively apply these changes to \emph{pristine} before it compares it to \emph{working}, so all lines in \emph{working} that are changed by a \verb!replace! command will also be changed in \emph{pending}$+$\emph{pristine} when the hunks are calculated. That's why no hunks with the replaced lines will be shown by \verb!whatsnew!; it only shows the replace patch in \emph{pending} responsible for the change. If a special patch is recorded, it will simply be moved to \emph{pristine}. If it is instead reverted, it will be deleted from \emph{pending} and the accompanying change will be removed from \emph{working}. Note that reverting a patch in pending is \emph{not} the same as simply removing it from pending. It actually applies the inverse of the change to \emph{working}. Most notable is that reverting an addfile patch will delete the file in \emph{working} (the inverse of adding it). So if you add the wrong file to darcs by mistake, \emph{don't} \verb!revert! the addfile. Instead use \verb!remove!, which cancels out the addfile in pending. \section{Using patches} % still basics This section will lay down the concepts around patch distribution and branches. The aim is to develop a way of thinking that corresponds well to how darcs is behaving --- even in complicated situations. A repository is a collection of patches. Patches have no defined order, but patches can have dependencies on other patches. Patches can be added to a repository in any order as long as all patches depended upon are there. Patches can be removed from a repository in any order, as long as no remaining patches depend on them. Repositories can be cloned to create branches. Patches created in different branches may conflict. A conflict is a valid state of a repository. A conflict makes the working tree ambiguous until the conflict is resolved. \subsection{Dependencies} There are two kinds of dependencies: implicit dependencies and explicit dependencies. Implicit dependencies is the far most common kind. These are calculated automatically by darcs. If a patch removes a file or a line of code, it will have to depend on the patch that added that file or line of code.\footnote{% Actually it doesn't have to---in theory---, but in practice it's hard to create ``negative'' files or lines in the working tree. See the chapter about Theory of patches for other constraints.} If a patch adds a line of code, it will usually have to depend on the patch or patches that added the adjacent lines. Explicit dependencies can be created if you give the \verb|--ask-deps| option to \verb|darcs record|. This is good for assuring that logical dependencies hold between patches. It can also be used to group patches---% a patch with explicit dependencies doesn't need to change anything---% and pulling the patch also pulls all patches it was made to depend on. \subsection{Branches: just normal repositories} Darcs does not have branches---it doesn't need to. Every repository can be used as a branch. This means that any two repositories are ``branches'' in darcs, but it is not of much use unless they have a large portion of patches in common. If they are different projects they will have nothing in common, but darcs may still very well be able to merge them, although the result probably is nonsense. Therefore the word ``branch'' isn't a technical term in darcs; it's just the way we think of one repository in relation to another. Branches are \emph{very} useful in darcs. They are in fact \emph{necessary} if you want to do more than only simple work. When you \verb|get| someone's repository from the Internet, you are actually creating a branch of it. It may first seem inefficient (or if you come from CVS---frightening), not to say plain awkward. But darcs is designed this way, and it has means to make it efficient. The answer to many questions about how to do a thing with darcs is: ``use a branch''. It is a simple and elegant solution with great power and flexibility, which contributes to darcs' uncomplicated user interface. You create new branches (i.e., clone repositories) with the \verb|get| and \verb|put| commands. \subsection{Moving patches around---no versions} Patches are global, and a copy of a patch either is or is not present in a branch. This way you can rig a branch almost any way you like, as long as dependencies are fulfilled---% darcs \emph{won't} let you break dependencies. If you suspect a certain feature from some time ago introduced a bug, you can remove the patch/patches that adds the feature, and try without it.\footnote{% darcs even has a special command, {\tt trackdown} that automatically removes patches until a specified test no longer fails.} Patches are added to a repository with \verb|pull| and removed from the repositories with \verb|obliterate|. Don't confuse these two commands with \verb|record| and \verb|unrecord|, which constructs and deconstructs patches. It is important not to lose patches when (re)moving them around. \verb|pull| needs a source repository to copy the patch from, whereas \verb|obliterate| just erases the patch. Beware that if you obliterate \emph{all} copies of a patch it is completely lost---forever. Therefore you should work with branches when you obliterate patches. The \verb|obliterate| command can wisely be disabled in a dedicated main repository by adding \verb|obliterate disable| to the repository's defaults file. For convenience, there is a \verb|push| command. It works like \verb|pull| but in the other direction. It also differs from \verb|pull| in an important way: it starts a second instance of darcs to apply the patch in the target repository, even if it's on the same computer. It can cause surprises if you have a ``wrong'' darcs in your PATH. \subsection{Tags---versions} While \verb|pull| and \verb|obliterate| can be used to construct different ``versions'' in a repository, it is often desirable to name specific configurations of patches so they can be identified and retrieved easily later. This is how darcs implements what is usually known as versions. The command for this is \verb|tag|, and it records a tag in the current repository. A tag is just a patch, but it only contains explicit dependencies. It will depend on all the patches in the current repository.\footnote{% It will omit patches already depended upon by other patches, since they will be indirectly depended upon anyway.} Darcs can recognize if a patch is as a tag; tags are sometimes treated specially by darcs commands. While traditional revision control systems tag versions in the time line history, darcs lets you tag any configuration of patches at any time, and pass the tags around between branches. With the option \verb|--tag| to \verb|get| you can easily get a named version in the repository as a new branch. \subsection{Conflicts} This part of darcs becomes a bit complicated, and the description given here is slightly simplified. Conflicting patches are created when you record changes to the same line in two different repositories. Same line does \emph{not} mean the same line number and file name, but the same line added by a common depended-upon patch. If you are using a darcs-2 repository (Section \ref{initialize}), darcs does \emph{not} consider two patches making the \emph{same} change to be a conflict, much in the same fashion as other version control systems. (The caveat here is two non-identical patches with some identical changes may conflict. For the most part, darcs should just do what you expect). A conflict \emph{happens} when two conflicting patches meet in the same repository. This is no problem for darcs; it can happily pull together just any patches. But it is a problem for the files in \emph{working} (and \emph{pristine}). The conflict can be thought of as two patches telling darcs different things about what a file should look like. Darcs escapes this problem by ignoring those parts\footnote{% The primitive patches making up the total patch.} of the patches that conflict. They are ignored in \emph{both} patches. If patch~A changes the line ``FIXME'' to ``FIXED'', and patch~B changes the same line to ``DONE'', the two patches together will produce the line ``FIXME''. Darcs doesn't care which one you pulled into the repository first, you still get the same result when the conflicting patches meet. All other changes made by A and B are performed as normal. Darcs can mark a conflict for you in \emph{working}. This is done with \verb|mark-conflicts|. Conflicts are marked such that both conflicting changes are inserted with special delimiter lines around them. Then you can merge the two changes by hand, and remove the delimiters. When you pull patches, darcs automatically performs a \verb|mark-conflicts| for you if a conflict happens. You can remove the markup with \verb|revert|, Remember that the result will be the lines from the previous version common to both conflicting patches. The conflict marking can be redone again with \verb|mark-conflicts|. A special case is when a pulled patch conflicts with unrecorded changes in the repository. The conflict will be automatically marked as usual, but since the markup is \emph{also} an unrecorded change, it will get mixed in with your unrecorded changes. There is no guarantee you can revert \emph{only} the markup after this, and \verb|resolve| will not be able to redo this markup later if you remove it. It is good practice to record important changes before pulling. \verb|mark-conflicts| can't mark complicated conflicts. In that case you'll have to use \verb|darcs diff| and other commands to understand what the conflict is all about. If for example two conflicting patches create the same file, \verb|mark-conflicts| will pick just one of them, and no delimiters are inserted. So watch out if darcs tells you about a conflict. \verb|mark-conflicts| can also be used to check for unresolved conflicts. If there are none, darcs replies ``No conflicts to resolve''. While \verb|pull| reports when a conflict happens, \verb|obliterate| and \verb|get| don't. \subsection{Resolving conflicts} A conflict is resolved (not marked, as with the command \verb|mark-conflicts|) as soon as some new patch depends on the conflicting patches. This will usually be the resolve patch you record after manually putting together the pieces from the conflict markup produced by \verb|mark-conflicts| (or \verb|pull|). But it can just as well be a tag. So don't forget to fix conflicts before you accidently ``resolve'' them by recording other patches. If the conflict is with one of your not-yet-published patches, you may choose to amend that patch rather than creating a resolve patch. If you want to back out and wait with the conflict, you can \verb|obliterate| the conflicting patch you just pulled. Before you can do that you have to \verb|revert| the conflict markups that \verb|pull| inserted when the conflict happened. \section{Use a Global Cache} When working with darcs 2 it is recommended to use a global cache, as this is one of the biggest performance enhancing tools of darcs 2. The global cache acts as a giant patch pool where darcs first looks for a patch when grabbing new patches. This saves time by not downloading the same patch twice from a remote server. It also saves space by storing the patch only once, if you ensure your cache and your repositories are on the same hardlink-supporting filesystem. Darcs now enables a global patch cache under your home directory by default. Older darcs 2.x versions required this manual step: \begin{verbatim} $ mkdir -p $HOME/.darcs/cache $ echo cache:$HOME/.darcs/cache > $HOME/.darcs/sources \end{verbatim} In Windows, using \verb|cmd.exe| (Command Prompt under Accessories): \begin{verbatim} > md %UserProfile%\.darcs\cache > echo cache:%UserProfile%\Application Data\darcs\cache > %UserProfile%\Application Data\darcs\sources \end{verbatim} There are some other advanced things you can do in \verb!_darcs/prefs/sources!, such as create per-repository caches, read-only caches and even set a primary source repository above any used in a \verb|darcs get| or \verb|darcs pull| command. \section{Distributed development with one primary developer} \label{darcs-development-practices} This is how darcs itself is developed. There are many contributors to darcs, but every contribution is reviewed and manually applied by myself. For this sort of a situation, \verb|darcs send| is ideal, since the barrier for contributions is very low, which helps encourage contributors. One could simply set the \verb!_darcs/prefs/email! value to the project mailing list, but I also use darcs send to send my changes to the main server, so instead the email address is set to ``\verb!Davids Darcs Repo <droundy@abridgegame.org>!''. My \verb-.procmailrc- file on the server has the following rule: \begin{verbatim} :0 * ^TODavids Darcs Repo |(umask 022; darcs apply --reply darcs-devel@abridgegame.org \ --repodir /path/to/repo --verify /path/to/allowed_keys) \end{verbatim} This causes darcs apply to be run on any email sent to ``Davids Darcs Repo''. \verb'apply' actually applies them only if they are signed by an authorized key. Currently, the only authorized key is mine, but of course this could be extended easily enough. The central darcs repository contains the following values in its \verb!_darcs/prefs/defaults!: \begin{verbatim} apply test apply verbose apply happy-forwarding \end{verbatim} The first line tells apply to always run the test suite. The test suite is in fact the main reason I use send rather than push, since it allows me to easily continue working (or put my computer to sleep) while the tests are being run on the main server. The second line is just there to improve the email response that I get when a patch has either been applied or failed the tests. The third line makes darcs not complain about unsigned patches, but just to forward them to \verb!darcs-devel!. On my development computer, I have in my \verb!.muttrc! the following alias, which allows me to easily apply patches that I get via email directly to my darcs working directory: \begin{verbatim} macro pager A "<pipe-entry>(umask 022; darcs apply --no-test -v \ --repodir ~/darcs)" \end{verbatim} \section{Development by a small group of developers in one office} \label{dft-development-practices} This section describes the development method used for the density functional theory code DFT++, which is available at \verb!http://dft.physics.cornell.edu/dft!. We have a number of workstations which all mount the same \verb!/home! via NFS. We created a special ``dft'' user, with the central repository living in that user's home directory. The ssh public keys of authorized persons are added to the ``dft'' user's \verb!.ssh/allowed_keys!, and we commit patches to this repository using \verb'darcs push'. As in Section~\ref{darcs-development-practices}, we have the central repository set to run the test suite before the push goes through. Note that no one ever runs as the dft user. A subtlety that we ran into showed up in the running of the test suite. Since our test suite includes the running of MPI programs, it must be run in a directory that is mounted across our cluster. To achieve this, we set the \verb!$DARCS_TMPDIR! % following is added to make emacs color right:$ environment variable to \verb!~/tmp!. Note that even though there are only four active developers at the moment, the distributed nature of darcs still plays a large role. Each developer works on a feature until it is stable, a process that often takes quite a few patches, and only once it is stable does he \verb'push' to the central repository. \section{Personal development} It's easy to have several personal development trees using darcs, even when working on a team or with shared code. The number and method of using each personal tree is limited only by such grand limitations as: your disk space, your imagination, available time, etc. For example, if the central darcs repository for your development team is $R_{c}$, you can create a local working directory for feature $f_1$. This local working directory contains a full copy of $R_c$ (as of the time of the ``darcs get'' operation) and can be denoted $R_1$. In the midst of working on feature $f_1$, you realize it requires the development of a separate feature $f_2$. Rather than intermingling $f_1$ and $f_2$ in the same working tree, you can create a new working tree for working on $f_2$, where that working tree contains the repository $R_2$. While working on $f_2$, other developers may have made other changes; these changes can be retrieved on a per-patch selection basis by periodic ``darcs pull'' operations. When your work on $f_2$ is completed, you can publish it for the use of other developers by a ``darcs push'' (or ``darcs send'') from $R_2$ to $R_c$. Independently of the publishing of $f_2$, you can merge your $f_2$ work into your $f_1$ working tree by a ``darcs pull $R_2$'' in the $R_1$ development tree (or ``darcs push'' from $R_2$ to $R_1$). When your work on $f_1$ is completed, you publish it as well by a ``darcs push'' from $R_1$ to $R_c$. Your local feature development efforts for $f_1$ or $f_2$ can each consist of multiple patches. When pushing or pulling to other trees, these patches can either all be selected or specific patches can be selected. Thus, if you introduce a set of debugging calls into the code, you can commit the debugging code in a distictly separate patch (or patches) that you will not push to $R_c$. \subsection{Private patches} As discussed in the section above, a developer may have various changes to their local development repositories that they do not ever wish to publish to a group repository (e.g. personal debugging code), but which they would like to keep in their local repository, and perhaps even share amongst their local repositories. This is easily done via darcs, since those private changes can be committed in patches that are separate from other patches; during the process of pushing patches to the common repository ($R_c$), the developer is queried for which patches should be moved to ($R_c$) on a patch-by-patch basis. The \verb!--complement! flag for the ``darcs pull'' operation can further simplify this effort. If the developer copies (via ``darcs push'' or ``darcs pull'') all private patches into a special repository/working tree ($R_p$), then those patches are easily disregarded for pulling by adding \verb!--complement! to the ``darcs pull'' line and listing $R_p$ after the primary source repository. The \verb!--complement! flag is only available for ``darcs pull'', and not ``darcs push'' or ``darcs send'', requiring the user to have pull access to the target repository. While the actual public repository is often not shared in this manner, it's simple to create a local version of the public repository to act as the staging area for that public repository. The following example extends the two feature addition example in the previous section using a local staging repository ($R_l$) and a private patch repository: \begin{verbatim} $ cd working-dir $ darcs get http://server/repos/Rc Rl $ darcs get Rl R1 $ cd R1 ...development of f1 $ darcs record -m'p1: f1 initial work' ... $ darcs record -m'p2: my debugging tracepoints' ... $ cd .. $ darcs get http://server/repos/Rc R2 $ cd R2 $ darcs pull -p p2 ../R1 ... development of f2 $ darcs record -m'p3: f2 finished' $ cd .. $ darcs get Rl Rp $ cd Rp $ darcs pull -p p2 ../R2 $ cd ../Rl $ darcs pull --complement ../R2 ../Rp $ darcs send ... for publishing f2 patches to Rc $ cd ../R1 $ darcs pull ../R2 ... updates R1 with f2 changes from R2 ... more development of f1 $ darcs record -m'p4: f1 feature finished.' $ cd ../Rl $ darcs pull --complement ../R1 ../Rp $ darcs send \end{verbatim} % Give some user-focused documentation on the formats introduced by Darcs 2 \chapter{Repository formats} \section{Introduction} Darcs 2 introduces a couple of new repository formats and this chapter is intended to serve as brief introduction to them and as an overview of inter-operation between them. \section{Darcs 1 format} Darcs 1 format is the only format supported by 1.0.x versions of darcs. Darcs 2 is capable of entirely interacting with darcs 1 format and still defaults to darcs 1 format, but to take full advantage of new capabilities of darcs 2 it be will necessary to upgrade to the newer formats. \verb'old-fashioned-inventory' is now deprecated and should be avoided if at all possible. \section{Hashed format} Hashed repository format is an intermediate format that interoperates well with darcs 1 repositories. Darcs 2 can push/pull between darcs 1 format and hashed format repositories and can easily convert from one to the other. Among its benefits, one of the most user obvious changes is that the hashed format provides a more robust pristine format, that is less susceptible to corruption from IDEs and automated tools. It also enables the use of a global patch cache (see the Best Practices section for more). Hashed format is recommend for all repositories used with darcs 2 that need to interoperate with darcs 1 branches or darcs 1 developers. To convert an existing darcs 1 repository to hashed format simply \verb|get| a new copy with the hashed flag: \begin{verbatim} $ darcs get --hashed old-repo new-repo \end{verbatim} \verb'hashed' Offers several features while still being compatible with old-fashioned repositories. The specific features are: \begin{itemize} \item The hashed format allows for greater atomicity of operations. This makes for greater safety and simultaneously greater efficiency. These benefits, however, have not been fully realized in this release. For instance, with a hashed repository, there is no need for darcs push to require a repository lock, so you could record patches while waiting for a push to finish (for instance, if it's waiting on the test suite). \item The \verb!_darcs/pristine! directory no longer holds the pristine cache. This disallows certain hackish short-cuts, but also dramatically reduces the danger of third-party programs (e.g. DreamWeaver) recursing into the pristine cache and corrupting darcs repositories. \item Darcs get can optionally operate in a much faster ``lazy'' fashion, meaning that patches are downloaded only when they are needed. This gives us much of the benefits of --partial repositories, without most of their disadvantages. This approach, however, does have several new dangers. First, some operations may unexpectedly require the download of large numbers of patches, which could be slow (but you could always interrupt with \verb!^C!). Secondly, if the source repository disappears, or you lose network connectivity, some operations may fail. \item Darcs now supports caching of patches and file contents to reduce bandwidth and save disk space. It greatly speeds up a number of operations, and is essentially transparent. \end{itemize} \section{Darcs 2 format} Darcs 2 format is the successor to darcs 1 format. It makes use of the various improvements of the hashed repository format, with additional benefits including an increased efficiency and robustness when dealing with conflicting patches. Darcs 2 format is recommended for projects that do not need to interoperate with darcs 1 repositories or developers with versions of darcs less than 2.0.0 installed. Initialize a new repository in darcs 2 format: \begin{verbatim} $ darcs init --darcs-2 \end{verbatim} Projects in darcs 1 format ready to move all development to darcs 2 can convert an existing repository to darcs 2 format. This should be done only once per family tree of related repositories, as converting each branch separately may result in inter-repository corruption that can lead to subtle and hard to diagnose problems when attempting to exchange patches between seperately converted repositories. The recommendation is to convert the branch of a project with the largest superset of patches in the project and then recreate the branches from this superset repository via \verb|darcs get|, particularly with the usage of its selection flags such as \verb|--context|, \verb|--tag| and \verb|--to-match|, and \verb|darcs obliterate|, which can be used to interactively remove patches that are not intended in the recreated branch. The command for conversion: \begin{verbatim} $ darcs convert d1repo d2repo \end{verbatim} \verb'darcs-2' Is the default. It enables all available features, and requiring that all repos for a project use the same format. In addition to the features of the \verb'hashed' format described above, the \verb'darcs-2' format also enables the following: \begin{itemize} \item It should no longer be possible to confuse darcs or freeze it indefinitely by merging conflicting changes. \item Identical primitive changes no longer conflict. This is a long-requested feature, and has far-reaching implications. \end{itemize} \chapter{Darcs commands} % Copyright (C) 2002,2003,2005 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. The general format of a darcs command is \begin{verbatim} % darcs COMMAND OPTIONS ARGUMENTS ... \end{verbatim} Here \verb|COMMAND| is a command such as \verb|add| or \verb|record|, which of course may have one or more arguments. Options have the form \verb!--option! or \verb!-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 \verb!darcs record!, you could type \verb!darcs recor! or \verb!darcs rec!, but not \verb!darcs re! since that could be confused with \verb!darcs replace!, \verb!darcs revert! and \verb!darcs remove!. In some cases, \verb|COMMAND| actually consists of two words, a super-command and a subcommand. For example, the ``display the manifest'' command has the form \verb|darcs query manifest|. \paragraph{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. \begin{center} \footnotetext[1]{But it affects the repository and working directory targeted by the push} \footnotetext[2]{As for the other end, see apply} \begin{tabular}{|c|c|c|} \hline affects & patches & working directory\\ \hline record & yes & no\\ \hline unrecord & yes & no\\ \hline rollback & yes & yes\\ \hline revert & no & yes\\ \hline unrevert & no & yes\\ \hline pull & yes & yes\\ \hline obliterate & yes & yes\\ \hline apply & yes & yes\\ \hline push\footnote{But it affects the repository and working directory targeted by the push} & no & no\\ \hline send\footnote{As for the other end, see apply} & no & no\\ \hline put\footnote{Creates a new repository} & no & no\\ \hline \end{tabular} \end{center} % Copyright (C) 2002-2004 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \section{Common options to darcs commands} \begin{rawhtml} <div class="cmd-opt-hdr"> --help </div> \end{rawhtml} Every \verb|COMMAND| accepts \verb!--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). \begin{verbatim} % darcs COMMAND --help \end{verbatim} \begin{rawhtml} <div class="cmd-opt-hdr"> --disable </div> \end{rawhtml} Every {\tt COMMAND} accepts the \verb!--disable! option, which can be used in \verb!_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. \begin{rawhtml} <div class="cmd-opt-hdr"> --verbose, --quiet, --normal-verbosity </div> \end{rawhtml} Most commands also accept the \verb!--verbose! option, which tells darcs to provide additional output. The amount of verbosity varies from command to command. Commands that accept \verb!--verbose\verb! also accept \verb!--quiet\verb!, which surpresses non-error output, and \verb!--normal-verbosity\verb! which can be used to restore the default verbosity if \verb!--verbose! or \verb!--quiet! is in the defaults file. \begin{rawhtml} <div class="cmd-opt-hdr"> --debug, --debug-http </div> \end{rawhtml} Many commands also accept the \verb!--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 \verb!--debug-http! makes darcs output debugging info for curl and libwww. \begin{rawhtml} <div class="cmd-opt-hdr"> --repodir </div> \end{rawhtml} Another common option is the \verb!--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 \verb'apply' from a mailer. \begin{rawhtml} <div class="cmd-opt-hdr"> --remote-repo </div> \end{rawhtml} Some commands, such as \verb'pull' require a remote repository to be specified, either from the command line or as a default. The \verb!--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). % Copyright (C) 2004-2005 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \paragraph{Selecting patches}\label{selecting} 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: \verb!--patch!, \verb!--match!, \verb!--tag!, and variants on these, which for \verb!--patch! are \verb!--patches!, \verb!--from-patch!, and \verb!--to-patch!. The \verb!--patch! and \verb!--tag! forms simply take (POSIX extended, aka \verb!egrep!) regular expressions and match them against tag and patch names. \verb!--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. % NOTE --no-deps is implemented in SelectChanges.lhs, but documented here % for concistency. When a patch or a group of patches is selected, all patches they depend on get silently selected too. For example: \verb!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 \verb!--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 \verb!unrecord!, \verb!unpull! and \verb!obliterate!, patches that depend on the selected patches are silently included, or if \verb!--no-deps! is used selected patches with dependencies on not selected patches are excluded from the selection. % Copyright (C) 2004 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \paragraph{Match} Currently \verb!--match! accepts six primitive match types, although there are plans to expand it to match more patterns. Also, note that the syntax is still preliminary and subject to change. The first match type accepts a literal string which is checked against the patch name. The syntax is \begin{verbatim} darcs annotate --summary --match 'exact foo+bar' \end{verbatim} 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 \begin{verbatim} darcs annotate --summary --match 'name foo' \end{verbatim} Note that to match regexp metacharacters, such as \verb|(|, 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: ``\verb|"|'':``\verb|\"|'', ``\verb|\|'':``\verb|\\\\|'', ``\verb|\x|'':``\verb|\x|'', ``\verb|(|'':``\verb|\(|''. The third match type matches the darcs hash for each patch: \begin{verbatim} darcs annotate --summary --match \ 'hash 20040403105958-53a90-c719567e92c3b0ab9eddd5290b705712b8b918ef' \end{verbatim} 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 \begin{verbatim} darcs annotate --summary --match 'author foo' \end{verbatim} There is also support for matching by date. This is done using commands such as \begin{verbatim} 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"' \end{verbatim} Notes: when matching on the ISO format, a partial date is treated as a range. English dates can either refer to a specific day (``6 months ago',``day before yesterday''), or to an interval from some past date (``last month'') to the present. Putting this all together, if today is ``2004-07-24'' then the following matches should work: \begin{tabular}{|ll|} \hline \textbf{date} & \textbf{patches selected} \\ \hline 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 \\ \hline today & during 2004-07-24 (starting midnight in your timezone) \\ yesterday & during 2004-07-23 \\ 6 months ago & during 2004-01-23 \\ \hline last 6 months & since 2004-01-23 \\ last month & since 2004-06-23 (not 2004-06-01!) \\ last week & since 2004-07-16 \\ \hline \end{tabular} For more precise control, you may specify an interval, either in a small subset of English or of \htmladdnormallinkfoot{the ISO 8601 format}{http://www.w3.org/TR/NOTE-datetime}. If you use the ISO format, note that durations, when specified alone, are interpreted as being relative to the current date and time. \begin{verbatim} 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"' \end{verbatim} You may also prefer to combine date matching with a more specific pattern. \begin{verbatim} darcs annotate --summary --match 'date "last week" && name foo' \end{verbatim} The sixth match type accepts a regular expression which is checked against file paths that the patch touches. The syntax is \begin{verbatim} darcs annotate --summary --match 'touch foo/bar.c' \end{verbatim} The \verb!--match! pattern can include the logical operators \verb!&&!, \verb!||! and \verb!not!, as well as grouping of patterns with parentheses. For example \begin{verbatim} darcs annotate --summary --match 'name record && not name overrode' \end{verbatim} \begin{rawhtml} <div class="cmd-opt-hdr"> --ignore-times </div> \end{rawhtml} Darcs optimizes its operations by keeping track of the modification times of your files. This dramatically speeds up commands such as \verb!whatsnew! and \verb!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 \verb!--ignore-times! option, which instructs darcs not to trust the file modification times, but instead to check each file's contents explicitly. \begin{rawhtml} <div class="cmd-opt-hdr"> --author </div> \end{rawhtml} \label{env:DARCS_EMAIL} Several commands need to be able to identify you. Conventionally, you provide an email address for this purpose, which can include comments, e.g.\ \verb!David Roundy <droundy@abridgegame.org>!. The easiest way to do this is to define an environment variable \verb!EMAIL! or \verb!DARCS_EMAIL! (with the latter overriding the former). You can also override this using the \verb!--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~\ref{repository_format}. Or, you could specify the author on a per-repository basis using the \verb!_darcs/prefs/author! file as described in section~\ref{author_prefs}. Also, a global author file can be created in your home directory with the name \verb!.darcs/author!. This file overrides the contents of the environment variables, but a repository-specific author file overrides the global author file. \begin{rawhtml} <div class="cmd-opt-hdr"> --dont-compress, --compress </div> \end{rawhtml} By default, darcs commands that write patches to disk will compress the patch files. If you don't want this, you can choose the \verb!--dont-compress! option, which causes darcs not to compress the patch file. \begin{rawhtml} <div class="cmd-opt-hdr"> --dry-run </div> \end{rawhtml} The \verb!--dry-run! option will cause darcs not to actually take the specified action, but only print what would have happened. Not all commands accept \verb!--dry-run!, but those that do should accept the \verb!--summary! option. \begin{rawhtml} <div class="cmd-opt-hdr"> --summary, --no-summary </div> \end{rawhtml} The \verb!--summary! option shows a summary of the patches that would have been pulled/pushed/whatever. The format is similar to the output format of \verb!cvs update! and looks like this: \begin{verbatim} 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 \end{verbatim} You can probably guess what the flags mean from the clever file names. \begin{description} \item{\texttt{A}} is for files that have been added but not recorded yet. \item{\texttt{a}} is for files found using the \verb!--look-for-adds! option available for \verb!whatsnew! and \verb!record!. They have not been added yet, but would be added automatically if \verb!--look-for-adds! were used with the next \verb!record! command. \item{\texttt{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. \item{\texttt{R}} is for files that have been removed, but the removal is not recorded yet. \end{description} An exclamation mark appears next to any option that has a conflict. % Copyright (C) 2003,2005 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \paragraph{Resolution of conflicts}\label{resolution} To resolve conflicts using an external tool, you need to specify a command to use, e.g. \begin{verbatim} --external-merge 'opendiff %1 %2 -ancestor %a -merge %o' \end{verbatim} The \verb!%1! and \verb!%2! are replaced with the two versions to be merged, \verb!%a! is replaced with the common ancestor of the two versions. Most importantly, \verb!%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 \begin{verbatim} --external-merge 'xxdiff -m -O -M %o %1 %a %2' \end{verbatim} To use \verb!kdiff3!, you can use \begin{verbatim} --external-merge 'kdiff3 --output %o %a %1 %2' \end{verbatim} To use \verb!tortoiseMerge!, you can use \begin{verbatim} --external-merge 'tortoiseMerge /base:"%a" /mine:"%1" /theirs:"%2" /merged:"%o"' \end{verbatim} (\verb!tortoiseMerge! is a nice merge tool that comes with TortoiseSVN and works well on Windows.) % Fixme: Is it actually a shell command on MS Windows? Note that the command is split into space-separated words and the first one is \verb!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 \verb!PATH!. The substitution of the \verb!%! escapes is done everywhere. If you need to prevent substitution you can use a double percentage sign, i.e. \verb!%%a! is substituted with \verb!%a!. Here is an example script to use the Emacs' Ediff package for merging. % This is indented so that the leading #s don't confuse the preprocessor. \begin{verbatim} #! /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 \end{verbatim} It would be invoked like: \begin{verbatim} --external-merge 'emerge3 %1 %2 %a %o' \end{verbatim} 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 (\verb!_darcs/prefs/defaults! or \verb!~/.darcs/prefs!, see \ref{defaults}) a line such as \begin{verbatim} ALL external-merge kdiff3 --output %o %a %1 %2 \end{verbatim} or \begin{verbatim} ALL external-merge tortoiseMerge /base:"%a" /mine:"%1" /theirs:"%2" /merged:"%o" \end{verbatim} Note that the defaults file does not want quotes around the command. \begin{rawhtml} <div class="cmd-opt-hdr"> --sendmail-command </div> \end{rawhtml} \label{env:SENDMAIL} Several commands send email. The user can determine which mta to use with the \verb!--sendmail-command! switch. For repetitive usage of a specific sendmail command it is also possible to set the environment variable \verb!SENDMAIL!. If there is no command line switch given \verb!SENDMAIL! will be used if present. \begin{rawhtml} <div class="cmd-opt-hdr"> --posthook=COMMAND, --no-posthook </div> \end{rawhtml} To provide a command that should be run whenever a darcs command completes successfully, use \verb!--posthook! to specify the command. This is useful for people who want to have a command run whenever a patch is applied. Using \verb!--no-posthook! will disable running the command. \begin{rawhtml} <div class="cmd-opt-hdr"> --run-posthook, --prompt-posthook </div> \end{rawhtml} These options control prompting before running the posthook. Use \verb!--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. \verb!DARCS_PATCHES! contains a human-readable summary of the patches being acted upon. The format is the same as "darcs changes". \verb!DARCS_PATCHES_XML! Contains the same details, in the same XML format as "darcs changes". Finally, \verb!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 \emph{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 \verb!E2BIG! errors. \begin{rawhtml} <div class="cmd-opt-hdr"> --prehook=COMMAND, --no-prehook </div> \end{rawhtml} To provide a command that should be run before a darcs command is executed, use \verb!--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 \verb!--no-prehook! will disable running the command. \begin{rawhtml} <div class="cmd-opt-hdr"> --run-prehook, --prompt-prehook </div> \end{rawhtml} These options control prompting before running the prehook. See the posthook documentation above for details. \begin{rawhtml} <div class="cmd-opt-hdr"> --ssh-cm, --no-ssh-cm </div> \end{rawhtml} 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. \begin{rawhtml} <div class="cmd-opt-hdr"> --http-pipelining, --no-http-pipelining </div> \end{rawhtml} When compiled with libwww or curl (version 7.18.0 and above), darcs can use HTTP pipelining. It is enabled by default for libwww and curl (version 7.19.1 and above). This option will make darcs enable or disable HTTP pipelining, overwriting default. Note that if HTTP pipelining is really used depends on the server. \begin{rawhtml} <div class="cmd-opt-hdr"> --no-cache </div> \end{rawhtml} Do not use patch caches. \begin{rawhtml} <div class="cmd-opt-hdr"> --umask </div> \end{rawhtml} By default, Darcs will use your current umask. The option \verb|--umask| will cause Darcs to switch to a different umask before writing to the repository. \begin{rawhtml} <div class="cmd-opt-hdr"> --allow-unrelated-repos </div> \end{rawhtml} By default darcs checks and warns user if repositories are unrelated when doing pull, push and send. This option makes darcs skip this check. \section{Options apart from darcs commands} \begin{rawhtml} <div class="cmd-opt-hdr"> --help, --overview </div> \end{rawhtml} Calling darcs with just \verb|--help| as an argument gives a brief summary of what commands are available. The \verb|--overview| option gives a more technical summary of what the commands actually \emph{do}. \begin{rawhtml} <div class="cmd-opt-hdr"> --version, --exact-version </div> \end{rawhtml} Calling darcs with the flag \verb|--version| tells you the version of darcs you are using. Calling darcs with the flag \verb|--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. \begin{rawhtml} <div class="cmd-opt-hdr"> --commands </div> \end{rawhtml} Similarly calling darcs with only \verb|--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. \section{Getting help} % Copyright (C) 2002-2004 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs help} \label{help} \verb!Usage: darcs help [OPTION]... [<DARCS_COMMAND> [DARCS_SUBCOMMAND]] ! Options: \begin{tabular}{lll} &\verb!--match! &\begin{minipage}{7cm} \raggedright shows a summary of how to use patch matching rules\end{minipage} \\ \end{tabular} Display help about darcs and darcs commands. Without arguments, `darcs help' prints a categorized list of darcs commands and a short description of each one. With an extra argument, `darcs help foo' prints detailed help about the darcs command foo. \section{Creating repositories} % Copyright (C) 2002-2003 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs initialize}\label{initialize} \verb!Usage: darcs initialize [OPTION]... ! Options: \begin{tabular}{lll} &\verb!--hashed! &\begin{minipage}{7cm} \raggedright Some new features. Compatible with older repos\end{minipage} \\ &\verb!--darcs-2! &\begin{minipage}{7cm} \raggedright All features. Related repos must use same format [DEFAULT]\end{minipage} \\ &\verb!--old-fashioned-inventory! &\begin{minipage}{7cm} \raggedright Minimal features. What older repos use.\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} Initialize a new source tree as a darcs repository. Call \verb|initialize| once for each project you work on. Run it from the top level directory of the project, with the project files already there. \verb|initialize| will set up all the directories and files darcs needs in order to start keeping track of revisions for your project. \verb|initialize| creates a single directory named \verb|_darcs|, with contents for internal use. The one subdictory of interest to users is \verb'_darcs/prefs', which will include an empty file \verb'_darcs/prefs/motd' (see Section~\ref{motd}), as well as files named \verb'boring' and \verb'binaries', which contain useful defaults as described in Sections \ref{boring} \emph{et seq.} \begin{rawhtml} <div class="cmd-opt-hdr"> --old-fashioned-inventory --hashed --darcs-2 </div> \end{rawhtml} These options force a particular repository format to be used. % Copyright (C) 2002-2005 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs get} \verb!Usage: darcs get [OPTION]... <REPOSITORY> [<DIRECTORY>]! Options: \begin{tabular}{lll} &\verb!--repo-name DIRECTORY!,\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright path of output directory\end{minipage} \\ &\verb!--partial! &\begin{minipage}{7cm} \raggedright get partial repository using checkpoint (old-fashioned format only)\end{minipage} \\ &\verb!--lazy! &\begin{minipage}{7cm} \raggedright get patch files only as needed\end{minipage} \\ &\verb!--ephemeral! &\begin{minipage}{7cm} \raggedright don't save patch files in the repository\end{minipage} \\ &\verb!--complete! &\begin{minipage}{7cm} \raggedright get a complete copy of the repository\end{minipage} \\ &\verb!--to-match PATTERN! &\begin{minipage}{7cm} \raggedright select changes up to a patch matching PATTERN\end{minipage} \\ &\verb!--to-patch REGEXP! &\begin{minipage}{7cm} \raggedright select changes up to a patch matching REGEXP\end{minipage} \\ \verb!-t! &\verb!--tag REGEXP! &\begin{minipage}{7cm} \raggedright select tag matching REGEXP\end{minipage} \\ &\verb!--context FILENAME! &\begin{minipage}{7cm} \raggedright version specified by the context in FILENAME\end{minipage} \\ &\verb!--set-default! &\begin{minipage}{7cm} \raggedright set default repository [DEFAULT]\end{minipage} \\ &\verb!--no-set-default! &\begin{minipage}{7cm} \raggedright don't set default repository\end{minipage} \\ &\verb!--set-scripts-executable! &\begin{minipage}{7cm} \raggedright make scripts executable\end{minipage} \\ &\verb!--dont-set-scripts-executable! &\begin{minipage}{7cm} \raggedright don't make scripts executable\end{minipage} \\ &\verb!--nolinks! &\begin{minipage}{7cm} \raggedright do not link repository or pristine to sibling\end{minipage} \\ &\verb!--hashed! &\begin{minipage}{7cm} \raggedright Convert darcs-1 format to hashed format\end{minipage} \\ &\verb!--old-fashioned-inventory! &\begin{minipage}{7cm} \raggedright Convert from hashed to darcs-1 format\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--ssh-cm! &\begin{minipage}{7cm} \raggedright use SSH ControlMaster feature\end{minipage} \\ &\verb!--no-ssh-cm! &\begin{minipage}{7cm} \raggedright don't use SSH ControlMaster feature [DEFAULT]\end{minipage} \\ &\verb!--http-pipelining! &\begin{minipage}{7cm} \raggedright enable HTTP pipelining\end{minipage} \\ &\verb!--no-http-pipelining! &\begin{minipage}{7cm} \raggedright disable HTTP pipelining [DEFAULT]\end{minipage} \\ &\verb!--no-cache! &\begin{minipage}{7cm} \raggedright don't use patch caches\end{minipage} \\ \end{tabular} If the remote repository and the current directory are in the same filesystem and that filesystem supports hard links, get will create hard links for the patch files, which means that the additional storage space needed will be minimal. This is \emph{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 \verb!darcs get! to get yourself one copy, and then running \verb!darcs get! on that copy to make any more you like. The only catch is that the first time you run \verb!darcs push! or \verb!darcs pull! from any of these second copies, by default they will access your first copy---which may not be what you want. You may specify the name of the repository created by providing a second argument to get, which is a directory name. \begin{rawhtml} <div class="cmd-opt-hdr"> --context, --tag, --to-patch, --to-match </div> \end{rawhtml} If you want to get a specific version of a repository, you have a few options. You can either use the \verb!--tag!, \verb!--to-patch! or \verb!--to-match! options, or you can use the \verb!--context=FILENAME! option, which specifies a file containing a context generated with \verb!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 \verb!--to-patch! or \verb!--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. \begin{rawhtml} <div class="cmd-opt-hdr"> --partial </div> \end{rawhtml} Only get the patches since the last checkpoint. This will save time, bandwidth and disk space, at the expense of losing the history before the checkpoint. \subsection{darcs put} \verb!Usage: darcs put [OPTION]... <NEW REPOSITORY>! Options: \begin{tabular}{lll} &\verb!--to-match PATTERN! &\begin{minipage}{7cm} \raggedright select changes up to a patch matching PATTERN\end{minipage} \\ &\verb!--to-patch REGEXP! &\begin{minipage}{7cm} \raggedright select changes up to a patch matching REGEXP\end{minipage} \\ \verb!-t! &\verb!--tag REGEXP! &\begin{minipage}{7cm} \raggedright select tag matching REGEXP\end{minipage} \\ &\verb!--context FILENAME! &\begin{minipage}{7cm} \raggedright version specified by the context in FILENAME\end{minipage} \\ &\verb!--set-scripts-executable! &\begin{minipage}{7cm} \raggedright make scripts executable\end{minipage} \\ &\verb!--dont-set-scripts-executable! &\begin{minipage}{7cm} \raggedright don't make scripts executable\end{minipage} \\ &\verb!--hashed! &\begin{minipage}{7cm} \raggedright Convert darcs-1 format to hashed format\end{minipage} \\ &\verb!--old-fashioned-inventory! &\begin{minipage}{7cm} \raggedright Convert from hashed to darcs-1 format\end{minipage} \\ &\verb!--set-default! &\begin{minipage}{7cm} \raggedright set default repository [DEFAULT]\end{minipage} \\ &\verb!--no-set-default! &\begin{minipage}{7cm} \raggedright don't set default repository\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--apply-as USERNAME! &\begin{minipage}{7cm} \raggedright apply patch as another user using sudo\end{minipage} \\ &\verb!--apply-as-myself! &\begin{minipage}{7cm} \raggedright don't use sudo to apply as another user [DEFAULT]\end{minipage} \\ &\verb!--ssh-cm! &\begin{minipage}{7cm} \raggedright use SSH ControlMaster feature\end{minipage} \\ &\verb!--no-ssh-cm! &\begin{minipage}{7cm} \raggedright don't use SSH ControlMaster feature [DEFAULT]\end{minipage} \\ &\verb!--http-pipelining! &\begin{minipage}{7cm} \raggedright enable HTTP pipelining\end{minipage} \\ &\verb!--no-http-pipelining! &\begin{minipage}{7cm} \raggedright disable HTTP pipelining [DEFAULT]\end{minipage} \\ &\verb!--no-cache! &\begin{minipage}{7cm} \raggedright don't use patch caches\end{minipage} \\ \end{tabular} 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. \section{Modifying the contents of a repository} % Copyright (C) 2002-2004 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs add} \verb!Usage: darcs add [OPTION]... <FILE or DIRECTORY> ...! Options: \begin{tabular}{lll} &\verb!--boring! &\begin{minipage}{7cm} \raggedright don't skip boring files\end{minipage} \\ &\verb!--case-ok! &\begin{minipage}{7cm} \raggedright don't refuse to add files differing only in case\end{minipage} \\ &\verb!--reserved-ok! &\begin{minipage}{7cm} \raggedright don't refuse to add files with Windows-reserved names\end{minipage} \\ \verb!-r! &\verb!--recursive! &\begin{minipage}{7cm} \raggedright add contents of subdirectories\end{minipage} \\ &\verb!--not-recursive! &\begin{minipage}{7cm} \raggedright don't add contents of subdirectories\end{minipage} \\ &\verb!--date-trick! &\begin{minipage}{7cm} \raggedright add files with date appended to avoid conflict [EXPERIMENTAL] \end{minipage} \\ &\verb!--no-date-trick! &\begin{minipage}{7cm} \raggedright don't use experimental date appending trick [DEFAULT]\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ &\verb!--dry-run! &\begin{minipage}{7cm} \raggedright don't actually take the action\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--umask UMASK! &\begin{minipage}{7cm} \raggedright specify umask to use when writing\end{minipage} \\ \end{tabular} 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. % Copyright (C) 2002-2004 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs remove} \verb!Usage: darcs remove [OPTION]... <FILE or DIRECTORY> ...! Options: \begin{tabular}{lll} &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--umask UMASK! &\begin{minipage}{7cm} \raggedright specify umask to use when writing\end{minipage} \\ \end{tabular} Remove should be called when you want to remove a file from your project, but don't actually want to delete the file. Otherwise just delete the file or directory, and darcs will notice that it has been removed. Be aware that the file WILL be deleted from any other copy of the repository to which you later apply the patch. % rm - Note: not a subsection because not to be documented. % unadd - Note: not a subsection because not to be documented. % Copyright (C) 2002-2003 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs mv} \verb!Usage: darcs mv [OPTION]... [FILE or DIRECTORY]...! Options: \begin{tabular}{lll} &\verb!--case-ok! &\begin{minipage}{7cm} \raggedright don't refuse to add files differing only in case\end{minipage} \\ &\verb!--reserved-ok! &\begin{minipage}{7cm} \raggedright don't refuse to add files with Windows-reserved names\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--umask UMASK! &\begin{minipage}{7cm} \raggedright specify umask to use when writing\end{minipage} \\ \end{tabular} Darcs mv needs to be called whenever you want to move files or directories. Unlike remove, mv actually performs the move itself in your working copy. This is why ``mv'' isn't called ``move'', since it is really almost equivalent to the unix command ``mv''. \begin{rawhtml} <div class="cmd-opt-hdr"> --case-ok </div> \end{rawhtml} Darcs mv will by default refuse to rename a file if there already exists a file having the same name apart from case. This is because doing so could create a repository that could not be used on file systems that are case insensitive (such as Apple's HFS+). You can override this by with the flag \verb!--case-ok!. % move - Note: not a subsection because not to be documented. % Copyright (C) 2002-2005 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs replace} \verb!Usage: darcs replace [OPTION]... <OLD> <NEW> <FILE> ...! Options: \begin{tabular}{lll} &\verb!--token-chars "[CHARS]"! &\begin{minipage}{7cm} \raggedright define token to contain these characters\end{minipage} \\ \verb!-f! &\verb!--force! &\begin{minipage}{7cm} \raggedright proceed with replace even if 'new' token already exists\end{minipage} \\ &\verb!--no-force! &\begin{minipage}{7cm} \raggedright don't force the replace if it looks scary\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--ignore-times! &\begin{minipage}{7cm} \raggedright don't trust the file modification times\end{minipage} \\ &\verb!--umask UMASK! &\begin{minipage}{7cm} \raggedright specify umask to use when writing\end{minipage} \\ \end{tabular} Replace allows you to change a specified token wherever it occurs in the specified files. The replace is encoded in a special patch and will merge as expected with other patches. Tokens here are defined by a regexp specifying the characters which are allowed. By default a token corresponds to a C identifier. The default regexp is \verb![A-Za-z_0-9]!), and if one of your tokens contains a `\verb|-|' or `\verb|.|', you will then (by default) get the ``filename'' regexp, which is \verb![A-Za-z_0-9\-\.]!. \begin{rawhtml} <div class="cmd-opt-hdr"> --token-chars </div> \end{rawhtml} 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 \verb!--token-chars! option. You may prefer to define tokens in terms of delimiting characters instead of allowed characters using a flag such as \verb!--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 \verb!_darcs/prefs/defaults! to always specify the same \verb!--token-chars!, since your replace patches will be better behaved (in terms of commutation and merges) if they have tokens defined in the same way. When using darcs replace, the ``new'' token may not already appear in the file---if that is the case, the replace change would not be invertible. This limitation holds only on the already-recorded version of the file. There is a potentially confusing difference, however, when a replace is used to make another replace possible: \begin{verbatim} % darcs replace newtoken aaack ./foo.c % darcs replace oldtoken newtoken ./foo.c % darcs record \end{verbatim} will be valid, even if \verb!newtoken! and \verb!oldtoken! are both present in the recorded version of foo.c, while the sequence \begin{verbatim} % [manually edit foo.c replacing newtoken with aaack] % darcs replace oldtoken newtoken ./foo.c \end{verbatim} will fail because ``newtoken'' still exists in the recorded version of \verb!foo.c!. The reason for the difference is that when recording, a ``replace'' patch always is recorded \emph{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. \section{Working with changes} % Copyright (C) 2002-2003 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs record} \label{record} \verb!Usage: darcs record [OPTION]... [FILE or DIRECTORY]...! Options: \begin{tabular}{lll} \verb!-m! &\verb!--patch-name PATCHNAME! &\begin{minipage}{7cm} \raggedright name of patch\end{minipage} \\ \verb!-A! &\verb!--author EMAIL! &\begin{minipage}{7cm} \raggedright specify author id\end{minipage} \\ &\verb!--no-test! &\begin{minipage}{7cm} \raggedright don't run the test script\end{minipage} \\ &\verb!--test! &\begin{minipage}{7cm} \raggedright run the test script\end{minipage} \\ &\verb!--leave-test-directory! &\begin{minipage}{7cm} \raggedright don't remove the test directory\end{minipage} \\ &\verb!--remove-test-directory! &\begin{minipage}{7cm} \raggedright remove the test directory\end{minipage} \\ \verb!-a! &\verb!--all! &\begin{minipage}{7cm} \raggedright answer yes to all patches\end{minipage} \\ &\verb!--pipe! &\begin{minipage}{7cm} \raggedright ask user interactively for the patch metadata\end{minipage} \\ \verb!-i! &\verb!--interactive! &\begin{minipage}{7cm} \raggedright prompt user interactively\end{minipage} \\ &\verb!--ask-deps! &\begin{minipage}{7cm} \raggedright ask for extra dependencies\end{minipage} \\ &\verb!--no-ask-deps! &\begin{minipage}{7cm} \raggedright don't ask for extra dependencies\end{minipage} \\ &\verb!--edit-long-comment! &\begin{minipage}{7cm} \raggedright edit the long comment by default\end{minipage} \\ &\verb!--skip-long-comment! &\begin{minipage}{7cm} \raggedright don't give a long comment\end{minipage} \\ &\verb!--prompt-long-comment! &\begin{minipage}{7cm} \raggedright prompt for whether to edit the long comment\end{minipage} \\ \verb!-l! &\verb!--look-for-adds! &\begin{minipage}{7cm} \raggedright look for (non-boring) files that could be added\end{minipage} \\ &\verb!--dont-look-for-adds! &\begin{minipage}{7cm} \raggedright don't look for any files that could be added [DEFAULT]\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--logfile FILE! &\begin{minipage}{7cm} \raggedright give patch name and comment in file\end{minipage} \\ &\verb!--delete-logfile! &\begin{minipage}{7cm} \raggedright delete the logfile when done\end{minipage} \\ &\verb!--compress! &\begin{minipage}{7cm} \raggedright create compressed patches\end{minipage} \\ &\verb!--dont-compress! &\begin{minipage}{7cm} \raggedright don't create compressed patches\end{minipage} \\ &\verb!--ignore-times! &\begin{minipage}{7cm} \raggedright don't trust the file modification times\end{minipage} \\ &\verb!--umask UMASK! &\begin{minipage}{7cm} \raggedright specify umask to use when writing\end{minipage} \\ &\verb!--set-scripts-executable! &\begin{minipage}{7cm} \raggedright make scripts executable\end{minipage} \\ &\verb!--dont-set-scripts-executable! &\begin{minipage}{7cm} \raggedright don't make scripts executable\end{minipage} \\ \end{tabular} 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 \verb!DARCS_EMAIL! environment variable, and if that doesn't exist, from the \verb!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. \label{DARCS_EDITOR} 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 \verb!$DARCS_EDITOR!, \verb!$VISUAL! or \verb!$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. \begin{rawhtml} <div class="cmd-opt-hdr"> --logfile </div> \end{rawhtml} If you wish, you may specify the patch name and log using the \verb!--logfile! flag. If you do so, the first line of the specified file will be taken to be the patch name, and the remainder will be the ``long comment''. This feature can be especially handy if you have a test that fails several times on the record (thus aborting the record), so you don't have to type in the long comment multiple times. The file's contents will override the \verb!--patch-name! option. \begin{rawhtml} <div class="cmd-opt-hdr"> --ask-deps </div> \end{rawhtml} 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 \verb!--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 \verb!darcs tag! command will record a patch with no actual changes but which depends on the entire current inventory of the repository. The \verb!darcs record --ask-deps! with no selected changes will record a patch that depends on only those patches selected via the \verb!--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. \begin{rawhtml} <div class="cmd-opt-hdr"> --no-test, --test </div> \end{rawhtml} If you configure darcs to run a test suite, darcs will run this test on the recorded repository to make sure it is valid. Darcs first creates a pristine copy of the source tree (in a temporary directory), then it runs the test, using its return value to decide if the record is valid. If it is not valid, the record will be aborted. This is a handy way to avoid making stupid mistakes like forgetting to `darcs add' a new file. It also can be tediously slow, so there is an option (\verb!--no-test!) to skip the test. \begin{rawhtml} <div class="cmd-opt-hdr"> --set-scripts-executable </div> \end{rawhtml} If you pass \verb!--set-scripts-executable! to \verb!darcs record!, darcs will set scripts executable in the test directory before running the test. \begin{rawhtml} <div class="cmd-opt-hdr"> --pipe </div> \end{rawhtml} If you run record with the \verb!--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 \verb!--pipe! prompts look like: \begin{verbatim} 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 \end{verbatim} \begin{rawhtml} <div class="cmd-opt-hdr"> --interactive </div> \end{rawhtml} By default, \verb!record! works interactively. Probably the only thing you need to know about using this is that you can press \verb!?! 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: \begin{verbatim} 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) \end{verbatim} What you can't see in that ``screenshot'' is that \verb!darcs! will also try to use color in your terminal to make the output even easier to read. % Copyright (C) 2002-2005 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs pull} \verb!Usage: darcs pull [OPTION]... [REPOSITORY]...! Options: \begin{tabular}{lll} &\verb!--matches PATTERN! &\begin{minipage}{7cm} \raggedright select patches matching PATTERN\end{minipage} \\ \verb!-p! &\verb!--patches REGEXP! &\begin{minipage}{7cm} \raggedright select patches matching REGEXP\end{minipage} \\ \verb!-t! &\verb!--tags REGEXP! &\begin{minipage}{7cm} \raggedright select tags matching REGEXP\end{minipage} \\ \verb!-a! &\verb!--all! &\begin{minipage}{7cm} \raggedright answer yes to all patches\end{minipage} \\ \verb!-i! &\verb!--interactive! &\begin{minipage}{7cm} \raggedright prompt user interactively\end{minipage} \\ &\verb!--mark-conflicts! &\begin{minipage}{7cm} \raggedright mark conflicts [DEFAULT]\end{minipage} \\ &\verb!--allow-conflicts! &\begin{minipage}{7cm} \raggedright allow conflicts, but don't mark them\end{minipage} \\ &\verb!--dont-allow-conflicts! &\begin{minipage}{7cm} \raggedright fail on patches that create conflicts\end{minipage} \\ &\verb!--external-merge COMMAND! &\begin{minipage}{7cm} \raggedright use external tool to merge conflicts\end{minipage} \\ &\verb!--test! &\begin{minipage}{7cm} \raggedright run the test script\end{minipage} \\ &\verb!--no-test! &\begin{minipage}{7cm} \raggedright don't run the test script\end{minipage} \\ &\verb!--dry-run! &\begin{minipage}{7cm} \raggedright don't actually take the action\end{minipage} \\ &\verb!--xml-output! &\begin{minipage}{7cm} \raggedright generate XML formatted output\end{minipage} \\ \verb!-s! &\verb!--summary! &\begin{minipage}{7cm} \raggedright summarize changes\end{minipage} \\ &\verb!--no-summary! &\begin{minipage}{7cm} \raggedright don't summarize changes\end{minipage} \\ &\verb!--no-deps! &\begin{minipage}{7cm} \raggedright don't automatically fulfill dependencies\end{minipage} \\ &\verb!--dont-prompt-for-dependencies! &\begin{minipage}{7cm} \raggedright don't ask about patches that are depended on by matched patches (with --match or --patch)\end{minipage} \\ &\verb!--prompt-for-dependencies! &\begin{minipage}{7cm} \raggedright prompt about patches that are depended on by matched patches [DEFAULT]\end{minipage} \\ &\verb!--set-default! &\begin{minipage}{7cm} \raggedright set default repository [DEFAULT]\end{minipage} \\ &\verb!--no-set-default! &\begin{minipage}{7cm} \raggedright don't set default repository\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ &\verb!--ignore-unrelated-repos! &\begin{minipage}{7cm} \raggedright do not check if repositories are unrelated\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--intersection! &\begin{minipage}{7cm} \raggedright take intersection of all repositories\end{minipage} \\ &\verb!--union! &\begin{minipage}{7cm} \raggedright take union of all repositories [DEFAULT]\end{minipage} \\ &\verb!--complement! &\begin{minipage}{7cm} \raggedright take complement of repositories (in order listed)\end{minipage} \\ &\verb!--compress! &\begin{minipage}{7cm} \raggedright create compressed patches\end{minipage} \\ &\verb!--dont-compress! &\begin{minipage}{7cm} \raggedright don't create compressed patches\end{minipage} \\ &\verb!--nolinks! &\begin{minipage}{7cm} \raggedright do not link repository or pristine to sibling\end{minipage} \\ &\verb!--ignore-times! &\begin{minipage}{7cm} \raggedright don't trust the file modification times\end{minipage} \\ &\verb!--remote-repo URL! &\begin{minipage}{7cm} \raggedright specify the remote repository URL to work with\end{minipage} \\ &\verb!--set-scripts-executable! &\begin{minipage}{7cm} \raggedright make scripts executable\end{minipage} \\ &\verb!--dont-set-scripts-executable! &\begin{minipage}{7cm} \raggedright don't make scripts executable\end{minipage} \\ &\verb!--umask UMASK! &\begin{minipage}{7cm} \raggedright specify umask to use when writing\end{minipage} \\ &\verb!--ssh-cm! &\begin{minipage}{7cm} \raggedright use SSH ControlMaster feature\end{minipage} \\ &\verb!--no-ssh-cm! &\begin{minipage}{7cm} \raggedright don't use SSH ControlMaster feature [DEFAULT]\end{minipage} \\ &\verb!--http-pipelining! &\begin{minipage}{7cm} \raggedright enable HTTP pipelining\end{minipage} \\ &\verb!--no-http-pipelining! &\begin{minipage}{7cm} \raggedright disable HTTP pipelining [DEFAULT]\end{minipage} \\ &\verb!--no-cache! &\begin{minipage}{7cm} \raggedright don't use patch caches\end{minipage} \\ \end{tabular} 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. \begin{rawhtml} <div class="cmd-opt-hdr"> --intersection, --union [DEFAULT], --complement </div> \end{rawhtml} If you provide more than one repository as an argument to pull, darcs' behavior is determined by the presence of the \verb!--complement!, \verb!--intersection!, and \verb!--union! flags. \begin{itemize} \item The default (\verb!--union!) behavior is to pull any patches that are in any of the specified repositories ($ R_1 \bigcup R_2 \bigcup R_3 \ldots$). \item If you instead specify the \verb!--intersection! flag, darcs will only pull those patches which are present in all source repositories ($ R_1 \bigcap R_2 \bigcap R_3 \ldots$). \item If you specify the \verb!--complement! flag, darcs will only pull elements in the first repository that do not exist in any of the remaining repositories\footnote{The first thing darcs will do is remove duplicates, keeping only the first specification. This is noticeable for the complement operation, since mathematically $ S \backslash S \rightarrow \emptyset $, one would expect that ``\texttt{darcs pull --complement repo1 repo1}'' would result in no pulls, but the duplicate elimination removes the second \texttt{repo1}, reducing the above to effectively ``\texttt{darcs pull repo1}''. The expected functionality could be seen via ``\texttt{darcs get -a repo1 repo2; darcs pull --complement repo1 repo2}'', but there are easier ways of doing nothing!} ($ R_1 \backslash (R_2 \bigcup R_3 \bigcup \ldots$)). \end{itemize} \begin{rawhtml} <div class="cmd-opt-hdr"> --external-merge </div> \end{rawhtml} You can use an external interactive merge tool to resolve conflicts with the flag \verb!--external-merge!. For more details see subsection~\ref{resolution}. \begin{rawhtml} <div class="cmd-opt-hdr"> --matches, --patches, --tags, --no-deps </div> \end{rawhtml} The \verb!--patches!, \verb!--matches!, \verb!--tags!, and \verb!--no-deps! options can be used to select which patches to pull, as described in subsection~\ref{selecting}. \begin{rawhtml} <div class="cmd-opt-hdr"> --no-test, --test </div> \end{rawhtml} If you specify the \verb!--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. \begin{rawhtml} <div class="cmd-opt-hdr"> --verbose </div> \end{rawhtml} Adding the \verb!--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: \begin{verbatim} darcs pull --dry-run --verbose \end{verbatim} % Copyright (C) 2002-2004 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs push} \verb!Usage: darcs push [OPTION]... [REPOSITORY]! Options: \begin{tabular}{lll} &\verb!--matches PATTERN! &\begin{minipage}{7cm} \raggedright select patches matching PATTERN\end{minipage} \\ \verb!-p! &\verb!--patches REGEXP! &\begin{minipage}{7cm} \raggedright select patches matching REGEXP\end{minipage} \\ \verb!-t! &\verb!--tags REGEXP! &\begin{minipage}{7cm} \raggedright select tags matching REGEXP\end{minipage} \\ &\verb!--no-deps! &\begin{minipage}{7cm} \raggedright don't automatically fulfill dependencies\end{minipage} \\ &\verb!--dont-prompt-for-dependencies! &\begin{minipage}{7cm} \raggedright don't ask about patches that are depended on by matched patches (with --match or --patch)\end{minipage} \\ &\verb!--prompt-for-dependencies! &\begin{minipage}{7cm} \raggedright prompt about patches that are depended on by matched patches [DEFAULT]\end{minipage} \\ \verb!-a! &\verb!--all! &\begin{minipage}{7cm} \raggedright answer yes to all patches\end{minipage} \\ \verb!-i! &\verb!--interactive! &\begin{minipage}{7cm} \raggedright prompt user interactively\end{minipage} \\ &\verb!--sign! &\begin{minipage}{7cm} \raggedright sign the patch with your gpg key\end{minipage} \\ &\verb!--sign-as KEYID! &\begin{minipage}{7cm} \raggedright sign the patch with a given keyid\end{minipage} \\ &\verb!--sign-ssl IDFILE! &\begin{minipage}{7cm} \raggedright sign the patch using openssl with a given private key\end{minipage} \\ &\verb!--dont-sign! &\begin{minipage}{7cm} \raggedright don't sign the patch\end{minipage} \\ &\verb!--dry-run! &\begin{minipage}{7cm} \raggedright don't actually take the action\end{minipage} \\ &\verb!--xml-output! &\begin{minipage}{7cm} \raggedright generate XML formatted output\end{minipage} \\ \verb!-s! &\verb!--summary! &\begin{minipage}{7cm} \raggedright summarize changes\end{minipage} \\ &\verb!--no-summary! &\begin{minipage}{7cm} \raggedright don't summarize changes\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ &\verb!--set-default! &\begin{minipage}{7cm} \raggedright set default repository [DEFAULT]\end{minipage} \\ &\verb!--no-set-default! &\begin{minipage}{7cm} \raggedright don't set default repository\end{minipage} \\ &\verb!--ignore-unrelated-repos! &\begin{minipage}{7cm} \raggedright do not check if repositories are unrelated\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--apply-as USERNAME! &\begin{minipage}{7cm} \raggedright apply patch as another user using sudo\end{minipage} \\ &\verb!--apply-as-myself! &\begin{minipage}{7cm} \raggedright don't use sudo to apply as another user [DEFAULT]\end{minipage} \\ &\verb!--nolinks! &\begin{minipage}{7cm} \raggedright do not link repository or pristine to sibling\end{minipage} \\ &\verb!--remote-repo URL! &\begin{minipage}{7cm} \raggedright specify the remote repository URL to work with\end{minipage} \\ &\verb!--ssh-cm! &\begin{minipage}{7cm} \raggedright use SSH ControlMaster feature\end{minipage} \\ &\verb!--no-ssh-cm! &\begin{minipage}{7cm} \raggedright don't use SSH ControlMaster feature [DEFAULT]\end{minipage} \\ &\verb!--http-pipelining! &\begin{minipage}{7cm} \raggedright enable HTTP pipelining\end{minipage} \\ &\verb!--no-http-pipelining! &\begin{minipage}{7cm} \raggedright disable HTTP pipelining [DEFAULT]\end{minipage} \\ &\verb!--no-cache! &\begin{minipage}{7cm} \raggedright don't use patch caches\end{minipage} \\ \end{tabular} Push is the opposite of pull. Push allows you to copy changes from the current repository into another repository. For obvious reasons, you can only push to repositories to which you have write access. In addition, you can only push to repos that you access either on the local file system or with ssh. In order to apply with ssh, darcs must also be installed on the remote computer. The command invoked to run ssh may be configured by the \verb!DARCS_SSH! environment variable (see subsection~\ref{env:DARCS_SSH}). The command invoked via ssh is always \verb!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 \emph{apply} in the \emph{target} repository (such as, for example, \verb!--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 \begin{verbatim} bash: darcs: command not found \end{verbatim} then this means that the darcs on the remote machine could not be started. Make sure that the darcs executable is called \verb!darcs! and is found in the default path. The default path can be different in interactive and in non-interactive shells. Say \begin{verbatim} ssh login@remote.machine darcs \end{verbatim} to try whether the remote darcs can be found, or \begin{verbatim} ssh login@remote.machine 'echo $PATH' \end{verbatim} (note the single quotes) to check the default path. \begin{rawhtml} <div class="cmd-opt-hdr"> --apply-as </div> \end{rawhtml} If you give the \verb!--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. \begin{rawhtml} <div class="cmd-opt-hdr"> --matches, --patches, --tags, --no-deps </div> \end{rawhtml} The \verb!--patches!, \verb!--matches!, \verb!--tags!, and \verb!--no-deps! options can be used to select which patches to push, as described in subsection~\ref{selecting}. When there are conflicts, the behavior of push is determined by the default flags to \verb!apply! in the \emph{target} repository. Most commonly, for pushed-to repositories, you'd like to have \verb!--dont-allow-conflicts! as a default option to apply (by default, it is already the default\ldots). 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 \verb!--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 \verb!--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. % Copyright (C) 2002-2004 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs send} \verb!Usage: darcs send [OPTION]... [REPOSITORY]! Options: \begin{tabular}{lll} &\verb!--matches PATTERN! &\begin{minipage}{7cm} \raggedright select patches matching PATTERN\end{minipage} \\ \verb!-p! &\verb!--patches REGEXP! &\begin{minipage}{7cm} \raggedright select patches matching REGEXP\end{minipage} \\ \verb!-t! &\verb!--tags REGEXP! &\begin{minipage}{7cm} \raggedright select tags matching REGEXP\end{minipage} \\ &\verb!--no-deps! &\begin{minipage}{7cm} \raggedright don't automatically fulfill dependencies\end{minipage} \\ &\verb!--dont-prompt-for-dependencies! &\begin{minipage}{7cm} \raggedright don't ask about patches that are depended on by matched patches (with --match or --patch)\end{minipage} \\ &\verb!--prompt-for-dependencies! &\begin{minipage}{7cm} \raggedright prompt about patches that are depended on by matched patches [DEFAULT]\end{minipage} \\ \verb!-a! &\verb!--all! &\begin{minipage}{7cm} \raggedright answer yes to all patches\end{minipage} \\ \verb!-i! &\verb!--interactive! &\begin{minipage}{7cm} \raggedright prompt user interactively\end{minipage} \\ &\verb!--from EMAIL! &\begin{minipage}{7cm} \raggedright specify email address\end{minipage} \\ \verb!-A! &\verb!--author EMAIL! &\begin{minipage}{7cm} \raggedright specify author id\end{minipage} \\ &\verb!--to EMAIL! &\begin{minipage}{7cm} \raggedright specify destination email\end{minipage} \\ &\verb!--cc EMAIL! &\begin{minipage}{7cm} \raggedright mail results to additional EMAIL(s). Requires --reply\end{minipage} \\ &\verb!--subject SUBJECT! &\begin{minipage}{7cm} \raggedright specify mail subject\end{minipage} \\ &\verb!--in-reply-to EMAIL! &\begin{minipage}{7cm} \raggedright specify in-reply-to header\end{minipage} \\ \verb!-o! &\verb!--output FILE! &\begin{minipage}{7cm} \raggedright specify output filename\end{minipage} \\ \verb!-O! &\verb!--output-auto-name[=DIRECTORY]! &\begin{minipage}{7cm} \raggedright output to automatically named file in DIRECTORY, default: current directory\end{minipage} \\ &\verb!--sign! &\begin{minipage}{7cm} \raggedright sign the patch with your gpg key\end{minipage} \\ &\verb!--sign-as KEYID! &\begin{minipage}{7cm} \raggedright sign the patch with a given keyid\end{minipage} \\ &\verb!--sign-ssl IDFILE! &\begin{minipage}{7cm} \raggedright sign the patch using openssl with a given private key\end{minipage} \\ &\verb!--dont-sign! &\begin{minipage}{7cm} \raggedright don't sign the patch\end{minipage} \\ &\verb!--dry-run! &\begin{minipage}{7cm} \raggedright don't actually take the action\end{minipage} \\ &\verb!--xml-output! &\begin{minipage}{7cm} \raggedright generate XML formatted output\end{minipage} \\ \verb!-s! &\verb!--summary! &\begin{minipage}{7cm} \raggedright summarize changes\end{minipage} \\ &\verb!--no-summary! &\begin{minipage}{7cm} \raggedright don't summarize changes\end{minipage} \\ &\verb!--edit-description! &\begin{minipage}{7cm} \raggedright edit the patch bundle description\end{minipage} \\ &\verb!--dont-edit-description! &\begin{minipage}{7cm} \raggedright don't edit the patch bundle description\end{minipage} \\ &\verb!--set-default! &\begin{minipage}{7cm} \raggedright set default repository [DEFAULT]\end{minipage} \\ &\verb!--no-set-default! &\begin{minipage}{7cm} \raggedright don't set default repository\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ &\verb!--sendmail-command COMMAND! &\begin{minipage}{7cm} \raggedright specify sendmail command\end{minipage} \\ &\verb!--ignore-unrelated-repos! &\begin{minipage}{7cm} \raggedright do not check if repositories are unrelated\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--logfile FILE! &\begin{minipage}{7cm} \raggedright give patch name and comment in file\end{minipage} \\ &\verb!--delete-logfile! &\begin{minipage}{7cm} \raggedright delete the logfile when done\end{minipage} \\ &\verb!--remote-repo URL! &\begin{minipage}{7cm} \raggedright specify the remote repository URL to work with\end{minipage} \\ &\verb!--context FILENAME! &\begin{minipage}{7cm} \raggedright send to context stored in FILENAME\end{minipage} \\ &\verb!--ssh-cm! &\begin{minipage}{7cm} \raggedright use SSH ControlMaster feature\end{minipage} \\ &\verb!--no-ssh-cm! &\begin{minipage}{7cm} \raggedright don't use SSH ControlMaster feature [DEFAULT]\end{minipage} \\ &\verb!--http-pipelining! &\begin{minipage}{7cm} \raggedright enable HTTP pipelining\end{minipage} \\ &\verb!--no-http-pipelining! &\begin{minipage}{7cm} \raggedright disable HTTP pipelining [DEFAULT]\end{minipage} \\ &\verb!--no-cache! &\begin{minipage}{7cm} \raggedright don't use patch caches\end{minipage} \\ \end{tabular} Send is used to prepare a bundle of patches that can be applied to a target repository. Send accepts the URL of the repository as an argument. When called without an argument, send will use the most recent repository that was either pushed to, pulled from or sent to. By default, the patch bundle is sent by email, although you may save it to a file. Do not confuse the \verb!--author! options with the return address that \verb!darcs send! will set for your patch bundle. For example, if you have two email addresses A and B: \begin{description} \item If you use \verb!--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. \item If you use \verb!--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. \item If you supply neither \verb!--from! nor \verb!--author!, then the return address will be B. \end{description} In addition, unless you specify the sendmail command with \verb!--sendmail-command!, darcs sends email using the default email command on your computer. This default command is determined by the \verb!configure! script. Thus, on some non-Unix-like OSes, \verb!--from! is likely to not work at all. \begin{rawhtml} <div class="cmd-opt-hdr"> --output, --to, --cc </div> \end{rawhtml} The \verb!--output!, \verb!--output-auto-name!, and \verb!--to! flags determine what darcs does with the patch bundle after creating it. If you provide an \verb!--output! argument, the patch bundle is saved to that file. If you specify \verb!--output-auto-name!, the patch bundle is saved to a file with an automatically generated name. If you give one or more \verb!--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 \verb!_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 \verb!--cc! option to specify additional recipients without overriding the default repository email address. If \texttt{\_darcs/prefs/post} exists in the target repository, darcs will upload to the URL contained in that file, which may either be a \texttt{mailto:} URL, or an \texttt{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. \begin{rawhtml} <div class="cmd-opt-hdr"> --subject </div> \end{rawhtml} Use the \verb!--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. \begin{rawhtml} <div class="cmd-opt-hdr"> --in-reply-to </div> \end{rawhtml} Use the \verb!--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. \begin{rawhtml} <div class="cmd-opt-hdr"> --matches, --patches, --tags, --no-deps </div> \end{rawhtml} The \verb!--patches!, \verb!--matches!, \verb!--tags!, and \verb!--no-deps! options can be used to select which patches to send, as described in subsection~\ref{selecting}. \begin{rawhtml} <div class="cmd-opt-hdr"> --edit-description </div> \end{rawhtml} If you want to include a description or explanation along with the bundle of patches, you need to specify the \verb!--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. \begin{rawhtml} <div class="cmd-opt-hdr"> --sendmail-command </div> \end{rawhtml} If you want to use a command different from the default one for sending email, you need to specify a command line with the \verb!--sendmail-command! option. The command line can contain some format specifiers which are replaced by the actual values. Accepted format specifiers are \verb!%s! for subject, \verb!%t! for to, \verb!%c! for cc, \verb!%b! for the body of the mail, \verb!%f! for from, \verb!%a! for the patch bundle and the same specifiers in uppercase for the URL-encoded values. Additionally you can add \verb!%<! 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: \begin{verbatim} evolution "mailto:%T?subject=%S&attach=%A&cc=%C&body=%B" msmtp -t %< \end{verbatim} % Copyright (C) 2003-2005 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs apply} \verb!Usage: darcs apply [OPTION]... <PATCHFILE>! Options: \begin{tabular}{lll} &\verb!--verify PUBRING! &\begin{minipage}{7cm} \raggedright verify that the patch was signed by a key in PUBRING\end{minipage} \\ &\verb!--verify-ssl KEYS! &\begin{minipage}{7cm} \raggedright verify using openSSL with authorized keys from file KEYS\end{minipage} \\ &\verb!--no-verify! &\begin{minipage}{7cm} \raggedright don't verify patch signature\end{minipage} \\ \verb!-a! &\verb!--all! &\begin{minipage}{7cm} \raggedright answer yes to all patches\end{minipage} \\ \verb!-i! &\verb!--interactive! &\begin{minipage}{7cm} \raggedright prompt user interactively\end{minipage} \\ &\verb!--dry-run! &\begin{minipage}{7cm} \raggedright don't actually take the action\end{minipage} \\ &\verb!--xml-output! &\begin{minipage}{7cm} \raggedright generate XML formatted output\end{minipage} \\ &\verb!--mark-conflicts! &\begin{minipage}{7cm} \raggedright mark conflicts\end{minipage} \\ &\verb!--allow-conflicts! &\begin{minipage}{7cm} \raggedright allow conflicts, but don't mark them\end{minipage} \\ &\verb!--no-resolve-conflicts! &\begin{minipage}{7cm} \raggedright equivalent to --dont-allow-conflicts, for backwards compatibility\end{minipage} \\ &\verb!--dont-allow-conflicts! &\begin{minipage}{7cm} \raggedright fail on patches that create conflicts [DEFAULT]\end{minipage} \\ &\verb!--external-merge COMMAND! &\begin{minipage}{7cm} \raggedright use external tool to merge conflicts\end{minipage} \\ &\verb!--no-test! &\begin{minipage}{7cm} \raggedright don't run the test script\end{minipage} \\ &\verb!--test! &\begin{minipage}{7cm} \raggedright run the test script\end{minipage} \\ &\verb!--leave-test-directory! &\begin{minipage}{7cm} \raggedright don't remove the test directory\end{minipage} \\ &\verb!--remove-test-directory! &\begin{minipage}{7cm} \raggedright remove the test directory\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--reply FROM! &\begin{minipage}{7cm} \raggedright reply to email-based patch using FROM address\end{minipage} \\ &\verb!--cc EMAIL! &\begin{minipage}{7cm} \raggedright mail results to additional EMAIL(s). Requires --reply\end{minipage} \\ &\verb!--happy-forwarding! &\begin{minipage}{7cm} \raggedright forward unsigned messages without extra header\end{minipage} \\ &\verb!--sendmail-command COMMAND! &\begin{minipage}{7cm} \raggedright specify sendmail command\end{minipage} \\ &\verb!--ignore-times! &\begin{minipage}{7cm} \raggedright don't trust the file modification times\end{minipage} \\ &\verb!--compress! &\begin{minipage}{7cm} \raggedright create compressed patches\end{minipage} \\ &\verb!--dont-compress! &\begin{minipage}{7cm} \raggedright don't create compressed patches\end{minipage} \\ &\verb!--set-scripts-executable! &\begin{minipage}{7cm} \raggedright make scripts executable\end{minipage} \\ &\verb!--dont-set-scripts-executable! &\begin{minipage}{7cm} \raggedright don't make scripts executable\end{minipage} \\ &\verb!--umask UMASK! &\begin{minipage}{7cm} \raggedright specify umask to use when writing\end{minipage} \\ \end{tabular} Apply is used to apply a bundle of patches to this repository. Such a bundle may be created using send. Darcs apply accepts a single argument, which is the name of the patch file to be applied. If you omit this argument, the patch is read from standard input. Darcs also interprets an argument of `\-' to mean it should read the file from standard input. This allows you to use apply with a pipe from your email program, for example. \begin{rawhtml} <div class="cmd-opt-hdr"> --verify </div> \end{rawhtml} If you specify the \verb!--verify PUBRING! option, darcs will check that the patch was GPG-signed by a key which is in \verb!PUBRING! and will refuse to apply the patch otherwise. \begin{rawhtml} <div class="cmd-opt-hdr"> --cc, --reply </div> \end{rawhtml} If you give the \verb!--reply FROM! option to \verb!darcs apply!, it will send the results of the application to the sender of the patch. This only works if the patch is in the form of email with its headers intact, so that darcs can actually know the origin of the patch. The reply email will indicate whether or not the patch was successfully applied. The \verb!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 \verb!--cc! option to specify additional recipients. Note that the \verb!--cc! option \emph{requires} the \verb!--reply! option, which provides the ``From'' address. The \verb!--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 \verb!.muttrc! (the config file for my mailer) I have: \begin{verbatim} macro pager A "<pipe-entry>darcs apply --verbose \ --reply droundy@abridgegame.org --repodir ~/darcs \end{verbatim} which allows me to apply a patch to darcs directly from my mailer, with the originator of that patch being sent a confirmation when the patch is successfully applied. NOTE: In an attempt to make sure no one else can read your email, mutt seems to set the umask such that patches created with the above macro are not world-readable, so use it with care. When used in combination with the \verb!--verify! option, the \verb!--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 \verb!FROM! address of the \verb!--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 \verb!--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 \verb!darcs apply --verify PUBRING --reply! to create a pushable repository by applying patches automatically as they are received by email, you will also want to use the \verb!--dont-allow-conflicts! option. \begin{rawhtml} <div class="cmd-opt-hdr"> --dont-allow-conflicts </div> \end{rawhtml} The \verb!--dont-allow-conflicts! flag causes apply to fail when applying a patch would cause conflicts. This flag is recommended on repositories which will be pushed to or sent to. \begin{rawhtml} <div class="cmd-opt-hdr"> --allow-conflicts </div> \end{rawhtml} \verb!--allow-conflicts! will allow conflicts, but will keep the local and recorded versions in sync on the repository. This means the conflict will exist in both locations until it is resolved. \begin{rawhtml} <div class="cmd-opt-hdr"> --mark-conflicts </div> \end{rawhtml} \verb!--mark-conflicts! will add conflict markers to illustrate the the conflict. \begin{rawhtml} <div class="cmd-opt-hdr"> --external-merge </div> \end{rawhtml} You can use an external interactive merge tool to resolve conflicts with the flag \verb!--external-merge!. For more details see subsection~\ref{resolution}. \begin{rawhtml} <div class="cmd-opt-hdr"> --all, --interactive </div> \end{rawhtml} If you provide the \verb!--interactive! flag, darcs will ask you for each change in the patch bundle whether or not you wish to apply that change. The opposite is the \verb!--all! flag, which can be used to override an \verb!interactive! which might be set in your ``defaults'' file. \begin{rawhtml} <div class="cmd-opt-hdr"> --sendmail-command </div> \end{rawhtml} If you want to use a command different from the default one for sending mail, you need to specify a command line with the \verb!--sendmail-command! option. The command line can contain the format specifier \verb!%t! for to and you can add \verb!%<! 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: \begin{verbatim} msmtp -t %< \end{verbatim} \begin{rawhtml} <div class="cmd-opt-hdr"> --no-test, --test </div> \end{rawhtml} If you specify the \verb!--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 \verb!--reply! option was used, the results of the test are sent in the reply email. You can also specify the \verb!--no-test! option, which will override the \verb!--test! option, and prevent the test from being run. This is helpful when setting up a pushable repository, to keep users from running code. \section{Seeing what you've done} % Copyright (C) 2002-2004 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs whatsnew} \label{whatsnew} \verb!Usage: darcs whatsnew [OPTION]... [FILE or DIRECTORY]...! Options: \begin{tabular}{lll} \verb!-s! &\verb!--summary! &\begin{minipage}{7cm} \raggedright summarize changes\end{minipage} \\ &\verb!--no-summary! &\begin{minipage}{7cm} \raggedright don't summarize changes\end{minipage} \\ \verb!-u! &\verb!--unified! &\begin{minipage}{7cm} \raggedright output patch in a darcs-specific format similar to diff -u\end{minipage} \\ \verb!-l! &\verb!--look-for-adds! &\begin{minipage}{7cm} \raggedright look for (non-boring) files that could be added\end{minipage} \\ &\verb!--dont-look-for-adds! &\begin{minipage}{7cm} \raggedright don't look for any files that could be added [DEFAULT]\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--ignore-times! &\begin{minipage}{7cm} \raggedright don't trust the file modification times\end{minipage} \\ &\verb!--boring! &\begin{minipage}{7cm} \raggedright don't skip boring files\end{minipage} \\ \end{tabular} List unrecorded changes in the working tree. % Copyright (C) 2003-2004 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs changes} \verb!Usage: darcs changes [OPTION]... [FILE or DIRECTORY]...! Options: \begin{tabular}{lll} &\verb!--to-match PATTERN! &\begin{minipage}{7cm} \raggedright select changes up to a patch matching PATTERN\end{minipage} \\ &\verb!--to-patch REGEXP! &\begin{minipage}{7cm} \raggedright select changes up to a patch matching REGEXP\end{minipage} \\ &\verb!--to-tag REGEXP! &\begin{minipage}{7cm} \raggedright select changes up to a tag matching REGEXP\end{minipage} \\ &\verb!--from-match PATTERN! &\begin{minipage}{7cm} \raggedright select changes starting with a patch matching PATTERN\end{minipage} \\ &\verb!--from-patch REGEXP! &\begin{minipage}{7cm} \raggedright select changes starting with a patch matching REGEXP\end{minipage} \\ &\verb!--from-tag REGEXP! &\begin{minipage}{7cm} \raggedright select changes starting with a tag matching REGEXP\end{minipage} \\ &\verb!--last NUMBER! &\begin{minipage}{7cm} \raggedright select the last NUMBER patches\end{minipage} \\ \verb!-n! &\verb!--index N-M! &\begin{minipage}{7cm} \raggedright select a range of patches\end{minipage} \\ &\verb!--matches PATTERN! &\begin{minipage}{7cm} \raggedright select patches matching PATTERN\end{minipage} \\ \verb!-p! &\verb!--patches REGEXP! &\begin{minipage}{7cm} \raggedright select patches matching REGEXP\end{minipage} \\ \verb!-t! &\verb!--tags REGEXP! &\begin{minipage}{7cm} \raggedright select tags matching REGEXP\end{minipage} \\ &\verb!--only-to-files! &\begin{minipage}{7cm} \raggedright show only changes to specified files\end{minipage} \\ &\verb!--context! &\begin{minipage}{7cm} \raggedright give output suitable for get --context\end{minipage} \\ &\verb!--xml-output! &\begin{minipage}{7cm} \raggedright generate XML formatted output\end{minipage} \\ &\verb!--human-readable! &\begin{minipage}{7cm} \raggedright give human-readable output\end{minipage} \\ &\verb!--number! &\begin{minipage}{7cm} \raggedright number the changes\end{minipage} \\ &\verb!--count! &\begin{minipage}{7cm} \raggedright output count of changes\end{minipage} \\ \verb!-s! &\verb!--summary! &\begin{minipage}{7cm} \raggedright summarize changes\end{minipage} \\ &\verb!--no-summary! &\begin{minipage}{7cm} \raggedright don't summarize changes\end{minipage} \\ &\verb!--reverse! &\begin{minipage}{7cm} \raggedright show changes in reverse order\end{minipage} \\ &\verb!--repo URL! &\begin{minipage}{7cm} \raggedright specify the repository URL\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \verb!-a! &\verb!--all! &\begin{minipage}{7cm} \raggedright answer yes to all patches\end{minipage} \\ \verb!-i! &\verb!--interactive! &\begin{minipage}{7cm} \raggedright prompt user interactively\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--ssh-cm! &\begin{minipage}{7cm} \raggedright use SSH ControlMaster feature\end{minipage} \\ &\verb!--no-ssh-cm! &\begin{minipage}{7cm} \raggedright don't use SSH ControlMaster feature [DEFAULT]\end{minipage} \\ &\verb!--http-pipelining! &\begin{minipage}{7cm} \raggedright enable HTTP pipelining\end{minipage} \\ &\verb!--no-http-pipelining! &\begin{minipage}{7cm} \raggedright disable HTTP pipelining [DEFAULT]\end{minipage} \\ &\verb!--no-cache! &\begin{minipage}{7cm} \raggedright don't use patch caches\end{minipage} \\ \end{tabular} Changes gives a changelog-style summary of the repository history, including options for altering how the patches are selected and displayed. When given one or more files or directories as an argument, changes lists only those patches which affect those files or the contents of those directories or, of course, the directories themselves. This includes changes that happened to files before they were moved or renamed. \begin{rawhtml} <div class="cmd-opt-hdr"> --from-match, --from-patch, --from-tag </div> \end{rawhtml} If changes is given a \verb!--from-patch!, \verb!--from-match!, or \verb!--from-tag! option, it outputs only those changes since that tag or patch. Without any options to limit the scope of the changes, history will be displayed going back as far as possible. \begin{rawhtml} <div class="cmd-opt-hdr"> --context, --human-readable, --xml-output </div> \end{rawhtml} When given the \verb!--context! flag, darcs changes outputs sufficient information to allow the current state of the repository to be recreated at a later date. This information should generally be piped to a file, and then can be used later in conjunction with \verb!darcs get --context! to recreate the current version. Note that while the \verb!--context! flag may be used in conjunction with \verb!--xml-output! or \verb!--human-readable!, in neither case will darcs get be able to read the output. On the other hand, sufficient information \emph{will} be output for a knowledgeable human to recreate the current state of the repository. % Copyright (C) 2002-2004 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs show} The show command provides access to several subcommands which can be used to investigate the state of a repository. % Copyright (C) 2008 Eric Kow % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsubsection{darcs show authors} \verb!Usage: darcs show authors [OPTION]... ! Options: \begin{tabular}{lll} &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} The authors command writes a list of all patch authors in the repository to standard output. % Copyright (C) 2007 Eric Kow % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsubsection{darcs show contents} \verb!Usage: darcs show contents [OPTION]... [FILE]...! Options: \begin{tabular}{lll} &\verb!--match PATTERN! &\begin{minipage}{7cm} \raggedright select a single patch matching PATTERN\end{minipage} \\ \verb!-p! &\verb!--patch REGEXP! &\begin{minipage}{7cm} \raggedright select a single patch matching REGEXP\end{minipage} \\ \verb!-t! &\verb!--tag REGEXP! &\begin{minipage}{7cm} \raggedright select tag matching REGEXP\end{minipage} \\ \verb!-n! &\verb!--index N-M! &\begin{minipage}{7cm} \raggedright select a range of patches\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} 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). % Copyright (C) 2005 Florian Weimer % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsubsection{darcs show files} \label{show-files} \verb!Usage: darcs show files [OPTION]... ! Options: \begin{tabular}{lll} &\verb!--files! &\begin{minipage}{7cm} \raggedright include files in output [DEFAULT]\end{minipage} \\ &\verb!--no-files! &\begin{minipage}{7cm} \raggedright don't include files in output\end{minipage} \\ &\verb!--directories! &\begin{minipage}{7cm} \raggedright include directories in output [DEFAULT]\end{minipage} \\ &\verb!--no-directories! &\begin{minipage}{7cm} \raggedright don't include directories in output\end{minipage} \\ &\verb!--pending! &\begin{minipage}{7cm} \raggedright reflect pending patches in output [DEFAULT]\end{minipage} \\ &\verb!--no-pending! &\begin{minipage}{7cm} \raggedright only included recorded patches in output\end{minipage} \\ \verb!-0! &\verb!--null! &\begin{minipage}{7cm} \raggedright separate file names by NUL characters\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} The files command lists the version-controlled files in the working copy. The similar manifest command, lists the same files, excluding any directories. By default (and if the \verb!--pending! option is specified), the effect of pending patches on the repository is taken into account. In other words, if you add a file using {\tt darcs add}, it immediately appears in the output of {\tt query manifest}, even if it is not yet recorded. If you specify the \verb!--no-pending! option, {\tt query manifest} will only list recorded files (and directories). The \verb!--files! and \verb!--directories! options control whether files and directories are included in the output. The \verb!--no-files! and \verb!--no-directories! options have the reverse effect. The default is to include files, but not directories. If you specify the \verb!--null! option, the file names are written to standard output in unescaped form, and separated by ASCII NUL bytes. This format is suitable for further automatic processing (for example, using \verb!xargs -0!). % Copyright (C) 2007 Florian Weimer % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsubsection{darcs show tags} \verb!Usage: darcs show tags [OPTION]... ! Options: \begin{tabular}{lll} &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} 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. % Copyright (C) 2007 Kevin Quick % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsubsection{darcs show repo} %%\label{show-repo} \verb!Usage: darcs show repo [OPTION]... ! Options: \begin{tabular}{lll} &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ &\verb!--files! &\begin{minipage}{7cm} \raggedright include files in output [DEFAULT]\end{minipage} \\ &\verb!--no-files! &\begin{minipage}{7cm} \raggedright don't include files in output\end{minipage} \\ &\verb!--xml-output! &\begin{minipage}{7cm} \raggedright generate XML formatted output\end{minipage} \\ \end{tabular} The \verb!show repo! displays information about the current repository: the location, the type, etc. This is provided as informational output for two purposes: curious users and scripts invoking darcs. For the latter, this information can be parsed to facilitate the script; for example, \verb!darcs show repo | grep Root: | awk {print $2}! can be used to locate the top-level \verb!_darcs! directory from anyplace within a darcs repository working directory. \begin{rawhtml} <div class="cmd-opt-hdr"> --files, --no-files </div> \end{rawhtml} If the \verb!--files! option is specified (the default), then the \verb!show repo! operation will read patch information from the repository and display the number of patches in the repository. The \verb!--no-files! option can be used to suppress this operation (and improve performance). \begin{rawhtml} <div class="cmd-opt-hdr"> --human-readable, --xml-output </div> \end{rawhtml} By default, the \verb!show repo! displays output in human readable form, but the \verb!--xml-output! option can be used to obtain XML-formatted to facilitate regular parsing by external tools. \section{More advanced commands} % Copyright (C) 2003-2004 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs tag} Name the current repository state for future reference. \verb!Usage: darcs tag [OPTION]... [TAGNAME]! Options: \begin{tabular}{lll} \verb!-m! &\verb!--patch-name PATCHNAME! &\begin{minipage}{7cm} \raggedright name of patch\end{minipage} \\ \verb!-A! &\verb!--author EMAIL! &\begin{minipage}{7cm} \raggedright specify author id\end{minipage} \\ &\verb!--checkpoint! &\begin{minipage}{7cm} \raggedright create a checkpoint file (see get --partial)\end{minipage} \\ &\verb!--pipe! &\begin{minipage}{7cm} \raggedright ask user interactively for the patch metadata\end{minipage} \\ \verb!-i! &\verb!--interactive! &\begin{minipage}{7cm} \raggedright prompt user interactively\end{minipage} \\ &\verb!--edit-long-comment! &\begin{minipage}{7cm} \raggedright edit the long comment by default\end{minipage} \\ &\verb!--skip-long-comment! &\begin{minipage}{7cm} \raggedright don't give a long comment\end{minipage} \\ &\verb!--prompt-long-comment! &\begin{minipage}{7cm} \raggedright prompt for whether to edit the long comment\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--compress! &\begin{minipage}{7cm} \raggedright create compressed patches\end{minipage} \\ &\verb!--dont-compress! &\begin{minipage}{7cm} \raggedright don't create compressed patches\end{minipage} \\ &\verb!--umask UMASK! &\begin{minipage}{7cm} \raggedright specify umask to use when writing\end{minipage} \\ \end{tabular} The `darcs tag' command names the current repository state, so that it can easily be referred to later. Every `important' state should be tagged; in particular it is good practice to tag each stable release with a number or codename. Advice on release numbering can be found at http://producingoss.com/en/development-cycle.html. To reproduce the state of a repository `R' as at tag `t', use the command `darcs get --tag t R'. The command `darcs show tags' lists all tags in the current repository. Tagging also provides significant performance benefits: when Darcs reaches a shared tag that depends on all antecedent patches, it can simply stop processing. Like normal patches, a tag has a name, an author, a timestamp and an optional long description, but it does not change the working tree. A tag can have any name, but it is generally best to pick a naming scheme and stick to it. The `darcs tag' command accepts the --pipe and --checkpoint options, which behave as described in `darcs record' and `darcs optimize' respectively. % Copyright (C) 2003 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs setpref} % Copyright (C) 2002-2005 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs check} \verb!Usage: darcs check [OPTION]... ! Options: \begin{tabular}{lll} &\verb!--complete! &\begin{minipage}{7cm} \raggedright get a complete copy of the repository\end{minipage} \\ &\verb!--partial! &\begin{minipage}{7cm} \raggedright get partial repository using checkpoint (old-fashioned format only)\end{minipage} \\ &\verb!--no-test! &\begin{minipage}{7cm} \raggedright don't run the test script\end{minipage} \\ &\verb!--test! &\begin{minipage}{7cm} \raggedright run the test script\end{minipage} \\ &\verb!--leave-test-directory! &\begin{minipage}{7cm} \raggedright don't remove the test directory\end{minipage} \\ &\verb!--remove-test-directory! &\begin{minipage}{7cm} \raggedright remove the test directory\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} Check the repository for consistency. %% FIXME: this should go in "common options" or something, since %% commands like record and amend-record also run the test command. % Copyright (C) 2002-2005 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. 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. \begin{verbatim} % darcs setpref test "sh configure && make && make test" \end{verbatim} Or, if you want to define a test specific to one copy of the repository, you could do this by editing the file \verb!_darcs/prefs/prefs!. \begin{rawhtml} <div class="cmd-opt-hdr"> --leave-test-directory, --remove-test-directory </div> \end{rawhtml} 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 \verb!--leave-test-directory! flag. Alas, there is no way to make darcs leave the test directory only if the test fails. The opposite of \verb!--leave-test-directory! is \verb!--remove-test-directory!, which could come in handy if you choose to make \verb!--leave-test-directory! the default (see section~\ref{defaults}). % Copyright (C) 2003-2005 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs optimize} \verb!Usage: darcs optimize [OPTION]... ! Options: \begin{tabular}{lll} &\verb!--checkpoint! &\begin{minipage}{7cm} \raggedright create a checkpoint file (see get --partial)\end{minipage} \\ \verb!-t! &\verb!--tag TAGNAME! &\begin{minipage}{7cm} \raggedright name of version to checkpoint\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ &\verb!--reorder-patches! &\begin{minipage}{7cm} \raggedright reorder the patches in the repository\end{minipage} \\ &\verb!--sibling URL! &\begin{minipage}{7cm} \raggedright specify a sibling directory\end{minipage} \\ &\verb!--relink! &\begin{minipage}{7cm} \raggedright relink random internal data to a sibling\end{minipage} \\ &\verb!--relink-pristine! &\begin{minipage}{7cm} \raggedright relink pristine tree (not recommended)\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--compress! &\begin{minipage}{7cm} \raggedright create compressed patches\end{minipage} \\ &\verb!--dont-compress! &\begin{minipage}{7cm} \raggedright don't create compressed patches\end{minipage} \\ &\verb!--uncompress! &\begin{minipage}{7cm} \raggedright uncompress patches\end{minipage} \\ &\verb!--umask UMASK! &\begin{minipage}{7cm} \raggedright specify umask to use when writing\end{minipage} \\ \end{tabular} Optimize can help to improve the performance of your repository in a number of cases. Optimize always writes out a fresh copy of the inventory that minimizes the amount of inventory that need be downloaded when people pull from the repository. Specifically, it breaks up the inventory on the most recent tag. This speeds up most commands when run remotely, both because a smaller file needs to be transfered (only the most recent inventory). It also gives a guarantee that all the patches prior to a given tag are included in that tag, so less commutation and history traversal is needed. This latter issue can become very important in large repositories. \begin{rawhtml} <div class="cmd-opt-hdr"> --checkpoint, --tag </div> \end{rawhtml} If you use the \verb!--checkpoint! option, optimize creates a checkpoint patch for a tag. You can specify the tag with the \verb!--tag! option, or just let darcs choose the most recent tag. Note that optimize \verb!--checkpoint! will fail when used on a ``partial'' repository. Also, the tag that is to be checkpointed must not be preceded by any patches that are not included in that tag. If that is the case, no checkpointing is done. The created checkpoint is used by the \verb!--partial! flag to \verb!get! and \verb!check!. This allows for users to retrieve a working repository with limited history with a savings of disk space and bandwidth. \begin{rawhtml} <div class="cmd-opt-hdr"> --compress, --dont-compress, --uncompress </div> \end{rawhtml} Some compression options are available, and are independent of the \verb!--checkpoint! option. By default the patches in the repository are compressed. These use less disk space, which translates into less bandwidth if the repository is accessed remotely. Note that in the darcs-1.0 (also known as ``old fashioned inventory'') repository format, patches will always have the ``.gz'' extension whether they are compressed or not. You may want to uncompress the patches when you've got enough disk space but are running out of physical memory. If you give the \verb!--compress! option, optimize will compress all the patches in the repository. Similarly, if you give the \verb!--uncompress!, optimize will decompress all the patches in the repository. \verb!--dont-compress! means ``don't compress, but don't uncompress either''. It would be useful if one of the compression options was provided as a default and you wanted to override it. \begin{rawhtml} <div class="cmd-opt-hdr"> --relink </div> \end{rawhtml} The \verb|--relink| and \verb|--relink-pristine| options cause Darcs to relink files from a sibling. See Section \ref{disk-usage}. \begin{rawhtml} <div class="cmd-opt-hdr"> --reorder-patches </div> \end{rawhtml} The \verb|--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 \verb!--reorder-patches! on a repository from which someone may be simultaneously pulling or getting, as this could lead to repository corruption. \section{Undoing, redoing and running in circles} % Copyright (C) 2004,2007 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs amend-record} \verb!Usage: darcs amend-record [OPTION]... [FILE or DIRECTORY]...! Options: \begin{tabular}{lll} &\verb!--match PATTERN! &\begin{minipage}{7cm} \raggedright select a single patch matching PATTERN\end{minipage} \\ \verb!-p! &\verb!--patch REGEXP! &\begin{minipage}{7cm} \raggedright select a single patch matching REGEXP\end{minipage} \\ \verb!-n! &\verb!--index N-M! &\begin{minipage}{7cm} \raggedright select a range of patches\end{minipage} \\ &\verb!--no-test! &\begin{minipage}{7cm} \raggedright don't run the test script\end{minipage} \\ &\verb!--test! &\begin{minipage}{7cm} \raggedright run the test script\end{minipage} \\ &\verb!--leave-test-directory! &\begin{minipage}{7cm} \raggedright don't remove the test directory\end{minipage} \\ &\verb!--remove-test-directory! &\begin{minipage}{7cm} \raggedright remove the test directory\end{minipage} \\ \verb!-a! &\verb!--all! &\begin{minipage}{7cm} \raggedright answer yes to all patches\end{minipage} \\ \verb!-i! &\verb!--interactive! &\begin{minipage}{7cm} \raggedright prompt user interactively\end{minipage} \\ \verb!-A! &\verb!--author EMAIL! &\begin{minipage}{7cm} \raggedright specify author id\end{minipage} \\ \verb!-m! &\verb!--patch-name PATCHNAME! &\begin{minipage}{7cm} \raggedright name of patch\end{minipage} \\ &\verb!--edit-long-comment! &\begin{minipage}{7cm} \raggedright edit the long comment by default\end{minipage} \\ &\verb!--skip-long-comment! &\begin{minipage}{7cm} \raggedright don't give a long comment\end{minipage} \\ &\verb!--prompt-long-comment! &\begin{minipage}{7cm} \raggedright prompt for whether to edit the long comment\end{minipage} \\ \verb!-l! &\verb!--look-for-adds! &\begin{minipage}{7cm} \raggedright look for (non-boring) files that could be added\end{minipage} \\ &\verb!--dont-look-for-adds! &\begin{minipage}{7cm} \raggedright don't look for any files that could be added [DEFAULT]\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--compress! &\begin{minipage}{7cm} \raggedright create compressed patches\end{minipage} \\ &\verb!--dont-compress! &\begin{minipage}{7cm} \raggedright don't create compressed patches\end{minipage} \\ &\verb!--ignore-times! &\begin{minipage}{7cm} \raggedright don't trust the file modification times\end{minipage} \\ &\verb!--umask UMASK! &\begin{minipage}{7cm} \raggedright specify umask to use when writing\end{minipage} \\ &\verb!--set-scripts-executable! &\begin{minipage}{7cm} \raggedright make scripts executable\end{minipage} \\ &\verb!--dont-set-scripts-executable! &\begin{minipage}{7cm} \raggedright don't make scripts executable\end{minipage} \\ \end{tabular} Amend-record updates a `draft' patch with additions or improvements, resulting in a single `finished' patch. This is better than recording the additions and improvements as separate patches, because then whenever the `draft' patch is copied between repositories, you would need to make sure all the extra patches are copied, too. Do not copy draft patches between repositories, because a finished patch cannot be copied into a repository that contains a draft of the same patch. If this has already happened, `darcs obliterate' can be used to remove the draft patch. Do not run amend-record in repository that other developers can pull from, because if they pull while an amend-record is in progress, their repository may be corrupted. When recording a draft patch, it is a good idea to start the name with `DRAFT:' so that other developers know it is not finished. When finished, remove it with `darcs amend-record --edit-description'. Like `darcs record', if you call amend-record with files as arguments, you will only be asked about changes to those files. So to amend a patch to foo.c with improvements in bar.c, you would run: darcs amend-record --match 'touch foo.c' bar.c It is usually a bad idea to amend another developer's patch. To make amend-record only ask about your own patches by default, you can add something like `amend-record match David Roundy' to ~/.darcs/defaults, where `David Roundy' is your name. % Copyright (C) 2002-2004,2007 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs rollback} \verb!Usage: darcs rollback [OPTION]... [FILE or DIRECTORY]...! Options: \begin{tabular}{lll} &\verb!--from-match PATTERN! &\begin{minipage}{7cm} \raggedright select changes starting with a patch matching PATTERN\end{minipage} \\ &\verb!--from-patch REGEXP! &\begin{minipage}{7cm} \raggedright select changes starting with a patch matching REGEXP\end{minipage} \\ &\verb!--from-tag REGEXP! &\begin{minipage}{7cm} \raggedright select changes starting with a tag matching REGEXP\end{minipage} \\ &\verb!--last NUMBER! &\begin{minipage}{7cm} \raggedright select the last NUMBER patches\end{minipage} \\ &\verb!--matches PATTERN! &\begin{minipage}{7cm} \raggedright select patches matching PATTERN\end{minipage} \\ \verb!-p! &\verb!--patches REGEXP! &\begin{minipage}{7cm} \raggedright select patches matching REGEXP\end{minipage} \\ \verb!-t! &\verb!--tags REGEXP! &\begin{minipage}{7cm} \raggedright select tags matching REGEXP\end{minipage} \\ \verb!-a! &\verb!--all! &\begin{minipage}{7cm} \raggedright answer yes to all patches\end{minipage} \\ \verb!-i! &\verb!--interactive! &\begin{minipage}{7cm} \raggedright prompt user interactively\end{minipage} \\ \verb!-A! &\verb!--author EMAIL! &\begin{minipage}{7cm} \raggedright specify author id\end{minipage} \\ \verb!-m! &\verb!--patch-name PATCHNAME! &\begin{minipage}{7cm} \raggedright name of patch\end{minipage} \\ &\verb!--edit-long-comment! &\begin{minipage}{7cm} \raggedright edit the long comment by default\end{minipage} \\ &\verb!--skip-long-comment! &\begin{minipage}{7cm} \raggedright don't give a long comment\end{minipage} \\ &\verb!--prompt-long-comment! &\begin{minipage}{7cm} \raggedright prompt for whether to edit the long comment\end{minipage} \\ &\verb!--no-test! &\begin{minipage}{7cm} \raggedright don't run the test script\end{minipage} \\ &\verb!--test! &\begin{minipage}{7cm} \raggedright run the test script\end{minipage} \\ &\verb!--leave-test-directory! &\begin{minipage}{7cm} \raggedright don't remove the test directory\end{minipage} \\ &\verb!--remove-test-directory! &\begin{minipage}{7cm} \raggedright remove the test directory\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--compress! &\begin{minipage}{7cm} \raggedright create compressed patches\end{minipage} \\ &\verb!--dont-compress! &\begin{minipage}{7cm} \raggedright don't create compressed patches\end{minipage} \\ &\verb!--umask UMASK! &\begin{minipage}{7cm} \raggedright specify umask to use when writing\end{minipage} \\ \end{tabular} Rollback is used to undo the effects of one or more patches without actually deleting them. Instead, it creates a new patch reversing selected portions. of those changes. Unlike obliterate and unrecord (which accomplish a similar goal) rollback is perfectly safe, since it leaves in the repository a record of its changes. If you decide you didn't want to roll back a patch after all, you can reverse its effect by obliterating the rolled-back patch. Rollback can actually allow you to roll back a subset of the changes made by the selected patch or patches. Many of the options available in rollback behave similarly to the options for unrecord~\ref{unrecord} and record~\ref{record}. % Copyright (C) 2002-2005 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs unrecord} \label{unrecord} \verb!Usage: darcs unrecord [OPTION]... ! Options: \begin{tabular}{lll} &\verb!--from-match PATTERN! &\begin{minipage}{7cm} \raggedright select changes starting with a patch matching PATTERN\end{minipage} \\ &\verb!--from-patch REGEXP! &\begin{minipage}{7cm} \raggedright select changes starting with a patch matching REGEXP\end{minipage} \\ &\verb!--from-tag REGEXP! &\begin{minipage}{7cm} \raggedright select changes starting with a tag matching REGEXP\end{minipage} \\ &\verb!--last NUMBER! &\begin{minipage}{7cm} \raggedright select the last NUMBER patches\end{minipage} \\ &\verb!--matches PATTERN! &\begin{minipage}{7cm} \raggedright select patches matching PATTERN\end{minipage} \\ \verb!-p! &\verb!--patches REGEXP! &\begin{minipage}{7cm} \raggedright select patches matching REGEXP\end{minipage} \\ \verb!-t! &\verb!--tags REGEXP! &\begin{minipage}{7cm} \raggedright select tags matching REGEXP\end{minipage} \\ &\verb!--no-deps! &\begin{minipage}{7cm} \raggedright don't automatically fulfill dependencies\end{minipage} \\ &\verb!--dont-prompt-for-dependencies! &\begin{minipage}{7cm} \raggedright don't ask about patches that are depended on by matched patches (with --match or --patch)\end{minipage} \\ &\verb!--prompt-for-dependencies! &\begin{minipage}{7cm} \raggedright prompt about patches that are depended on by matched patches [DEFAULT]\end{minipage} \\ \verb!-a! &\verb!--all! &\begin{minipage}{7cm} \raggedright answer yes to all patches\end{minipage} \\ \verb!-i! &\verb!--interactive! &\begin{minipage}{7cm} \raggedright prompt user interactively\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--compress! &\begin{minipage}{7cm} \raggedright create compressed patches\end{minipage} \\ &\verb!--dont-compress! &\begin{minipage}{7cm} \raggedright don't create compressed patches\end{minipage} \\ &\verb!--umask UMASK! &\begin{minipage}{7cm} \raggedright specify umask to use when writing\end{minipage} \\ \end{tabular} Unrecord does the opposite of record in that it makes the changes from patches active changes again which you may record or revert later. The working copy itself will not change. Beware that you should not use this command if you are going to re-record the changes in any way and there is a possibility that another user may have already pulled the patch. Unrecord can be thought of as undo-record. If a record is followed by an unrecord, everything looks like before the record; all the previously unrecorded changes are back, and can be recorded again in a new patch. The unrecorded patch however is actually removed from your repository, so there is no way to record it again to get it back.\footnote{The patch file itself is not actually deleted, but its context is lost, so it cannot be reliably read---your only choice would be to go in by hand and read its contents.}. 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 \verb!darcs revert!. To do unrecord and revert in one go, you can use \verb!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 \emph{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. \newcommand{\pullwarning}[1]{ \textbf{WARNING:} #1 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.} \pullwarning{Unrecord} \begin{rawhtml} <div class="cmd-opt-hdr"> --from-match, --from-patch, --from-tag, --last </div> \end{rawhtml} 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 \verb!--from! and \verb!--last! options to set the earliest patch selectable to unrecord. \begin{rawhtml} <div class="cmd-opt-hdr"> --matches, --patches, --tags, --no-deps </div> \end{rawhtml} The \verb!--patches!, \verb!--matches!, \verb!--tags!, and \verb!--no-deps! options can be used to select which patches to unrecord, as described in subsection~\ref{selecting}. 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 \verb!--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 \verb!--from! or \verb!--last! options to search more or fewer patches. \subsection{darcs obliterate} \verb!Usage: darcs obliterate [OPTION]... ! Options: \begin{tabular}{lll} &\verb!--from-match PATTERN! &\begin{minipage}{7cm} \raggedright select changes starting with a patch matching PATTERN\end{minipage} \\ &\verb!--from-patch REGEXP! &\begin{minipage}{7cm} \raggedright select changes starting with a patch matching REGEXP\end{minipage} \\ &\verb!--from-tag REGEXP! &\begin{minipage}{7cm} \raggedright select changes starting with a tag matching REGEXP\end{minipage} \\ &\verb!--last NUMBER! &\begin{minipage}{7cm} \raggedright select the last NUMBER patches\end{minipage} \\ &\verb!--matches PATTERN! &\begin{minipage}{7cm} \raggedright select patches matching PATTERN\end{minipage} \\ \verb!-p! &\verb!--patches REGEXP! &\begin{minipage}{7cm} \raggedright select patches matching REGEXP\end{minipage} \\ \verb!-t! &\verb!--tags REGEXP! &\begin{minipage}{7cm} \raggedright select tags matching REGEXP\end{minipage} \\ &\verb!--no-deps! &\begin{minipage}{7cm} \raggedright don't automatically fulfill dependencies\end{minipage} \\ &\verb!--dont-prompt-for-dependencies! &\begin{minipage}{7cm} \raggedright don't ask about patches that are depended on by matched patches (with --match or --patch)\end{minipage} \\ &\verb!--prompt-for-dependencies! &\begin{minipage}{7cm} \raggedright prompt about patches that are depended on by matched patches [DEFAULT]\end{minipage} \\ \verb!-a! &\verb!--all! &\begin{minipage}{7cm} \raggedright answer yes to all patches\end{minipage} \\ \verb!-i! &\verb!--interactive! &\begin{minipage}{7cm} \raggedright prompt user interactively\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--compress! &\begin{minipage}{7cm} \raggedright create compressed patches\end{minipage} \\ &\verb!--dont-compress! &\begin{minipage}{7cm} \raggedright don't create compressed patches\end{minipage} \\ &\verb!--ignore-times! &\begin{minipage}{7cm} \raggedright don't trust the file modification times\end{minipage} \\ &\verb!--umask UMASK! &\begin{minipage}{7cm} \raggedright specify umask to use when writing\end{minipage} \\ \end{tabular} Obliterate completely removes recorded patches from your local repository. The changes will be undone in your working copy and the patches will not be shown in your changes list anymore. Beware that you can lose precious code by obliterating! Obliterate deletes a patch from the repository \emph{and} removes those changes from the working directory. It is therefore a \emph{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. \pullwarning{Obliterate} \begin{rawhtml} <div class="cmd-opt-hdr"> --from-match, --from-patch, --from-tag, --last </div> \end{rawhtml} 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 \verb!--from! and \verb!--last! options to set the earliest patch selectable to obliterate. \begin{rawhtml} <div class="cmd-opt-hdr"> --matches, --patches, --tags, --no-deps </div> \end{rawhtml} The \verb!--patches!, \verb!--matches!, \verb!--tags!, and \verb!--no-deps! options can be used to select which patches to obliterate, as described in subsection~\ref{selecting}. 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 \verb!--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 \verb!--from! or \verb!--last! options to search more or fewer patches. % Copyright (C) 2002-2005 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs revert} \verb!Usage: darcs revert [OPTION]... [FILE or DIRECTORY]...! Options: \begin{tabular}{lll} \verb!-a! &\verb!--all! &\begin{minipage}{7cm} \raggedright answer yes to all patches\end{minipage} \\ \verb!-i! &\verb!--interactive! &\begin{minipage}{7cm} \raggedright prompt user interactively\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--ignore-times! &\begin{minipage}{7cm} \raggedright don't trust the file modification times\end{minipage} \\ &\verb!--umask UMASK! &\begin{minipage}{7cm} \raggedright specify umask to use when writing\end{minipage} \\ \end{tabular} Revert is used to undo changes made to the working copy which have not yet been recorded. You will be prompted for which changes you wish to undo. The last revert can be undone safely using the unrevert command if the working copy was not modified in the meantime. The actions of a revert may be reversed using the unrevert command (see subsection~\ref{unrevert}). 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. % Copyright (C) 2003-2005 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs unrevert}\label{unrevert} \verb!Usage: darcs unrevert [OPTION]... ! Options: \begin{tabular}{lll} &\verb!--ignore-times! &\begin{minipage}{7cm} \raggedright don't trust the file modification times\end{minipage} \\ \verb!-a! &\verb!--all! &\begin{minipage}{7cm} \raggedright answer yes to all patches\end{minipage} \\ \verb!-i! &\verb!--interactive! &\begin{minipage}{7cm} \raggedright prompt user interactively\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--umask UMASK! &\begin{minipage}{7cm} \raggedright specify umask to use when writing\end{minipage} \\ \end{tabular} Unrevert is a rescue command in case you accidentally reverted something you wanted to keep (for example, accidentally typing `darcs rev -a' instead of `darcs rec -a'). This command may fail if the repository has changed since the revert took place. Darcs will ask for confirmation before executing an interactive command that will *definitely* prevent unreversion. \section{Advanced examination of the repository} % Copyright (C) 2003-2004 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs diff} \verb!Usage: darcs diff [OPTION]... [FILE or DIRECTORY]...! Options: \begin{tabular}{lll} &\verb!--to-match PATTERN! &\begin{minipage}{7cm} \raggedright select changes up to a patch matching PATTERN\end{minipage} \\ &\verb!--to-patch REGEXP! &\begin{minipage}{7cm} \raggedright select changes up to a patch matching REGEXP\end{minipage} \\ &\verb!--to-tag REGEXP! &\begin{minipage}{7cm} \raggedright select changes up to a tag matching REGEXP\end{minipage} \\ &\verb!--from-match PATTERN! &\begin{minipage}{7cm} \raggedright select changes starting with a patch matching PATTERN\end{minipage} \\ &\verb!--from-patch REGEXP! &\begin{minipage}{7cm} \raggedright select changes starting with a patch matching REGEXP\end{minipage} \\ &\verb!--from-tag REGEXP! &\begin{minipage}{7cm} \raggedright select changes starting with a tag matching REGEXP\end{minipage} \\ &\verb!--match PATTERN! &\begin{minipage}{7cm} \raggedright select a single patch matching PATTERN\end{minipage} \\ \verb!-p! &\verb!--patch REGEXP! &\begin{minipage}{7cm} \raggedright select a single patch matching REGEXP\end{minipage} \\ &\verb!--last NUMBER! &\begin{minipage}{7cm} \raggedright select the last NUMBER patches\end{minipage} \\ \verb!-n! &\verb!--index N-M! &\begin{minipage}{7cm} \raggedright select a range of patches\end{minipage} \\ &\verb!--diff-command COMMAND! &\begin{minipage}{7cm} \raggedright specify diff command (ignores --diff-opts)\end{minipage} \\ &\verb!--diff-opts OPTIONS! &\begin{minipage}{7cm} \raggedright options to pass to diff\end{minipage} \\ \verb!-u! &\verb!--unified! &\begin{minipage}{7cm} \raggedright pass -u option to diff\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ &\verb!--store-in-memory! &\begin{minipage}{7cm} \raggedright do patch application in memory rather than on disk\end{minipage} \\ \end{tabular} 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 \begin{rawhtml} <div class="cmd-opt-hdr"> --diff-opts </div> \end{rawhtml} Diff calls an external ``diff'' command to do the actual work, and passes any unrecognized flags to this diff command. Thus you can call \begin{verbatim} % darcs diff -t 0.9.8 -t 0.9.10 -- -u \end{verbatim} to get a diff in the unified format. Actually, thanks to the wonders of getopt you need the ``\verb!--!'' shown above before any arguments to diff. You can also specify additional arguments to diff using the \verb!--diff-opts! flag. The above command would look like this: \begin{verbatim} % darcs diff --diff-opts -u -t 0.9.8 -t 0.9.10 \end{verbatim} 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 \begin{verbatim} % diff diff-opts -udp \end{verbatim} to your \verb!_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 \begin{verbatim} % darcs diff foo.c bar.c baz/ \end{verbatim} \begin{rawhtml} <div class="cmd-opt-hdr"> --diff-command </div> \end{rawhtml} You can use a different program to view differences by including the flag \verb!--diff-command!, e.g. \begin{verbatim} --diff-command 'opendiff %1 %2'. \end{verbatim} The \verb!%1! and \verb!%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 \begin{verbatim} --diff-command 'xxdiff %1 %2' \end{verbatim} To use \verb!kdiff3!, you can use \begin{verbatim} --diff-command 'kdiff3 %1 %2' \end{verbatim} Note that the command is split into space-separated words and the first one is \verb!exec!ed with the rest as arguments---it is not a shell command. Also the substitution of the \verb!%! escapes is only done on complete words. See \ref{resolution} for how you might work around this fact, for example, with Emacs' Ediff package. Note also that the \verb!--diff-opts! flag is ignored if you use this option. % Copyright (C) 2003 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs annotate} \label{annotate} \verb!Usage: darcs annotate [OPTION]... [FILE or DIRECTORY]...! Options: \begin{tabular}{lll} \verb!-s! &\verb!--summary! &\begin{minipage}{7cm} \raggedright summarize changes\end{minipage} \\ &\verb!--no-summary! &\begin{minipage}{7cm} \raggedright don't summarize changes\end{minipage} \\ \verb!-u! &\verb!--unified! &\begin{minipage}{7cm} \raggedright output patch in a darcs-specific format similar to diff -u\end{minipage} \\ &\verb!--human-readable! &\begin{minipage}{7cm} \raggedright give human-readable output\end{minipage} \\ &\verb!--xml-output! &\begin{minipage}{7cm} \raggedright generate XML formatted output\end{minipage} \\ &\verb!--match PATTERN! &\begin{minipage}{7cm} \raggedright select a single patch matching PATTERN\end{minipage} \\ \verb!-p! &\verb!--patch REGEXP! &\begin{minipage}{7cm} \raggedright select a single patch matching REGEXP\end{minipage} \\ \verb!-t! &\verb!--tag REGEXP! &\begin{minipage}{7cm} \raggedright select tag matching REGEXP\end{minipage} \\ \verb!-n! &\verb!--index N-M! &\begin{minipage}{7cm} \raggedright select a range of patches\end{minipage} \\ &\verb!--creator-hash HASH! &\begin{minipage}{7cm} \raggedright specify hash of creator patch (see docs)\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} Display which patch last modified something. Annotate displays which patches created or last modified a directory file or line. It can also display the contents of a particular patch in darcs format. \begin{rawhtml} <div class="cmd-opt-hdr"> --human-readable, --summary, --unified, --xml--output </div> \end{rawhtml} When called with just a patch name, annotate outputs the patch in darcs format, which is the same as \verb!--human-readable!. \verb!--xml-output! is the alternative to \verb!--human-readable!. \verb!--summary! can be used with either the \verb!--xml-output! or the \verb!--human-readable! options to alter the results. It is documented fully in the `common options' portion of the manual. Giving the \verb!--unified! flag implies \verb!--human-readable!, and causes the output to remain in a darcs-specific format that is similar to that produced by \verb!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: \begin{verbatim} # Created by [bounce handling patch # mark**20040526202216] as ./test/m7/bounce_handling.pl bounce_handling.pl \end{verbatim} 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. \begin{rawhtml} <div class="cmd-opt-hdr"> --creator-hash HASH </div> \end{rawhtml} The \verb!--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 \emph{at the time it was created}, and the hash given along with \verb!--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. % Includes the show commands. % Copyright (C) 2002-2004 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs show} The show command provides access to several subcommands which can be used to investigate the state of a repository. % Copyright (C) 2008 Eric Kow % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsubsection{darcs show authors} \verb!Usage: darcs show authors [OPTION]... ! Options: \begin{tabular}{lll} &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} The authors command writes a list of all patch authors in the repository to standard output. % Copyright (C) 2007 Eric Kow % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsubsection{darcs show contents} \verb!Usage: darcs show contents [OPTION]... [FILE]...! Options: \begin{tabular}{lll} &\verb!--match PATTERN! &\begin{minipage}{7cm} \raggedright select a single patch matching PATTERN\end{minipage} \\ \verb!-p! &\verb!--patch REGEXP! &\begin{minipage}{7cm} \raggedright select a single patch matching REGEXP\end{minipage} \\ \verb!-t! &\verb!--tag REGEXP! &\begin{minipage}{7cm} \raggedright select tag matching REGEXP\end{minipage} \\ \verb!-n! &\verb!--index N-M! &\begin{minipage}{7cm} \raggedright select a range of patches\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} 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). % Copyright (C) 2005 Florian Weimer % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsubsection{darcs show files} \label{show-files} \verb!Usage: darcs show files [OPTION]... ! Options: \begin{tabular}{lll} &\verb!--files! &\begin{minipage}{7cm} \raggedright include files in output [DEFAULT]\end{minipage} \\ &\verb!--no-files! &\begin{minipage}{7cm} \raggedright don't include files in output\end{minipage} \\ &\verb!--directories! &\begin{minipage}{7cm} \raggedright include directories in output [DEFAULT]\end{minipage} \\ &\verb!--no-directories! &\begin{minipage}{7cm} \raggedright don't include directories in output\end{minipage} \\ &\verb!--pending! &\begin{minipage}{7cm} \raggedright reflect pending patches in output [DEFAULT]\end{minipage} \\ &\verb!--no-pending! &\begin{minipage}{7cm} \raggedright only included recorded patches in output\end{minipage} \\ \verb!-0! &\verb!--null! &\begin{minipage}{7cm} \raggedright separate file names by NUL characters\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} The files command lists the version-controlled files in the working copy. The similar manifest command, lists the same files, excluding any directories. By default (and if the \verb!--pending! option is specified), the effect of pending patches on the repository is taken into account. In other words, if you add a file using {\tt darcs add}, it immediately appears in the output of {\tt query manifest}, even if it is not yet recorded. If you specify the \verb!--no-pending! option, {\tt query manifest} will only list recorded files (and directories). The \verb!--files! and \verb!--directories! options control whether files and directories are included in the output. The \verb!--no-files! and \verb!--no-directories! options have the reverse effect. The default is to include files, but not directories. If you specify the \verb!--null! option, the file names are written to standard output in unescaped form, and separated by ASCII NUL bytes. This format is suitable for further automatic processing (for example, using \verb!xargs -0!). % Copyright (C) 2007 Florian Weimer % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsubsection{darcs show tags} \verb!Usage: darcs show tags [OPTION]... ! Options: \begin{tabular}{lll} &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} 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. % Copyright (C) 2007 Kevin Quick % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsubsection{darcs show repo} %%\label{show-repo} \verb!Usage: darcs show repo [OPTION]... ! Options: \begin{tabular}{lll} &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ &\verb!--files! &\begin{minipage}{7cm} \raggedright include files in output [DEFAULT]\end{minipage} \\ &\verb!--no-files! &\begin{minipage}{7cm} \raggedright don't include files in output\end{minipage} \\ &\verb!--xml-output! &\begin{minipage}{7cm} \raggedright generate XML formatted output\end{minipage} \\ \end{tabular} The \verb!show repo! displays information about the current repository: the location, the type, etc. This is provided as informational output for two purposes: curious users and scripts invoking darcs. For the latter, this information can be parsed to facilitate the script; for example, \verb!darcs show repo | grep Root: | awk {print $2}! can be used to locate the top-level \verb!_darcs! directory from anyplace within a darcs repository working directory. \begin{rawhtml} <div class="cmd-opt-hdr"> --files, --no-files </div> \end{rawhtml} If the \verb!--files! option is specified (the default), then the \verb!show repo! operation will read patch information from the repository and display the number of patches in the repository. The \verb!--no-files! option can be used to suppress this operation (and improve performance). \begin{rawhtml} <div class="cmd-opt-hdr"> --human-readable, --xml-output </div> \end{rawhtml} By default, the \verb!show repo! displays output in human readable form, but the \verb!--xml-output! option can be used to obtain XML-formatted to facilitate regular parsing by external tools. \section{Rarely needed and obscure commands} % Copyright (C) 2002-2005,2007 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs convert} \verb!Usage: darcs convert [OPTION]... <REPOSITORY> [<DIRECTORY>]! Options: \begin{tabular}{lll} &\verb!--repo-name DIRECTORY!,\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright path of output directory\end{minipage} \\ &\verb!--set-scripts-executable! &\begin{minipage}{7cm} \raggedright make scripts executable\end{minipage} \\ &\verb!--dont-set-scripts-executable! &\begin{minipage}{7cm} \raggedright don't make scripts executable\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--ssh-cm! &\begin{minipage}{7cm} \raggedright use SSH ControlMaster feature\end{minipage} \\ &\verb!--no-ssh-cm! &\begin{minipage}{7cm} \raggedright don't use SSH ControlMaster feature [DEFAULT]\end{minipage} \\ &\verb!--http-pipelining! &\begin{minipage}{7cm} \raggedright enable HTTP pipelining\end{minipage} \\ &\verb!--no-http-pipelining! &\begin{minipage}{7cm} \raggedright disable HTTP pipelining [DEFAULT]\end{minipage} \\ &\verb!--no-cache! &\begin{minipage}{7cm} \raggedright don't use patch caches\end{minipage} \\ \end{tabular} You may specify the name of the repository created by providing a second argument to convert, which is a directory name. % Copyright (C) 2002-2003,2005 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs mark-conflicts} \verb!Usage: darcs mark-conflicts [OPTION]... ! Options: \begin{tabular}{lll} &\verb!--ignore-times! &\begin{minipage}{7cm} \raggedright don't trust the file modification times\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--umask UMASK! &\begin{minipage}{7cm} \raggedright specify umask to use when writing\end{minipage} \\ \end{tabular} Darcs requires human guidance to unify changes to the same part of a source file. When a conflict first occurs, darcs will add both choices to the working tree, delimited by markers. However, you might revert or manually delete these markers without actually resolving the conflict. In this case, `darcs mark-conflicts' is useful to show where any unresolved conflicts. It is also useful if `darcs apply' is called with --apply-conflicts, where conflicts aren't marked initially. Any unrecorded changes to the working tree *will* be lost forever when you run this command! You will be prompted for confirmation before this takes place. This command was historically called `resolve', and this deprecated alias still exists for backwards-compatibility. % Copyright (C) 2003 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs dist} \verb!Usage: darcs dist [OPTION]... ! Options: \begin{tabular}{lll} \verb!-d! &\verb!--dist-name DISTNAME! &\begin{minipage}{7cm} \raggedright name of version\end{minipage} \\ &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ &\verb!--match PATTERN! &\begin{minipage}{7cm} \raggedright select a single patch matching PATTERN\end{minipage} \\ \verb!-p! &\verb!--patch REGEXP! &\begin{minipage}{7cm} \raggedright select a single patch matching REGEXP\end{minipage} \\ \verb!-t! &\verb!--tag REGEXP! &\begin{minipage}{7cm} \raggedright select tag matching REGEXP\end{minipage} \\ \verb!-n! &\verb!--index N-M! &\begin{minipage}{7cm} \raggedright select a range of patches\end{minipage} \\ &\verb!--store-in-memory! &\begin{minipage}{7cm} \raggedright do patch application in memory rather than on disk\end{minipage} \\ \end{tabular} 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. % Copyright (C) 2002-2005 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs trackdown} \verb!Usage: darcs trackdown [OPTION]... [[INITIALIZATION] COMMAND]! Options: \begin{tabular}{lll} &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--set-scripts-executable! &\begin{minipage}{7cm} \raggedright make scripts executable\end{minipage} \\ &\verb!--dont-set-scripts-executable! &\begin{minipage}{7cm} \raggedright don't make scripts executable\end{minipage} \\ \end{tabular} Trackdown tries to find the most recent version in the repository which passes a test. Given no arguments, it uses the default repository test. Given one argument, it treats it as a test command. Given two arguments, the first is an initialization command with is run only once, and the second is the test command. Trackdown is helpful for locating when something was broken. It creates a temporary directory with the latest repository content in it and cd to it. First, and only once, it runs the initialization command if any, for example \begin{verbatim} 'autoconf; ./configure >/dev/null' \end{verbatim} Then it runs the test command, for example \begin{verbatim} 'make && cd tests && sh /tmp/test.sh' \end{verbatim} 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: \begin{verbatim} % darcs trackdown 'make && false' \end{verbatim} would result in compiling every version in the repository--which is a rather tedious prospect. \subsubsection{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 \begin{verbatim} % darcs trackdown 'grep FIXME Record.lhs' \end{verbatim} To find the latest version that compiles, you can run \begin{verbatim} % darcs trackdown 'autoconf' './configure && make' \end{verbatim} Trackdown can also be used to see how other features of the code changed with time. For example \begin{verbatim} % darcs trackdown 'autoconf; ./configure' \ "make darcs > /dev/null && cd ~/darcs && time darcs check && false" \end{verbatim} would let you see how long `darcs check' takes to run on each previous version of darcs that will actually compile. The ``\verb!&& false!'' ensures that trackdown keeps going. % Copyright (C) 2003,2005 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \subsection{darcs repair} \verb!Usage: darcs repair [OPTION]... ! Options: \begin{tabular}{lll} &\verb!--repodir DIRECTORY! &\begin{minipage}{7cm} \raggedright specify the repository directory in which to run\end{minipage} \\ \end{tabular} Advanced options: \begin{tabular}{lll} &\verb!--umask UMASK! &\begin{minipage}{7cm} \raggedright specify umask to use when writing\end{minipage} \\ \end{tabular} 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. \appendix % Copyright (C) 2002-2003 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \chapter{Theory of patches} \label{Patch} \newtheorem{thm}{Theorem} \newtheorem{dfn}{Definition} \section{Background} I think a little background on the author is in order. I am a physicist, and think like a physicist. The proofs and theorems given here are what I would call ``physicist'' proofs and theorems, which is to say that while the proofs may not be rigorous, they are practical, and the theorems are intended to give physical insight. It would be great to have a mathematician work on this to give patch theory better formalized foundations. From the beginning of this theory, which originated as the result of a series of email discussions with Tom Lord, I have looked at patches as being analogous to the operators of quantum mechanics. I include in this appendix footnotes explaining the theory of patches in terms of the theory of quantum mechanics. I advise against taking this analogy too seriously, although it could provide some insight into how a physicist might think about darcs. % Copyright (C) 2002-2005 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \section{Introduction} A patch describes a change to the tree. It could be either a primitive patch (such as a file add/remove, a directory rename, or a hunk replacement within a file), or a composite patch describing many such changes. Every patch type must satisfy the conditions described in this appendix. The theory of patches is independent of the data which the patches manipulate, which is what makes it both powerful and useful, as it provides a framework upon which one can build a revision control system in a sane manner. Although in a sense, the defining property of any patch is that it can be applied to a certain tree, and thus make a certain change, this change does not wholly define the patch. A patch is defined by a \emph{representation}, together with a set of rules for how it behaves (which it has in common with its patch type). The \emph{representation} of a patch defines what change that particular patch makes, and must be defined in the context of a specific tree. The theory of patches is a theory of the many ways one can change the representation of a patch to place it in the context of a different tree. The patch itself is not changed, since it describes a single change, which must be the same regardless of its representation\footnote{For those comfortable with quantum mechanics, think of a patch as a quantum mechanical operator, and the representation as the basis set. The analogy breaks down pretty quickly, however, since an operator could be described in any complete basis set, while a patch modifying the file {\tt foo} can only be described in the rather small set of contexts which have a file {\tt foo} to be modified.}. So how does one define a tree, or the context of a patch? The simplest way to define a tree is as the result of a series of patches applied to the empty tree\footnote{This is very similar to the second-quantized picture, in which any state is seen as the result of a number of creation operators acting on the vacuum, and provides a similar set of simplifications---in particular, the exclusion principle is very elegantly enforced by the properties of the anti-hermitian fermion creation operators.}. Thus, the context of a patch consists of the set of patches that precede it. \section{Applying patches} \subsection{Hunk patches} Hunks are an example of a complex filepatch. A hunk is a set of lines of a text file to be replaced by a different set of lines. Either of these sets may be empty, which would mean a deletion or insertion of lines. \subsection{Token replace patches}\label{token_replace} Although most filepatches will be hunks, darcs is clever enough to support other types of changes as well. A ``token replace'' patch replaces all instances of a given token with some other version. A token, here, is defined by a regular expression, which must be of the simple [a--z\ldots]\ type, indicating which characters are allowed in a token, with all other characters acting as delimiters. For example, a C identifier would be a token with the flag \verb![A-Za-z_0-9]!. What makes the token replace patch special is the fact that a token replace can be merged with almost any ordinary hunk, giving exactly what you would want. For example, you might want to change the patch type {\tt TokReplace} to {\tt TokenReplace} (if you decided that saving two characters of space was stupid). If you did this using hunks, it would modify every line where {\tt TokReplace} occurred, and quite likely provoke a conflict with another patch modifying those lines. On the other hand, if you did this using a token replace patch, the only change that it could conflict with would be if someone else had used the token ``{\tt TokenReplace}'' in their patch rather than TokReplace---and that actually would be a real conflict! %\section{Outputting interesting and useful information} %Just being able to manipulate patches and trees is not enough. We also %want to be able to view the patches and files. This requires another set %of functions, closely related to the patch application functions, which %will give us the necessary information to browse the changes we have made. %It is \emph{not} the Patch module's responsibility to add any sort of %markup or formatting, but simply to provide the information necessary for an %external module to do the formatting. %files or directories, changed by a patch %we get it solely from the patch here %instead of performing patch apply on a population %we !could! achieve the same by applying a patch to a cleaned population %and getting modified files and dirs %but this should be significantly slower when the population grows large %This could be useful for just presenting a summary of what a patch does %(especially useful for larger repos) %apply a patch to a population at a given time % Copyright (C) 2002-2003 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \section{Patch relationships} %Another nice thing to be able to do with composite patches is to `flatten' %them, that is, turn them into a simple list of patches (appropriately %ordered, of course), with all nested compositeness unnested. The simplest relationship between two patches is that of ``sequential'' patches, which means that the context of the second patch (the one on the left) consists of the first patch (on the right) plus the context of the first patch. The composition of two patches (which is also a patch) refers to the patch which is formed by first applying one and then the other. The composition of two patches, $P_1$ and $P_2$ is represented as $P_2P_1$, where $P_1$ is to be applied first, then $P_2$\footnote{This notation is inspired by the notation of matrix multiplication or the application of operators upon a Hilbert space. In the algebra of patches, there is multiplication (i.e.\ composition), which is associative but not commutative, but no addition or subtraction.} There is one other very useful relationship that two patches can have, which is to be parallel patches, which means that the two patches have an identical context (i.e.\ their representation applies to identical trees). This is represented by $P_1\parallel P_2$. Of course, two patches may also have no simple relationship to one another. In that case, if you want to do something with them, you'll have to manipulate them with respect to other patches until they are either in sequence or in parallel. The most fundamental and simple property of patches is that they must be invertible. The inverse of a patch is described by: $P^{ -1}$. In the darcs implementation, the inverse is required to be computable from knowledge of the patch only, without knowledge of its context, but that (although convenient) is not required by the theory of patches. \begin{dfn} The inverse of patch $P$ is $P^{ -1}$, which is the ``simplest'' patch for which the composition \( P^{ -1} P \) makes no changes to the tree. \end{dfn} Using this definition, it is trivial to prove the following theorem relating to the inverse of a composition of two patches. \begin{thm} The inverse of the composition of two patches is \[ (P_2 P_1)^{ -1} = P_1^{ -1} P_2^{ -1}. \] \end{thm} Moreover, it is possible to show that the right inverse of a patch is equal to its left inverse. In this respect, patches continue to be analogous to square matrices, and indeed the proofs relating to these properties of the inverse are entirely analogous to the proofs in the case of matrix multiplication. The compositions proofs can also readily be extended to the composition of more than two patches. % Copyright (C) 2002-2003 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \section{Commuting patches} \subsection{Composite patches} Composite patches are made up of a series of patches intended to be applied sequentially. They are represented by a list of patches, with the first patch in the list being applied first. \newcommand{\commutex}{\longleftrightarrow} \newcommand{\commutes}{\longleftrightarrow} The first way (of only two) to change the context of a patch is by commutation, which is the process of changing the order of two sequential patches. \begin{dfn} The commutation of patches $P_1$ and $P_2$ is represented by \[ P_2 P_1 \commutes {P_1}' {P_2}'. \] Here $P_1'$ is intended to describe the same change as $P_1$, with the only difference being that $P_1'$ is applied after $P_2'$ rather than before $P_2$. \end{dfn} The above definition is obviously rather vague, the reason being that what is the ``same change'' has not been defined, and we simply assume (and hope) that the code's view of what is the ``same change'' will match those of its human users. The `$\commutes$' operator should be read as something like the $==$ operator in C, indicating that the right hand side performs identical changes to the left hand side, but the two patches are in reversed order. When read in this manner, it is clear that commutation must be a reversible process, and indeed this means that commutation \emph{can} fail, and must fail in certain cases. For example, the creation and deletion of the same file cannot be commuted. When two patches fail to commutex, it is said that the second patch depends on the first, meaning that it must have the first patch in its context (remembering that the context of a patch is a set of patches, which is how we represent a tree). \footnote{The fact that commutation can fail makes a huge difference in the whole patch formalism. It may be possible to create a formalism in which commutation always succeeds, with the result of what would otherwise be a commutation that fails being something like a virtual particle (which can violate conservation of energy), and it may be that such a formalism would allow strict mathematical proofs (whereas those used in the current formalism are mostly only hand waving ``physicist'' proofs). However, I'm not sure how you'd deal with a request to delete a file that has not yet been created, for example. Obviously you'd need to create some kind of antifile, which would annihilate with the file when that file finally got created, but I'm not entirely sure how I'd go about doing this. $\ddot\frown$ So I'm sticking with my hand waving formalism.} %I should add that one using the inversion relationship of sequential %patches, one can avoid having to provide redundant definitions of %commutation. % There is another interesting property which is that a commutex's results % can't be affected by commuting another thingamabopper. \paragraph{Merge} \newcommand{\merge}{\Longrightarrow} The second way one can change the context of a patch is by a {\bf merge} operation. A merge is an operation that takes two parallel patches and gives a pair of sequential patches. The merge operation is represented by the arrow ``\( \merge \)''. \begin{dfn}\label{merge_dfn} The result of a merge of two patches, $P_1$ and $P_2$ is one of two patches, $P_1'$ and $P_2'$, which satisfy the relationship: \[ P_2 \parallel P_1 \merge {P_2}' P_1 \commutex {P_1}' P_2. \] \end{dfn} Note that the sequential patches resulting from a merge are \emph{required} to commutex. This is an important consideration, as without it most of the manipulations we would like to perform would not be possible. The other important fact is that a merge \emph{cannot fail}. Naively, those two requirements seem contradictory. In reality, what it means is that the result of a merge may be a patch which is much more complex than any we have yet considered\footnote{Alas, I don't know how to prove that the two constraints even \emph{can} be satisfied. The best I have been able to do is to believe that they can be satisfied, and to be unable to find an case in which my implementation fails to satisfy them. These two requirements are the foundation of the entire theory of patches (have you been counting how many foundations it has?).}. \subsection{How merges are actually performed} The constraint that any two compatible patches (patches which can successfully be applied to the same tree) can be merged is actually quite difficult to apply. The above merge constraints also imply that the result of a series of merges must be independent of the order of the merges. So I'm putting a whole section here for the interested to see what algorithms I use to actually perform the merges (as this is pretty close to being the most difficult part of the code). The first case is that in which the two merges don't actually conflict, but don't trivially merge either (e.g.\ hunk patches on the same file, where the line number has to be shifted as they are merged). This kind of merge can actually be very elegantly dealt with using only commutation and inversion. There is a handy little theorem which is immensely useful when trying to merge two patches. \begin{thm}\label{merge_thm} $ P_2' P_1 \commutex P_1' P_2 $ if and only if $ P_1'^{ -1} P_2' \commutex P_2 P_1^{ -1} $, provided both commutations succeed. If either commutex fails, this theorem does not apply. \end{thm} This can easily be proven by multiplying both sides of the first commutation by $P_1'^{ -1}$ on the left, and by $P_1^{ -1}$ on the right. Besides being used in merging, this theorem is also useful in the recursive commutations of mergers. From Theorem~\ref{merge_thm}, we see that the merge of $P_1$ and $P_2'$ is simply the commutation of $P_2$ with $P_1^{ -1}$ (making sure to do the commutation the right way). Of course, if this commutation fails, the patches conflict. Moreover, one must check that the merged result actually commutes with $P_1$, as the theorem applies only when \emph{both} commutations are successful. Of course, there are patches that actually conflict, meaning a merge where the two patches truly cannot both be applied (e.g.\ trying to create a file and a directory with the same name). We deal with this case by creating a special kind of patch to support the merge, which we will call a ``merger''. Basically, a merger is a patch that contains the two patches that conflicted, and instructs darcs basically to resolve the conflict. By construction a merger will satisfy the commutation property (see Definition~\ref{merge_dfn}) that characterizes all merges. Moreover the merger's properties are what makes the order of merges unimportant (which is a rather critical property for darcs as a whole). The job of a merger is basically to undo the two conflicting patches, and then apply some sort of a ``resolution'' of the two instead. In the case of two conflicting hunks, this will look much like what CVS does, where it inserts both versions into the file. In general, of course, the two conflicting patches may both be mergers themselves, in which case the situation is considerably more complicated. Much of the merger code depends on a routine which recreates from a single merger the entire sequence of patches which led up to that merger (this is, of course, assuming that this is the complicated general case of a merger of mergers of mergers). This ``unwind'' procedure is rather complicated, but absolutely critical to the merger code, as without it we wouldn't even be able to undo the effects of the patches involved in the merger, since we wouldn't know what patches were all involved in it. Basically, unwind takes a merger such as \begin{verbatim} M( M(A,B), M(A,M(C,D))) \end{verbatim} From which it recreates a merge history: \begin{verbatim} C A M(A,B) M( M(A,B), M(A,M(C,D))) \end{verbatim} (For the curious, yes I can easily unwind this merger in my head [and on paper can unwind insanely more complex mergers]---that's what comes of working for a few months on an algorithm.) Let's start with a simple unwinding. The merger \verb!M(A,B)! simply means that two patches (\verb!A! and \verb!B!) conflicted, and of the two of them \verb!A! is first in the history. The last two patches in the unwinding of any merger are always just this easy. So this unwinds to: \begin{verbatim} A M(A,B) \end{verbatim} What about a merger of mergers? How about \verb!M(A,M(C,D))!. In this case we know the two most recent patches are: \begin{verbatim} A M(A,M(C,D)) \end{verbatim} But obviously the unwinding isn't complete, since we don't yet see where \verb!C! and \verb!D! came from. In this case we take the unwinding of \verb!M(C,D)! and drop its latest patch (which is \verb!M(C,D)! itself) and place that at the beginning of our patch train: \begin{verbatim} C A M(A,M(C,D)) \end{verbatim} As we look at \verb!M( M(A,B), M(A,M(C,D)))!, we consider the unwindings of each of its subpatches: \begin{verbatim} C A A M(A,B) M(A,M(C,D)) \end{verbatim} As we did with \verb!M(A,M(C,D))!, we'll drop the first patch on the right and insert the first patch on the left. That moves us up to the two \verb!A!'s. Since these agree, we can use just one of them (they ``should'' agree). That leaves us with the \verb!C! which goes first. The catch is that things don't always turn out this easily. There is no guarantee that the two \verb!A!'s would come out at the same time, and if they didn't, we'd have to rearrange things until they did. Or if there was no way to rearrange things so that they would agree, we have to go on to plan B, which I will explain now. Consider the case of \verb!M( M(A,B), M(C,D))!. We can easily unwind the two subpatches \begin{verbatim} A C M(A,B) M(C,D) \end{verbatim} Now we need to reconcile the \verb!A! and \verb!C!. How do we do this? Well, as usual, the solution is to use the most wonderful Theorem~\ref{merge_thm}. In this case we have to use it in the reverse of how we used it when merging, since we know that \verb!A! and \verb!C! could either one be the \emph{last} patch applied before \verb!M(A,B)! or \verb!M(C,D)!. So we can find \verb!C'! using \[ A^{ -1} C \commutex C' A'^{ -1} \] Giving an unwinding of \begin{verbatim} C' A M(A,B) M( M(A,B), M(C,D) ) \end{verbatim} There is a bit more complexity to the unwinding process (mostly having to do with cases where you have deeper nesting), but I think the general principles that are followed are pretty much included in the above discussion. \section{Conflicts} There are a couple of simple constraints on the routine which determines how to resolve two conflicting patches (which is called `glump'). These must be satisfied in order that the result of a series of merges is always independent of their order. Firstly, the output of glump cannot change when the order of the two conflicting patches is switched. If it did, then commuting the merger could change the resulting patch, which would be bad. Secondly, the result of the merge of three (or more) conflicting patches cannot depend on the order in which the merges are performed. The conflict resolution code (glump) begins by ``unravelling'' the merger into a set of sequences of patches. Each sequence of patches corresponds to one non-conflicted patch that got merged together with the others. The result of the unravelling of a series of merges must obviously be independent of the order in which those merges are performed. This unravelling code (which uses the unwind code mentioned above) uses probably the second most complicated algorithm. Fortunately, if we can successfully unravel the merger, almost any function of the unravelled merger satisfies the two constraints mentioned above that the conflict resolution code must satisfy. % Copyright (C) 2002-2005 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \section{Patch string formatting} Of course, in order to store our patches in a file, we'll have to save them as some sort of strings. The convention is that each patch string will end with a newline, but on parsing we skip any amount of whitespace between patches. \paragraph{Merger patches} Merge two patches. The MERGERVERSION is included to allow some degree of backwards compatibility if the merger algorithm needs to be changed. \begin{verbatim} merger MERGERVERSION <first patch> <second patch> \end{verbatim} \paragraph{Named patches} Named patches are displayed as a ``patch id'' which is in square brackets, followed by a patch. Optionally, after the patch id (but before the patch itself) can come a list of dependencies surrounded by angle brackets. Each dependency consists of a patch id. % Copyright (C) 2002-2005,2007-2008 David Roundy % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; see the file COPYING. If not, write to % the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. \chapter{DarcsRepo format} \label{repository_format} A repository consists of a working directory, which has within it a directory called \verb!_darcs!. There must also be a subdirectory within \verb!_darcs! named \verb!patches!. The \verb!patches! directory contains the actual patches which are in the repository. There must also be a \emph{pristine tree}, which may either be a directory containing a cache of the version of the tree which has been recorded, or a stub, and may be named either ``current'' or ``pristine''. \emph{WARNING!} Viewing files in the pristine cache is perfectly acceptable, but if you view them with an editor (e.g.\ vi or Emacs), that editor may create temporary files in the pristine tree (\verb|_darcs/pristine/| or \verb|_darcs/current/|), which will temporarily cause your repository to be inconsistent. So \emph{don't record any patches while viewing files in \_darcs/current with an editor!} A better plan would be to restrict yourself to viewing these files with a pager such as more or less. Also within \verb!_darcs! is the \verb!inventory! file, which lists all the patches that are in the repository. Moreover, it also gives the order of the representation of the patches as they are stored. Given a source of patches, i.e.\ any other set of repositories which have between them all the patches contained in a given repository, that repository can be reproduced based on only the information in the \verb!inventory! file. Under those circumstances, the order of the patches specified in the \verb!inventory! file would be unimportant, as this order is only needed to provide context for the interpretation of the stored patches in this repository. There is a very special patch which may be stored in \verb!patches! which is called `pending'. This patch describes any changes which have not yet been recorded, and cannot be determined by a simple diff. For example, file additions or renames are placed in pending until they are recorded. Similarly, token replaces are stored in pending until they are recorded. The \verb!_darcs! directory also contains a directory called ``\verb!prefs!'', which is described in Chapter~\ref{configuring}. \begin{comment} \section{Getting interesting info on change history} One can query the repository for the entire markup history of a file. This provides a data structure which contains a history of \emph{all} the revisions ever made on a given file. \end{comment} % This is the FSF GPL, reformatted as an appendix by David Roundy % This file is intended to be included in another file. \chapter{The GNU General Public License} \label{gpl} \section*{Version 2, June 1991} \begin{center} Version 2, June 1991 Copyright \copyright\ 1989, 1991 Free Software Foundation, Inc. \bigskip 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA \bigskip Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. \end{center} \section*{Preamble} \begin{quote} The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software---to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. \end{quote} \begin{center} {\Large \sc GNU General Public License \\\vspace{3mm}Terms and Conditions For Copying, Distribution and Modification} \end{center} \begin{enumerate} \addtocounter{enumi}{-1} \item This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The ``Program'', below, refers to any such program or work, and a ``work based on the Program'' means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term ``modification''.) Each licensee is addressed as ``you''. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. \item You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. \item You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: \begin{enumerate} \item You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. \item You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. \item If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) \end{enumerate} These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. \item You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: \begin{enumerate} \item Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, \item Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, \item Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) \end{enumerate} The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. \item You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. \item You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. \item Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. \item If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. \item If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. \item The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and ``any later version'', you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. \item If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. \begin{center} {\Large\sc No Warranty } \end{center} \item {\sc Because the program is licensed free of charge, there is no warranty for the program, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide the program ``as is'' without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program is with you. Should the program prove defective, you assume the cost of all necessary servicing, repair or correction.} \item {\sc In no event unless required by applicable law or agreed to in writing will any copyright holder, or any other party who may modify and/or redistribute the program as permitted above, be liable to you for damages, including any general, special, incidental or consequential damages arising out of the use or inability to use the program (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the program to operate with any other programs), even if such holder or other party has been advised of the possibility of such damages.} \end{enumerate} \begin{center} {\Large\sc End of Terms and Conditions} \end{center} \section{Appendix: How to Apply These Terms to Your New Programs} If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the ``copyright'' line and a pointer to where the full notice is found. \begin{quote} $<$one line to give the program's name and a brief idea of what it does.$>$ \\ Copyright (C) $<$year$>$ $<$name of author$>$ \\ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. \end{quote} Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: \begin{quote} Gnomovision version 69, Copyright (C) $<$year$>$ $<$name of author$>$ \\ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. \\ This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. \end{quote} The hypothetical commands {\tt show w} and {\tt show c} should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than {\tt show w} and {\tt show c}; they could even be mouse-clicks or menu items---whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a ``copyright disclaimer'' for the program, if necessary. Here is a sample; alter the names: \begin{quote} Yoyodyne, Inc., hereby disclaims all copyright interest in the program \\ `Gnomovision' (which makes passes at compilers) written by James Hacker. \\ $<$signature of Ty Coon$>$, 1 April 1989 \\ Ty Coon, President of Vice \end{quote} This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. \end{document}