just playing with tangled
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at tmp-tutorial 62 lines 3.3 kB view raw view rendered
1# Operation log 2 3 4## Introduction 5 6Jujutsu records each operation that modifies the repo in the "operation log". 7You can see the log with `jj op log`. Each operation object contains a snapshot 8of how the repo looked at the end of the operation. We call this snapshot a 9"view" object. The view contains information about where each branch, tag, and 10Git ref (in Git-backed repos) pointed, as well as the set of heads in the repo, 11and the current working-copy commit in each workspace. The operation object also 12(in addition to the view) contains pointers to the operation(s) immediately 13before it, as well as metadata about the operation, such as timestamps, 14username, hostname, description. 15 16The operation log allows you to undo an operation (`jj [op] undo`), which doesn't 17need to be the most recent one. It also lets you restore the entire repo to the 18way it looked at an earlier point (`jj op restore`). 19 20When referring to operations, you can use `@` to represent the current operation 21as well as the `-` operator (e.g. `@-`) to get the parent of an operation. 22 23 24## Concurrent operations 25 26One benefit of the operation log (and the reason for its creation) is that it 27allows lock-free concurrency -- you can run concurrent `jj` commands without 28corrupting the repo, even if you run the commands on different machines that 29access the repo via a distributed file system (as long as the file system 30guarantees that a write is only visible once previous writes are visible). When 31you run a `jj` command, it will start by loading the repo at the latest 32operation. It will not see any changes written by concurrent commands. If there 33are conflicts, you will be informed of them by subsequent `jj st` and/or 34`jj log` commands. 35 36As an example, let's say you had started editing the description of a change and 37then also update the contents of the change (maybe because you had forgotten the 38editor). When you eventually close your editor, the command will succeed and 39e.g. `jj log` will indicate that the change has diverged. 40 41 42## Loading an old version of the repo 43 44The top-level `--at-operation/--at-top` option allows you to load the repo at a 45specific operation. This can be useful for understanding how your repo got into 46the current state. It can be even more useful for understanding why someone 47else's repo got into its current state. 48 49When you use `--at-op`, the automatic snapshotting of the working copy will not 50take place. When referring to a revision with the `@` symbol (as many commands 51do by default), that will resolve to the working-copy commit recorded in the 52operation's view (which is actually how it always works -- it's just the 53snapshotting that's skipped with `--at-op`). 54 55As a top-level option, `--at-op` can be passed to any command. However, you 56will typically only want to run read-only commands. For example, `jj log`, 57`jj st`, and `jj diff` all make sense. It's still possible to run e.g. 58`jj --at-op=<some operation ID> describe`. That's equivalent to having started 59`jj describe` back when the specified operation was the most recent operation 60and then let it run until now (which can be done for that particular command by 61not closing the editor). There's practically no good reason to do that other 62than to simulate concurrent commands.