Skip to content

Commit

Permalink
update to jj 0.15.1
Browse files Browse the repository at this point in the history
  • Loading branch information
steveklabnik committed Mar 17, 2024
1 parent caefada commit 1adbb71
Show file tree
Hide file tree
Showing 9 changed files with 102 additions and 24 deletions.
3 changes: 0 additions & 3 deletions src/advanced/simultaneous-edits.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ After fetching changes, our log looks like this:
```console
> jj git fetch
> jj log
> jj log
@ xqkmpxlq [email protected] 2024-03-17 15:18:11.000 -05:00 fccf0626
│ (empty) (no description set)
◉ xnutwmso [email protected] 2024-03-17 15:16:36.000 -05:00 da67dfe1
Expand Down Expand Up @@ -571,6 +570,4 @@ the tools you already know to do something completely different! We're going to
talk about a slightly different workflow next: "stacked pull requests". They're
similar in some ways to this approach, but there's also some differences too.



[my open PR]: https://github.com/steveklabnik/jj-hello-world/pull/1
23 changes: 23 additions & 0 deletions src/branching-merging-and-conflicts/anonymous-branches.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,29 @@ Excellent. We've got two different changes, `yykpmnuq` and `xrslwzvq`, both with
the parent `ootnlvpt`. Sucess! We have created a branch. And we didn't need to
name it.

Let's edit `src/main.rs` to update this description:

```rust
/// A "Hello, world!" program.
///
/// This is the best implementation of this program to ever exist.

fn main() {
print_hello();
print_goodbye();
}

fn print_hello() {
println!("Hello, world!");
}

fn print_goodbye() {
println!("Goodbye, world!");
}
```

This is pretty silly, but we'll use it further along in the tutorial.

We can see that there's a branch in the output of `jj log`:

```console
Expand Down
18 changes: 15 additions & 3 deletions src/branching-merging-and-conflicts/conflicts.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ And then update `src/main.rs` appropriately:
/// This is the best implementation of this program to ever exist.

fn main() {
print_hello();
}

fn print_hello() {
println!("Hello, world!");
}
```
Expand All @@ -39,11 +43,19 @@ state it was before we made our other change:

```rust
/// A "Hello, world!" program.
///
///
/// This is the best implementation of this program to ever exist.

fn main() {
print_hello();
print_goodbye();
}

fn print_hello() {
println!("Hello, world!");
}

fn print_goodbye() {
println!("Goodbye, world!");
}
```
Expand Down Expand Up @@ -188,8 +200,8 @@ fn main() {
print("Hello, world!");
print("Goodbye, world!");
%%%%%%%
println!("Hello, world!");
- println!("Goodbye, world!");
print_hello();
- print_goodbye();
>>>>>>>
}

Expand Down
5 changes: 2 additions & 3 deletions src/branching-merging-and-conflicts/revsets.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ Now we can understand `heads(all())` from before: these are two functions, where
we're asking for the head commits of every commit in the repository.

Revsets are very powerful, and very convenient. Would you like to find every
commit by `steveklabnik` containing the world "print" in the description? Try
this:
commit by me containing the world "print" in the description? Try this:

```console
$ jj log -r 'author(steveklabnk) & description(print)'
$ jj log -r 'author(Steve Klabnik) & description(print)'
```

Another really useful revset function is `trunk()`:
Expand Down
6 changes: 6 additions & 0 deletions src/hello-world/describing-commits.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ Working copy now at: yyrsmnoo 524d2bf4 hello world
Parent commit : zzzzzzzz 00000000 (empty) (no description set)
```

(You may notice that the change ID changed here: that's just some book-writing
magic. I am editing this book manually, and so may make adjustments that end up
giving you different change IDs and commit IDs than I do. You'll figure it out,
just match the output of your commands to the inputs you give and you'll be
fine.)

Our message, `hello world`, has replaced the `(no description set)` text. We're
gonna be able to see this whenever we look at our repository history.

Expand Down
6 changes: 3 additions & 3 deletions src/hello-world/how-to-install.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# How to install `jj`

This tutorial is written when `jj` is at version 0.14.0. It may work for
This tutorial is written when `jj` is at version 0.15.1. It may work for
later versions, but you also may need to adapt.

For the full range of ways to install `jj`, you can visit the [Installation and
Setup][install] page of the official documentation. Personally, because I am
a Rust developer, and `jj` is written in Rust, I installed my copy like this:

[install]: https://martinvonz.github.io/jj/v0.14.0/install-and-setup/
[install]: https://martinvonz.github.io/jj/v0.15.0/install-and-setup/

```console
$ cargo install jj-cli@0.14.0 --locked
$ cargo install jj-cli@0.15.1 --locked
```

If you're not a Rust developer, please read the documentation to figure out how
Expand Down
36 changes: 29 additions & 7 deletions src/hello-world/viewing-the-current-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,34 @@ We can view the status of our repository with `jj st`. Let's run that now:

```console
$ jj st
```

![a screenshot of jj st](../images/jj-st.png)

This is the `jj` "pager", a program that shows the ouput of commands, and lets
you scroll through them if they get really long. You can hit `q` to get back to
your console.

You can request to not use the pager by using `jj st --no-pager`, or if you hate
the pager and want to turn it off, you can configure that with

```console
$ jj config set --user ui.paginate never
```

I am going to present the examples in the book as if this is the configuration,
because managing text is easier than wrangling screenshots. The same information
ends up on the screen no matter which way you prefer. Speaking of, let's actually
talk about the output of `jj st`:

```console
$ jj st --no-pager
Working copy changes:
A .gitignore
A Cargo.lock
A Cargo.toml
A src\main.rs
Working copy : yyrsmnoo 5bd3561d (no description set)
Working copy : qzmzpxyl bc915fcd (no description set)
Parent commit: zzzzzzzz 00000000 (empty) (no description set)
```

Expand Down Expand Up @@ -41,27 +63,27 @@ copy (the files on disk) and takes a snapshot. So here, it's noticed that we've
`A`dded some new files. You'll also see `M`odified files, and `D`eleted files.

```text
Working copy : yyrsmnoo 5bd3561d (no description set)
Working copy : qzmzpxyl bc915fcd (no description set)
Parent commit: zzzzzzzz 00000000 (empty) (no description set)
```

Our brand new repo shows that we have two *changes*. You'll notice that the
text on the second one says "commit" there, and... yeah okay so: `jj` has a few
different concepts here. The first is a commit. Our two commits have the
identifiers `5bd3561d` and `00000000`. But there's also the idea of a "change,"
identifiers `bc915fcd` and `00000000`. But there's also the idea of a "change,"
and that's that in `jj`, commits can evolve over time. But we still need a
stable identifier to talk about those changes, so we have a "change ID," and
that's `yyrsmnoo` and `zzzzzzzz`. One really cool thing is that they use a
disjoint set of identifiers: `yyrsmnoo` can never be a commit ID, but must be
a change ID, and `5bd3561d` can never be a change ID, but must be a commit ID.
that's `qzmzpxyl` and `zzzzzzzz`. One really cool thing is that they use a
disjoint set of identifiers: `qzmzpxyl` can never be a commit ID, but must be
a change ID, and `bc914fcd` can never be a change ID, but must be a commit ID.
This is surprisingly handy.

Anyway, we'll talk more about commits and changes soon, and how they're
different, but first we should talk about the rest of the details here. The
first part is that each repository always has a `zzzzzzzz 00000000` change, and
it's always empty. This is called the "root commit" and it is the foundation of
the whole repository. Given that it's empty, `jj` has created a second change
based on top of it, in this case, `yyrsmnoo` and it is tracking the contents of
based on top of it, in this case, `qzmzpxyl` and it is tracking the contents of
the working copy. Since it's not empty, its line here doesn't have the `(empty)`
bit like our root change has.

Expand Down
Binary file added src/images/jj-st.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 24 additions & 5 deletions src/sharing-code/named-branches.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,34 @@ in `git` is that branches do not automatically move. For example, let's make a
new change:

```console
> jj log --limit 2
@ pzkrzopz [email protected] 2024-03-01 22:41:37.000 -06:00 fcf669c5
> jj new
Working copy now at: moxnkoxx 3f14c03f (empty) (no description set)
Parent commit : ytkvxlpy 7ec11c41 trunk | remove goodbye message
> jj log
@ moxnkoxx [email protected] 2024-03-17 17:10:57.000 -05:00 3f14c03f
│ (empty) (no description set)
◉ povouosx [email protected] 2024-03-01 18:12:43.000 -06:00 trunk f68d1623
│ ◉ qtlkpytx [email protected] 2024-03-17 17:09:25.000 -05:00 e6667f9e
├─╯ (empty) (no description set)
◉ ytkvxlpy [email protected] 2024-03-17 17:09:25.000 -05:00 trunk 7ec11c41
│ remove goodbye message
~
```

Even though `@` has moved to `pzkrzopz`, `trunk` is still at `povouosx`. This
Oh look, we have an extra empty commit lying around. That happens sometimes,
let's forget about it:

```console
> jj abandon qt
Abandoned commit qtlkpytx e6667f9e (empty) (no description set)
> jj log --limit 3
@ moxnkoxx [email protected] 2024-03-17 17:10:57.000 -05:00 3f14c03f
│ (empty) (no description set)
◉ ytkvxlpy [email protected] 2024-03-17 17:09:25.000 -05:00 trunk 7ec11c41
│ remove goodbye message
◉ krmulszn [email protected] 2024-03-17 17:06:59.000 -05:00 e98c1626
│ refactor printing
```

Even though `@` has moved to `moxnkoxx`, `trunk` is still at `ytkvxlpy`. This
behavior is a bit surprising for folks coming from `git`, though it fits in with
`jj` more nicely, I think.

Expand Down

0 comments on commit 1adbb71

Please sign in to comment.