~jan0sch/darcs-book
Showing details for patch 68d64cce17add5e264182d0ad20e9b3ba82dfa93.
diff -rN -u old-darcs-book/en/02-getting-started.md new-darcs-book/en/02-getting-started.md --- old-darcs-book/en/02-getting-started.md 2024-11-24 01:43:15.897497800 +0000 +++ new-darcs-book/en/02-getting-started.md 2024-11-24 01:43:15.897497800 +0000 @@ -11,40 +11,47 @@ It's somewhat important to speak the same language when we are talking about a topic like version control so we need to establish a common vocabulary first. Don't worry, it won't be much and I'll be introducing new terms as we are going -along. But here are the basic terms you need to know. +along, but here are the basic terms you need to know. Some of these definitions +might suffer a bit from being mutually recursive so if you don't get it right +away, don't worry it'll all become a lot clearer once you start using `darcs`. -* Working Directory +* **Working Tree** - This is the directory where our project files reside, all work is done here. + This is the directory tree where our project files reside, all work is done + here. -* Repository +* **Repository** We already talked a bit about this but let's keep our most basic terms in one place. A repository is a place where `darcs` stores information about a - project's history. As our working directory changes through time we can record + project's history. As our working tree changes through time we can record patches that represent those changes and store them in our repository together with additional information like, what changed, who did the changes and when. -* Change +* **Change** - A change is a logical modification that we have done to our project. These can - be something like adding or removing a file, changing the content of a file, - moving a file from one place to another etc. + A change is a modification that we have done to our working tree. It can be + something like adding or removing a file, changing the content of a file, + moving a file from one place to another etc. To find out if something has + changed in our working tree, `darcs` checks its contents against the state of + the repository. -* Patch +* **Patch** - A patch is how we represent a change. Whenever we want to remember a change we - do this by recording a patch. A patch takes a repository from one state to - another. + A patch is how we represent changes. Whenever we want to remember changes we + do this by recording a patch. A patch is made up out of one or more changes + and takes a repository from one state to another. -**The state of a repository is defined by a set of changes.** +Knowing this we can now formulate the statement: + +> **The state of a repository is defined by a set of changes.** Whoa, hold on a second! That sounds pretty mathematical, and that's because it is. But don't worry, the ideas we are dealing with here can be expressed in simple ways. In mathematics we have the notion of a set. Something like -*{1,2,3}* denotes a set containing those three numbers, *1*, *2* and *3*. When +`{1,2,3}` denotes a set containing those three numbers, `1`, `2` and `3`. When we are talking about sets the order of their elements do not matter. So we can -think of *{1,2,3}* and *{3,1,2}* as being different denotions of the same set. +think of `{1,2,3}` and `{3,1,2}` as being different denotations of the same set. In `darcs` the order of the changes do not matter, when you have the same set of changes as someone else you will both arrive at the same repository state, it doesn't matter in which order you acquired them. @@ -53,23 +60,54 @@ Let `A` be a change that adds a file `foo` to our project and let `B` be a change that adds a file `bar` to our project. These two changes are independent -of each other so we can pull them into our repository in any order. So adding -`A` and then `B` to our repository gets us to the same place as adding `B` and -then `A`. Maybe you remember this from school where you learn that 1 + 2 is the -same thing as 2 + 1. `darcs` applies this concept to patches and it's called -**commutation** and it vital to the way `darcs` works. In our example we say -that "`A` and `B` commute" which basically means that the patch sequence `AB` -(first apply `A` than `B`) gets us to the same place as the sequence `BA`. +of each other, meaning each of them can exist without the other, so we can pull +them into our repository in any order. So adding `A` and then `B` to our +repository gets us to the same place as adding `B` and then `A`. Maybe you +remember this from school where you have learn that `1 + 2` is the same thing as +`2 + 1`. `darcs` applies this concept to patches and it's called **commutation** +and it vital to the way `darcs` works. In our example we say that "`A` and `B` +commute" which basically means that the patch sequence `AB` (first apply `A` +than `B`) gets us to the same place as the sequence `BA`. + +Installing `darcs` +------------------ + +If you are running a Unix or a Unix-like operating system. You should be able to +install `darcs` via your package manager. Since `darcs` is written in Haskell, +you can also install it using [stack](https://haskellstack.org) or +[cabal](https://hackage.haskell.org/package/cabal-install) by doing one of the +following. + +``` +$ stack install darcs +``` + +or + +``` +$ cabal install darcs +``` + +I would only recommend this when your package manager does not offer a recent +version of `darcs` or if it is not available. + +Please consult your operating system or package manager manual to find out how +to install either `darcs`, `stack` and/or `cabal`. + +Once you have `darcs` installed you can use `darcs --version` to find out what +version you are currently using. Using the `darcs` command line interface ---------------------------------------- `darcs` is used via a command line interface, that means you are interacting -with is by issuing commands on the shell. If you already used other version -control systems this might worry you a bit, but don't be afraid. `darcs` has a -very friendly user interface that leaves little room for unpleasant surprises. -One major feature is that most of the commands are interactive. Let me give you -an example. +with it by issuing commands on the shell. If you already have used other version +control systems where you mostly interact with them using fancy graphical user +interfaces this might worry you a bit, but don't be afraid. `darcs` has a very +friendly user interface that leaves little room for unpleasant surprises. One +major feature is that most of the commands offer an interactive mode, and most +of the time it's even the commands default to do things interactively. Let me +give you an example. Let's say I want to `rollback` (it's not important to understand what that means exactly, we'll get to that later) a change, to do that I would simply issue the @@ -79,7 +117,7 @@ ``` $ darcs rollback patch eec36aaa61a4fad924657cd86624ba162991860d -Author: raichoo +Author: raichoo@example.com Date: Mon Jun 18 12:32:34 CEST 2018 * fish: add move color to darcs prompt Shall I rollback this patch? (1/253) [ynW...], or ? for more options: @@ -118,9 +156,12 @@ <Space>: accept the current default (which is capitalized) ``` -Great! Everything you need, right at your fingertips! You don't need to reach -for a reference or deep dive into the documentation to get the job done. - `darcs` also comes with a built-in help system. So if you want to know what `rollback` does you can simple issue `darcs help rollback` or `darcs rollback --help` and there you go, you get the manual for the `rollback` command. + +If you just want to have a list of all available commands with a +short description of their functionality `darcs help` is your friend. + +Great! Everything you need, right at your fingertips! You don't need to reach +for a reference or deep dive into the documentation to get the job done.