@@ -1,24 +1,28 @@
11---
2−navhome: /docs
3−next: true
2+navhome: '/docs'
3+next: True
44sort: 6
55title: Filesystem
66---
77
88# Filesystem (`%clay`)
99
10−<div class="row"> <div class="col-md-8">
10+<div class="row">
1111
12−Urbit has its own revision-controlled filesystem, `%clay`. `%clay` is
13−a typed, global, referentially transparent namespace. An easy way to
14−think about it is like typed `git` with continuous sync.
12+<div class="col-md-8">
1513
16−The most common way to use `%clay` is to mount a `%clay` node in a
17−Unix directory. The Urbit process will watch this directory and
18−automatically record edits as changes, Dropbox style. The mounted
19−directory is always at the root of your pier directory.
14+Urbit has its own revision-controlled filesystem, `%clay`. `%clay` is a
15+typed, global, referentially transparent namespace. An easy way to think
16+about it is like typed `git` with continuous sync.
2017
21−</div> </div>
18+The most common way to use `%clay` is to mount a `%clay` node in a Unix
19+directory. The Urbit process will watch this directory and automatically
20+record edits as changes, Dropbox style. The mounted directory is always
21+at the root of your pier directory.
22+
23+</div>
24+
25+</div>
2226
2327## Quickstart
2428
@@ -28,14 +32,13 @@ Create a `%sandbox` desk based on the `%home` desk:
2832
2933 |merge %sandbox ~your-urbit %home
3034
31−Most of the time we want to use `%clay` from Unix.
35+Most of the time we want to use `%clay` from Unix.
3236
3337Mount the entire contents of your `sandbox` desk to Unix:
3438
3539 ~your-urbit:dojo> |mount /=sandbox=
3640
37−To explore the filesystem from inside Urbit `+ls` and `+cat` are
38−useful:
41+To explore the filesystem from inside Urbit `+ls` and `+cat` are useful:
3942
4043 ~your-urbit:dojo> +ls /=sandbox=/web
4144
@@ -50,37 +53,41 @@ Sync from your friend `~some-ship`'s `%experiment` desk to your
5053
5154## Manual
5255
53−<h3 class="first child">Paths</h3>
56+<h3 class="first child">
57+Paths
58+</h3>
5459
55−A path in `%clay` is a list of URL-safe text, restricted to `[a
56−z]`,`[0 9]`, `.`, `-`, `_` and `~`. Formally this is a `(list knot)`
60+A path in `%clay` is a list of URL-safe text, restricted to
61+`[a z]`,`[0 9]`, `.`, `-`, `_` and `~`. Formally this is a `(list knot)`
5762where each segment is a `@ta`.
5863
5964Paths can be expressed as either `/foo/bar/baz` or `[%foo %bar %baz]`.
6065The first three segments of an urbit path are `/plot/desk/case`, for
61−example `/~doznec/home/1`.
66+example `/~dozbud/home/1`.
6267
6368#### Relative paths
6469
6570Relative paths are expressed using `%` which is roughly equivalent to
66−Unix `.`. `%%` is `..` and `%%%` is what you would expect `...` to
67−be. There are no local relative paths. `foo/bar` must be written
71+Unix `.`. `%%` is `..` and `%%%` is what you would expect `...` to be.
72+There are no local relative paths. `foo/bar` must be written
6873`%/foo/bar`.
6974
7075#### Substitution
7176
7277If the default path is `/foo/bar/baz`, `/=/moo` means `/foo/moo`, and
73−`/=/moo/=/goo` means `/foo/moo/baz/goo`. Also, instead of `/=/=/zoo`
74−or `/=/=/=/voo`, write `/==zoo` or `/===voo`.
78+`/=/moo/=/goo` means `/foo/moo/baz/goo`. Also, instead of `/=/=/zoo` or
79+`/=/=/=/voo`, write `/==zoo` or `/===voo`.
7580
76−Most commonly this is used to avoid having to know the current
77−revision number in the `dojo`. Instead of writing
81+Most commonly this is used to avoid having to know the current revision
82+number in the `dojo`. Instead of writing
7883`/~your-urbit/home/4/path/to/file` you can just write
7984`/=home=/path/to/file`.
8085
8186### Revision-control
8287
83−<h3 class="first child"><code>|mount clay-path [unix-name]</code></h3>
88+<h3 class="first child">
89+<code>|mount clay-path [unix-name]</code>
90+</h3>
8491
8592Mount the `clay-path` at the unix mount point `unix-name`.
8693
@@ -108,44 +115,44 @@ Unmounts the path `%/web` from whatever name it was mounted as.
108115
109116Unmounts the Unix path `/generators`.
110117
111−### `|merge desk beak [strategy]`
118+### `|merge desk beak[, =gem strategy]`
112119
113120Merges a `beak` into a `desk` using an optional merge `strategy`.
114121
115−A `beak` is either a desk (`%home`), a plot-desk cell (`[~doznec
116−%home]`), or a plot-desk-case (`/~doznec/home/2/web/md`)
122+A `beak` is a ship-desk-case triple, encoded as a
123+path(`/~dozbud/home/2`)
117124
118125**Examples:**
119126
120− |merge %home-work /=home= %fine
127+ |merge %home-work /=home=, =gem %fine
121128
122129Merge `/=home=` into `%home-work` using merge strategy `%fine`.
123130
124− |merge %examples [~wacbex-ribmex %examples]
131+ |merge %examples ~wacbex-ribmex %examples
125132
126133Merge the `%examples` desk from `~waxbex-ribmex`
127134
128135### `|sync desk plot [plot-desk]`
129136
130137Subscribe to continuous updates from remote `plot` on local `desk`.
131−`plot-desk` can specify the remote `desk` name. When omitted it's
132−assumed to be the same as `desk`. Moons have `|sync %home ~parent
133−%kids` automatically set up (where `~parent` is the planet that issued
134−the moon).
138+`plot-desk` can specify the remote `desk` name. When omitted it is
139+defaulted to being the same as `desk`. Non-comet urbits have
140+`|sync %home ~parent %kids` automatically set up (where `~parent` is the
141+planet that issued a moon, the star that issued a planet, or the galaxy
142+that issued a star).
135143
136144**Examples:**
137145
138− |sync %home-local ~doznec %home |sync %home ~doznec
146+ |sync %home-local ~dozbud %home |sync %home ~doznec
139147
140148### `|unsync desk plot [plot-desk]`
141149
142150Unsubscribe from updates from remote `plot` on local `desk` with
143−optional `plot-desk`. Arguments must match original `|sync` command
144−exactly.
151+optional `plot-desk`. Arguments must match original `|sync` command.
145152
146153Example:
147154
148− |unsync %home-local ~doznec %home
155+ |unsync %home-local ~dozbud %home
149156
150157### `|label desk name`
151158
@@ -157,84 +164,82 @@ Example:
157164
158165### Merge strategies
159166
160−`%init` - Used if it's the first commit to a desk. Also can be
161−used to "reinitialize" a desk -- revision numbers keep going up,
162−but the new revision isn't necessarily a descendent of the
163−previously-numbered version.
167+`%init` - Used if it's the first commit to a desk. Also can be used to
168+"reinitialize" a desk -- revision numbers keep going up, but the new
169+revision isn't necessarily a descendent of the previously-numbered
170+version, allowing merges to be rerun.
164171
165172`%this` - Keep what's in Bob's desk, but join the ancestry.
166173
167174`%that` - take what's in Alice's desk, but join the ancestry. This is
168−the reverse of `%this`. This is different from `%init` because
169−the new commit has both sides in its ancestry.
175+the reverse of `%this`. This is different from `%init` because the new
176+commit has both sides in its ancestry.
170177
171178`%fine` - "fast-forward" merge. This succeeds iff one head is in the
172179ancestry of the other.
173180
174−`%meet`, `%mate`, and `%meld` - find the most recent common ancestor
175−to use as our merge base.
181+`%meet`, `%mate`, and `%meld` - find the most recent common ancestor to
182+use as our merge base.
176183
177184A `%meet` merge only succeeds if the changes from the merge base to
178−Alice's head (hereafter, "Alice's changes") are in different files
179−than Bob's changes. In this case, the parents are both Alice's and
180−Bob's heads, and the data is the merge base plus Alice's changed files
181−plus Bob's changed files.
185+Alice's head (hereafter, "Alice's changes") are in different files than
186+Bob's changes. In this case, the parents are both Alice's and Bob's
187+heads, and the data is the merge base plus Alice's changed files plus
188+Bob's changed files.
182189
183190A `%mate` merge attempts to merge changes to the same file when both
184−Alice and Bob change it. If the merge is clean, we use it; otherwise,
185−we fail. A merge between different types of changes -- for example,
191+Alice and Bob change it. If the merge is clean, we use it; otherwise, we
192+fail. A merge between different types of changes -- for example,
186193deleting a file vs changing it -- is always a conflict. If we succeed,
187−the parents are both Alice's and Bob's heads, and the data is the
188−merge base plus Alice's changed files plus Bob's changed files plus
189−the merged files.
194+the parents are both Alice's and Bob's heads, and the data is the merge
195+base plus Alice's changed files plus Bob's changed files plus the merged
196+files.
190197
191198A `%meld` merge will succeed even if there are conflicts. If there are
192−conflicts in a file, then we use the merge base's version of that
193−file, and we produce a set of files with conflicts. The parents are
194−both Alice's and Bob's heads, and the data is the merge base plus
195−Alice's changed files plus Bob's changed files plus the successfully
196−merged files plus the merge base's version of the conflicting files.
197−
198−`%auto` - meta-strategy. Check to see if Bob's desk exists, and if it
199−doesn't we use an `%init` merge. Otherwise, we progressively try
200−`%fine`, `%meet`, and `%mate` until one succeeds. If none succeed, we
201−merge Bob's desk into a scratch desk. Then, we merge Alice's desk
202−into the scratch desk with the `%meld` option to force the merge.
203−Finally, we annotate any conflicts, if we know how.
199+conflicts in a file, then we use the merge base's version of that file,
200+and we produce a set of files with conflicts. The parents are both
201+Alice's and Bob's heads, and the data is the merge base plus Alice's
202+changed files plus Bob's changed files plus the successfully merged
203+files plus the merge base's version of the conflicting files.
204+
205+`%auto` - meta-strategy. Check to see if Bob's desk exists, and if it
206+doesn't we use an `%init` merge. Otherwise, we progressively try
207+`%fine`, `%meet`, and `%mate` until one succeeds. If none succeed, we
208+merge Bob's desk into a scratch desk. Then, we merge Alice's desk into
209+the scratch desk with the `%meld` option to force the merge. Finally, we
210+annotate any conflicts, if we know how.
204211
205212### Manipulation
206213
207−<h3 class="first child"><code>|rm path</code></h3>
214+<h3 class="first child">
215+<code>|rm path</code>
216+</h3>
208217
209−Remove the data at `path`. `path` must be a path to actual node, not
210−a 'directory'
218+Remove the data at `path`. `path` must be a path to actual node, not a
219+'directory'
211220
212−### `|cp to from how`
221+### `|cp to from`
213222
214−Copy the subtree `from` into the subtree `to`, committing it with the
215−specified merge strategy `how`.
223+Copy the file at `from` into the path `to`.
216224
217−#### `|mv to from how`
225+#### `|mv to from`
218226
219−Move the subtree `from` into the subtree `to`, committing it with the
220−specified merge strategy `how`.
227+Move the file at `from` into the path `to`.
221228
222−In `%clay`, `|mv` is just a shorthand for `|cp` then `|rm`. The `|rm`
229+In `%clay`, `|mv` is just a shorthand for `|cp` then `|rm`. The `|rm`
223230doesn't happen unless the `|cp` succeeds.
224231
225232### Generators
226233
227−<h3 class="first child"><code>+cat path</code> / <code>+cal [path
228−...]</code></h3>
229−
230−Similar to Unix `cat`. `+cat` takes a single `path`, `+cal` a list of
231−paths.
234+<h3 class="first child">
235+<code>+cat path [path ...]</code>
236+</h3>
232237
233−Produces the contents of the file at the given `path`.
238+Similar to Unix `cat`. `+cat` takes one or more `path`s, and prints
239+their contents.
234240
235−### `+ls path` / `+ll [path ...]`
241+### `+ls path`
236242
237−Similar to Unix `ls`. `+ls` takes a single `path`, `+ll` a list of
238−paths.
243+Similar to Unix `ls`. `+ls` takes a single `path`.
239244
240245Produces a list of names at the `path`.