ok/jj
1
0
Fork 0
forked from mirrors/jj
Commit graph

529 commits

Author SHA1 Message Date
Christoph Koehler
7bde6ddc29 revset: add working_copies() function
It includes the working copy commit of every workspace of the repo.

Implements #3384
2024-04-01 19:36:53 -06:00
Yuya Nishihara
a2a9b7decb templater: add coalesce() function that selects first non-empty content
This can be used to flatten nested "if()"s. It's not exactly the same as "case"
or "switch" expression, but works reasonably well in template. It's not uncommon
to show placeholder text in place of an empty content, and a nullish value
(e.g. empty string, list, option) is usually rendered as an empty text.
2024-03-28 10:51:47 +09:00
Yuya Nishihara
b363e695e4 commit_templater: make git_head return Option<RefName> instead of Vec<_>
Since we've introduced Option type, it no longer makes sense that git_head
returns a Vec<RefName>.
2024-03-26 00:28:43 +09:00
Yuya Nishihara
96e0bc0bdd templater: turn logical && and || into short-circuiting operators
Since the context (or self) property is no longer passed by argument, it's easy
to implement short-circuiting behavior.
2024-03-25 11:15:18 +09:00
Yuya Nishihara
c311131ee2 log: encode elided node as None
Since elided graph entry has no associated commits, it makes some sense to
represent as None?
2024-03-24 10:32:15 +09:00
Yuya Nishihara
2fc7febaef commit_templater: teach elidable (or optional) commit
I think Option<Commit> is the simplest encoding of the log node.

The behavior of an Option type is closer to nullable types rather than the
Option in Rust. I don't think we would want to write opt.map(|x| x.f()) or
opt.unwrap().f(). We can of course add opt?.f() syntax, but it will be a short
for "if(opt, opt.f())"?
2024-03-24 10:32:15 +09:00
Anton Älgmyr
e2eb5bddf9 Make node symbols templatable in the graphs.
Adds config options
* templates.log_graph_node
* templates.log_graph_node_elided
* templates.op_log_graph_node
2024-03-21 17:41:31 +01:00
Martin von Zweigbergk
e51878f4fd cli: show timestamp in local timezone and without millis and offset
As discussed in #2900, the milliseconds are rarely useful, and it can
be confusing with different timezones because it makes harder to
compare timestamps.

I added an environment variable to control the timestamp in a
cross-platform way. I didn't document because it exists only for tests
(like `JJ_RANDOMNESS_SEED`).

Closes #2900
2024-03-20 07:54:08 -07:00
Matthew Davidson
e4053ead64 docs: Add missing "jj" to swap rebase example
`jj rebase -r C -d A; rebase -s B -d C` is missing the second jj.

Although it would be cool if jj had syntax to chain commands like this, so I could write a "swap" alias.
2024-03-19 05:58:52 -07:00
Tom Ward
933150d819 cli: allow colors in form #rrggbb
Changes the formatter to accept not only existing color names (such as "red" or
"green") but also those in the form #rrggbb, where rr, gg, and bb are two-digit
hexadecimal numbers. This allows much finer control over colors used.
2024-03-18 08:03:31 +00:00
Alexis (Poliorcetics) Bourget
f9f740b263 docs: mention the signing key can be a file path too 2024-03-15 20:34:08 +01:00
Khionu Sybiern
3bbc3e5715 docs: add FAQ for why to use new-then-amend over edit 2024-03-14 11:32:53 -07:00
Yuya Nishihara
218b1c6c16 commit_templater: add self.immutable() method
I don't know how immutable revisions should be labeled by default, but users
can customize templates whatever they like.
2024-03-14 22:59:43 +09:00
TrashCan
33911712a2 Add archlinux instructions to install-and-setup.md
based upon #3289 by @roland-5
2024-03-13 21:35:08 -07:00
mrstanwell
4d71ef1518 docs: Fix FAQ reference to glossary entry for co-located repos
In the FAQ question "How do I integrate Jujutsu with Gerrit?", the link
to the glossary entry for "co-located repos" was pointing to the entry
for "change-id".
2024-03-13 14:14:12 -07:00
Martin von Zweigbergk
e9655dba13 move: deprecate the command
Per discussion in
https://github.com/martinvonz/jj/discussions/2882. `jj squash` now has
all the functionality.
2024-03-11 09:25:17 -07:00
Martin von Zweigbergk
6d78d92d91 cli: move jj amend/unamend aliases to config
The `amend/unamend` aliases exist for smoothen onboarding for
Git/Mercurial users; I don't think we should recommend that users use
them, so I think it's fine if users override them as they
like. Therefore, I think they belong in the config.
2024-03-09 22:43:50 -08:00
Martin von Zweigbergk
2df977b221 docs: say that we support $GIT_DIR/info/exclude
We have had support for `GIT_DIR/info/exclude` since 8336c48 (almost
exactly two years ago).
2024-03-08 09:59:10 -08:00
Thomas Castiglione
d661f59f9d working_copy: implement symlinks on windows with a helper function
enables symlink tests on windows, ignoring failures due to disabled developer mode,
and updates windows.md
2024-03-05 15:16:38 +08:00
Austin Seipp
415ae5c0f9 docs: make it clear ui. refers to a toml section
There was a question on Discord about why using Difftastic wasn't working as the
diff tool. The root cause was putting `ui.diff.tool` in the wrong toml section,
when the `ui.` component actually refers to the `[ui]` section itself.

This reads kind of weirdly too because _immediately_ after this, the alternative
option of using the `merge-tools` section is suggested; except it uses `[merge-
tools.<name>]` which makes it immediately clear it's a section on its own.

This simply these two examples more consistent with each other, by using `[ui]`
instead of `ui.` to make it clear `ui.` is a top-level section.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-03-03 11:25:03 -06:00
Yuya Nishihara
78edb615a2 docs: update revset alias example to something very different from builtins
We've added mine() function, so this alias looks confusing.
2024-03-03 21:35:41 +09:00
Benjamin Tan
f135e09951 Docs: Add note about jj edit to Git comparison 2024-03-03 16:23:28 +08:00
Philip Metzger
494eba82b5 docs: Add a short section on branch movement.
This is something which should've been written down long ago. This is a follow-up upon 
another question from Julia Evans in Discord. 

Thank you again for asking such good questions.
2024-03-02 15:51:58 +01:00
Yuya Nishihara
82b3017fda templater: add string.len() and list.len() methods 2024-03-01 08:51:20 +09:00
Yuya Nishihara
0656409904 templater: make .substr() be byte-index based, round towards origin
I'm going to add string.len() method which will return a length in bytes. The
number of the UTF-8 code points is useless metrics, and strings here are often
ASCII bytes, so let's simply use byte indices in substr().

If the given index is not at a char boundary, it will be rounded. I considered
making it an error, but that would be annoying. I would want to see something
printed by author.name().substr() even if it contained latin characters.

I've extracted index normalization function which might be used by other string
methods. The remaining part of substr() is trivial, so inlined it.
2024-03-01 08:51:20 +09:00
Yuya Nishihara
7e127f500a docs: update remaining references on "jj init --git-repo" 2024-02-28 09:03:16 +09:00
Yuya Nishihara
8d0414549b cli: unblock "jj git init --colocate" in existing Git repo directory
I'm not sure what's the conclusion in #2747, but I don't think there is a
disagreement on allowing --colocate to import existing Git repo.
2024-02-28 09:03:16 +09:00
Stephen Jennings
6e29abb180 docs: add guidance for handling CRLF on Windows 2024-02-26 10:06:06 -08:00
Paulo Coelho
e9243a7638 cli branch list: list tracked branches
Add an option to list tracked branches only

This option keeps most of the current `--all` printing logic, but:

- Omits local Git-tracking branches by default (can be extended to
  support filtering by remote).
- Skip over the branch altogether if it doesn't contain tracked remotes
- Don't print the untracked_remote_refs at the end

Usage:

`jj branch list -t`
`jj branch list --tracked`
`jj branch list --tracked <branch name>`
2024-02-26 01:05:07 +00:00
Philip Metzger
5b0ef324d1 docs: Add a Testmonials page.
Show our positive reviews to the world. It's also not completly serious, in a similar fashion to
Phabricator.

Co-Authored-By: Austin Seipp <aseipp@pobox.com>
2024-02-25 14:20:33 +01:00
Yuya Nishihara
7525fac12a templater: add special "self" variable to refer to top-level object
This allows us to call alias function with the top-level object.

For convenience, all self.<method>()s are available as keywords. I don't think
we'll want to deprecate them. It would be tedious if we had to specify
-T'self.commit_id()' instead of -Tcommit_id.
2024-02-25 09:01:04 +09:00
Yuya Nishihara
ff37b07d90 docs: move template keywords list to corresponding types
I'm going to introduce the "self" variable, and it will make more sense to
document keywords as methods of the self object type.
2024-02-25 09:01:04 +09:00
Yuya Nishihara
e9b420f592 templater: add Operation type and methods
There are no keywords or methods that return Operation yet, but we might add
"self" keyword that returns the context object.
2024-02-23 10:13:25 +09:00
Julien Vincent
84685a4d71 sign: Update documentation 2024-02-20 00:02:08 +00:00
Alexis (Poliorcetics) Bourget
c75230747a completion: Add support for Nushell completions 2024-02-18 19:08:38 +01:00
Alexis (Poliorcetics) Bourget
fb10e3f296 completion: Update docs for new style with positional argument 2024-02-17 19:26:30 +01:00
Yuya Nishihara
815437598f revset: disable parsing rules of legacy dag range operator
The legacy parsing rules are turned into compatibility errors. The x:y rule
is temporarily enabled when parsing string patterns. It's weird, but we can't
isolate the parsing function because a string pattern may be defined in an
alias.
2024-02-14 10:04:56 +09:00
Martin von Zweigbergk
6ad49d232e cli: drop support for legacy graph style
I don't think anyone uses the legacy graph style. It's very similar to
the "ascii" style from Sapling's `renderdag` crate.
2024-02-12 17:33:55 -08:00
Benjamin Brittain
d3699c2327 Use minus as a builtin pager 2024-02-12 18:55:15 -05:00
Ilya Grigoriev
16ec185795 docs, CLI reference: use include-markdown instead of a symlink
The main goal is to avoid having a symlink in our source tree. Currently, there
is no good way to work with the `jj` repo with `jj` on Windows.  Currently `jj`
just crashes with symlinks. This is being worked on, see e.g. #2939, but it will
always depend on whether Developer Mode is enabled in Windows or whether
symlinks are materialized as text files with symlinks. Finally, MkDocs has
trouble following symlinks on Windows, so building docs wouldn't work there.

Another advantage is that, previously, we were lucky that MkDocs treats `insta`
header in `cli-reference@.md.snap` as a Markdown header and follows symlinks at
all. Now, we no longer depend on that.
2024-02-12 10:28:09 -08:00
Martin von Zweigbergk
7c5cfa7cc7 templater: add a local() method on Timestamps (#2900) 2024-02-12 10:22:24 -08:00
jyn
bca905a26e document the jj equivalent of git reset --soft
i did the following things:

1. make some changes to the working copy
2. run `jj commit`
3. before i added a description, i decided i didn't want to commit yet. in git, the way to do this is to delete the contents of the editor; git sees that it is blank and aborts the commit. in jj, this doesn't work, because descriptions are allowed to be empty.

now i have the following jj state:
```
; jj log --stat
@  pokrsyvs github@jyn.dev 2024-02-06 21:48:17.000 -05:00 ddd6217f
│  (empty) (no description set)
│  0 files changed, 0 insertions(+), 0 deletions(-)
◉  lqqmzmku github@jyn.dev 2024-02-06 21:48:02.000 -05:00 HEAD@git b03bf3de
│  (no description set)
│  config/jj.toml | 2 +-
│  1 file changed, 1 insertion(+), 1 deletion(-)
◉  xqkmwvwp github@jyn.dev 2024-02-06 21:47:08.000 -05:00 master b673f97b
```
i want to undo the most recent commit, `lqqmzmku`. i'm used to doing this with `git reset --soft HEAD~`, which makes the parent `xqkmwvwp` and leaves the change to `config/jj.toml` on disk while removing it from the git history; basically `lqqmzmku` would go back to being the working copy.

i found that `jj move` does what i want, but it took a lot of trawling the options, it wasn't obvious, and i couldn't find `git reset` mentioned in the docs.
2024-02-10 08:49:03 -08:00
Yuya Nishihara
e943a5b092 templater: parse negative integer as unary operator and literal
Follows up 9702a425e5 "Allow negative numbers in the template grammar."
Since we've added parsing rules for operator expressions, it makes sense to
parse unary '-' as operator.
2024-02-10 09:15:21 +09:00
Austin Seipp
5b517b542e rust: bump MSRV to 1.76.0
Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-02-09 15:48:01 -06:00
Austin Seipp
c8f703f14b docs: fix some automerge fallout
I enabled automerge for #2994, but forgot to actually *push* my changes
before resolving all the conversations, so GitHub insta-merged it.

This just addresses Ilya and Philip's final comments on #2994.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-02-09 12:36:28 -06:00
Austin Seipp
015c52bcdc docs: document git.fetch and git.push config options
Someone on Discord asked this exact question, but these options apparently
weren't documented when they were added in the `0.7.0` release.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-02-09 12:03:42 -06:00
Yuya Nishihara
948129e88f templater: evaluate logical operator expressions (||, &&, and !)
#2924
2024-02-09 07:42:54 +09:00
Martin von Zweigbergk
1be8225046 docs: explain that approving your coworker's PRs should be avoided
We want to avoid conflicts of interest (both real and
apparent). Better to document this before it happens.

By the way, Ilya and I both work for Google and we have approved lots
of each others' PRs, but we work in very different parts of the
company and I don't think any of the PRs have been specific to
Google's interests.
2024-02-06 21:34:58 -08:00
Chris Krycho
fc3283817d docs: Add FAQ item for git log
New users often want to know how to just see what `git log` would show.
Putting it in the FAQ isn’t perfect but might help a bit.
2024-02-06 15:03:51 -07:00
Yuya Nishihara
026a72dfe7 templater: add surround(prefix, suffix, content) function
I'll probably add infix logical operators later, but the surround() function
is still useful because we don't have to repeat the condition:

    if(x || y, "<" ++ separate(" ", x, y) ++ ">")
    surround("<", ">", separate(" ", x, y))

It can't be used if we want to add placeholder text, though:

    if(x || y, "<" ++ separate(" ", x, y) ++ ">", "(none)")

Closes #2924
2024-02-06 23:39:34 +09:00
Ilya Grigoriev
5dd938bc49 config.md: link to and mention the name of "scm-diff-editor" 2024-02-05 20:04:51 -08:00
Michael Pratt
f877dfbead docs: add co-located repo hint to Gerrit question
Working with Gerrit requires directly invoking git commands, which is awkward
without a co-located repo. Add a hint to use a co-located repo.
2024-02-05 22:39:54 +01:00
Ilya Grigoriev
0773cefe32 FAQ: Fix typo in and edit one of the entries 2024-02-04 13:32:11 -08:00
Austin Seipp
3f13ea39e2 cli: deprecate jj checkout
Summary: As discussed in Discord, on GitHub, and elsewhere, this change
deprecates the use of `jj checkout` and suggests users use `jj new` exclusively
instead. The verb `checkout` is a relic of a bygone era the — days of RCS
file locking, before 3-way merge — and is not a good, fitting name for the
functionality it provides.

To further drive the bit home, by default, `jj checkout` (and `jj co`) is now
hidden. This will hopefully stop new users from running into it.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: I7a1adfc9168fce1f25cf5d4c4c313304769e41a1
2024-02-03 17:21:56 -06:00
Ilya Grigoriev
b3c47953e8 config.md docs: document jj config edit and jj config path
This changes the intro section to recommend using `jj config edit` to
edit the config instead of looking for the files manually.
2024-02-02 23:29:58 -08:00
Daniel Ploch
01825953ac sparse-v2: design doc proposition for Sparse Patterns refactoring
Kicks off work on issue #1896
2024-02-01 16:02:14 -08:00
Ilya Grigoriev
fa123bbfee docs: emphasize and clarify log revsets relevant to people coming from git
I couldn't come up with a Git analogue of `jj log`, but I think it's OK
leaving it as a TODO makes the point. Perhaps somebody can figure it
out.

Also, all the correspondences are not completely precise, so I didn't
emphasize it every single time.
2024-01-31 15:51:40 -08:00
Ilya Grigoriev
52c415eaf4 docs: store output of jj util markdown-help, render it on the website
I am using a very hacky approach, using `insta` to generate the markdown help.
This is based on a lucky coincidence that `insta` chose to use a header
format for snapshot files that MkDocs interprets as a Markdown header (and
ignores).

I considered several other approaches, but I couldn't resist the facts that:

- This doesn't require new developers to install any extra tools or run any
extra commands.
- There is no need for a new CI check.
- There is no need to compile `jj` in the "Make HTML docs" GitHub action,
  which is currently very fast and cheap.

Downside: I'm not sure how well MkDocs will work on Windows, unless the
developer explicitly enables symbolic links (which IIUC is not trivial).

### Possible alternatives 

My next favorite approaches (which we could switch to later) would be:

#### `xtask`

Set up a CI check and a  [Cargo `xtask`]  so that `cargo xtask cli-help-to-md`
essentially runs `cargo run -- util markdown-help > docs/cli-reference.md` from
the project root.

Every developer would have to know to run `cargo xtask cli-help-to-md` if
they change the help text.

Eventually, we could have `cargo xtask preflight` that runs `cargo +nightly
fmt; cargo xtask cli-help-to-md; cargo nextest run`, or `cargo insta`.

#### Only generate markdown for CLI help when building the website, don't track it in Git.

I think that having the file in the repo will be nice to preview changes to
docs, and it'll allow people to consult the file on GitHub or in their repo.

The (currently) very fast job of building the website would now require
installing Rust and building `jj`. 

#### Same as the `xtask`, but use a shell script instead of an `xtask`

An `xtask` might seem like overkill, since it's Rust instead of a shell script.
However, I don't want this to be a shell script so that new contributors on
Windows can still easily run it ( since this will be necessary for the CI to
pass) without us having to support a batch file.

#### Cargo Alias

My first attempt was to set up a [cargo alias] to run this, but that doesn't
support redirection (so I had to change the `jj util` command to output to a
file) and, worse, is incapable of executing the command *in the project root*
regardless of where in the project the current directory is. Again, this seems
to be too inconvenient for a command that every new PR author would have to run
to pass CI.

Overall, this just seems a bit ugly. I did file
https://github.com/rust-lang/cargo/issues/13348, I'm not really sure that was
worthwhile, though.

**Aside:** For reference, the alias was:
    
```toml
# .cargo/config.toml
alias.gen-cli-reference = "run -p jj-cli -- util markdown-help docs/cli-reference.md"
```

### Non-alternatives 

#### Clap's new feature

`clap` recently obtained a similarly-sounding feature in
https://github.com/clap-rs/clap/pull/5206. However, it only prints short help
for subcommands and can't be triggered by an option AFAICT, so it won't help us
too much.

[Cargo `xtask`]: https://github.com/matklad/cargo-xtask
[cargo alias]: https://doc.rust-lang.org/cargo/reference/config.html#alias
2024-01-30 14:58:32 -08:00
Stephen Jennings
b2800f7f44 docs: add notes for Windows users 2024-01-29 12:16:15 -08:00
Philip Metzger
068f511b3f FAQ: Make a question clearer.
It seems that "amended" is not clear enough for users. So use simpler terms.

Suggestion from ilyagr in [Discord](https://discord.com/channels/968932220549103686/1201196831653236756/1201268055678931147).
2024-01-29 20:42:26 +01:00
Ilya Grigoriev
69bc1f2b0f docs branches.md: insert definitions for related terms 2024-01-24 18:47:17 -08:00
Ilya Grigoriev
5eb55b035e docs branches.md: updates to jj branch (un)track docs 2024-01-24 18:47:17 -08:00
Ilya Grigoriev
ef23c35550 docs branches.md: explain the new defaults and reorganize
This follows up on #2625 and updates all sections of `branches.md` to represent
the new default of `git.auto-local-branch=false`.

I realized that the paragraph we discussed for so long with @PhilipMetzger
actually repeats information that was already present a bit earlier in the file.
So, I removed most of it and moved the rest. Sorry I didn't notice this earler.

## The callout

Unfortunately, GitHub and MkDocs use different syntax for admonitions.

The callout looks like this in MkDocs:
https://github.com/martinvonz/jj/assets/4123047/45d79e7a-35db-492e-a227-004b7e3383c1

Use `poetry run -- mkdocs serve` to double-check.
2024-01-24 18:47:17 -08:00
Martin von Zweigbergk
63c4de3cf7 docs: try to clarify that jj doesn't need a staging area
Wol on lwn.net pointed out that our current description in the Git
Comparison doc for why there is no staging area can be interpreted as
saying that it's because it simplifies the CLI. It took me a while to
see that interpretation, but it makes sense to me now. This patch
tries to clarify that we have better tools than the staging area for
manipulating commits.
2024-01-22 15:47:24 -08:00
Martin von Zweigbergk
fc2b595098 git-comparison: explain why equivalent of git stash is not needed
Someone felt that our "Not needed" sounded dismissive. This patch
tries to clarify that it's the *command* (not the use case) we
consider not needed.
2024-01-21 21:13:19 -08:00
Ilya Grigoriev
0e817f7576 docs contributing.md: document using mold linker with nextest
On my machine, this halves the time taken by `cargo insta test --workspace
--test-runner nextest`.

I don't believe there would be a worthwhile improvement when not
using `nextest`. I also documented how to tell whether using `mold`
is worthwhile.

I was reminded of this by https://github.com/martinvonz/jj/pull/2858.
2024-01-21 19:28:37 -08:00
Martin von Zweigbergk
ed3c95cde6 docs: clarify that while named branches are not needed, they are supported
The "No need for branch names" can be interpreted as implying that we
don't support named branches, which is of course not true. Try to
clarify it.
2024-01-20 08:33:28 -08:00
Martin von Zweigbergk
41db64e63c cli: give root operation special treatment in template (like root commit) 2024-01-14 10:15:14 -08:00
Valentin Gatien-Baron
8783a05551 doc: suggest ripgrep as an equivalent of git grep
Sadly, ripgrep won't honor the .gitignore files in the absence of a
.git directory, so we need to pass an annoying flag (for non-colocated
repos).

That seems worth adding despite the existing suggestion, because rg is
faster, and for existing users for rg, it would teach them how to make
rg work as expected.
2024-01-12 17:01:14 -05:00
Valentin Gatien-Baron
f0dd311354 docs: add git comparison for jj workspace root
To make the jj command more discoverable.
2024-01-11 07:45:13 -05:00
vwkd
e41ef56e83 docs: update CLI output in Tutorial 2024-01-08 19:59:59 +04:00
Yuya Nishihara
614b289ff5 docs: reorder and partially rewrite remote branches section to reflect changes
The <branch name>@<remote name> explanation is moved to the top because
otherwise it's uneasy to introduce a "tracking" concept.
2024-01-04 10:57:27 +09:00
Philip Metzger
a6e1bc8309 docs: Add branch tracking to branches.md.
This tries to explain Jujutsu's branch tracking for a newcomer. 
It is based on it's design doc in `docs/design/tracking-branches.md`.
2024-01-02 22:14:01 +01:00
Yuya Nishihara
3eafca65ea op_walk: add support for op_id+ (children) operator
A possible use case is when doing some archaeology around a certain operation.

The current implementation is quadratic if + is repeated. Suppose op_id is
usually close to the current op heads, I think it'll practically work better
than building a reverse lookup table.
2024-01-02 10:30:08 +09:00
Philip Metzger
c2973fdf9a FAQ: Describe how to integrate with Gerrit.
This question is mildly popular on Discord so it's finally time to have an answer.

We should do something better in the future but the current solution is good enough for today.

cc @thoughtpolice
2024-01-01 21:08:19 +01:00
Gabriel Scherer
dafc900cca git comparison: include a 'git grep' equivalent 2023-12-21 00:20:45 +01:00
Ilya Grigoriev
9a990ad92f docs config.md Vim instructions: link to the Wiki instead of a gist 2023-12-17 22:16:02 -08:00
Yuya Nishihara
87a8238bee git: turn git.auto-local-branch off by default
As far as I can see in the chat, there's no objection to changing the default,
and git.auto-local-branch = false is generally preferred.

docs/branches.md isn't updated as it would otherwise conflict with #2625. I
think the "Remotes" section will need a non-trivial rewrite.

#1136, #1862
2023-12-17 08:30:24 +09:00
Yuya Nishihara
5a466cab4c cli: ensure default remote branch is imported by "git clone"
I originally thought this would be unavoidable, but I was wrong. "jj git clone"
doesn't implicitly create any local branch if git.auto-local-branch is off, and
that's fine because the detached HEAD state is normal in jj.

That being said, Git users would expect that the main/master branch exists.
Since importing the default branch is harmless, let's create and track it no
matter if git.auto-local-branch is off.
2023-12-16 16:02:10 +09:00
Martin von Zweigbergk
1cc271441f gc: implement basic GC for Git backend
This adds an initial `jj util gc` command, which simply calls `git gc`
when using the Git backend. That should already be useful in
non-colocated repos because it's not obvious how to GC (repack) such
repos. In my own jj repo, it shrunk `.jj/repo/store/` from 2.4 GiB to
780 MiB, and `jj log --ignore-working-copy` was sped up from 157 ms to
86 ms.

I haven't added any tests because the functionality depends on having
`git` binary on the PATH, which we don't yet depend on anywhere
else. I think we'll still be able to test much of the future parts of
garbage collection without a `git` binary because the interesting
parts are about manipulating the Git repo before calling `git gc` on
it.
2023-12-03 07:40:12 -08:00
Martin von Zweigbergk
ec7f9e79f6 docs: update description of conflicts to be about tree-level conflicts
Fixes #2373
2023-11-30 14:24:48 -08:00
Jason R. Coombs
e7ae1f9c0b Replace contact method with addresses of active leads. 2023-11-28 13:48:22 -05:00
Jason R. Coombs
e76189ebe1 Update code of conduct, copied unmodified from upstream (https://www.contributor-covenant.org/version/2/1/code_of_conduct.html). 2023-11-28 13:48:22 -05:00
Jesse Somerville
8fac33afdb install-and-setup.md: --strategy -> --strategies for cargo binstall 2023-11-21 20:19:38 -08:00
Benjamin Saunders
78cdc0843a docs: add forgotten code tags 2023-11-14 14:48:44 -08:00
Benjamin Saunders
257fbe35c7 docs: Document jj backout/git revert correspondence 2023-11-13 18:10:03 -08:00
Łukasz Kurowski
e4955d29f3 git-comparison.md: show log of ancestors
This question was raised on the discord, it might be helpful for others.
2023-11-11 15:24:24 +01:00
Yuya Nishihara
2ac9865ce7 revset: exclude @git branches from remote_branches()
As discussed in Discord, it's less useful if remote_branches() included
Git-tracking branches. Users wouldn't consider the backing Git repo as
a remote.

We could allow explicit 'remote_branches(remote=exact:"git")' query by changing
the default remote pattern to something like 'remote=~exact:"git"'. I don't
know which will be better overall, but we don't have support for negative
patterns anyway.
2023-11-08 07:34:30 +09:00
Ilya Grigoriev
745f5b7f0e poetry: Poetry 1.7 issues
1. Add --no-root to poetry invocations. Poetry 1.7 displays an error otherwise
(though things still work)

https://github.com/orgs/python-poetry/discussions/8622
https://github.com/python-poetry/poetry/issues/1132

2. Document https://github.com/python-poetry/poetry/issues/8623
2023-11-06 17:10:27 -08:00
Martin von Zweigbergk
9a5c19a3c6 contributing.md: suggest making the gh-pages branch immutable 2023-11-05 08:07:02 -08:00
Martin von Zweigbergk
7c923514ee git: add config to disable abandoning of unreachable commits
Some users prefer to have commits not get abandoned when importing
refs. This adds a config option for that.

Closes #2504.
2023-11-05 06:10:54 -08:00
Ilya Grigoriev
adc8433204 mkdocs: make MkDocs work with more GitHub-like list formatting
This adds two MkDocs extensions to make list handling more flexible.
It took some trial-and-error, but it seems this config works OK.

revsets.md: use saner formatting that is now possible.

sapling-comparison.md: this was the one case I saw made worse by the
new plugins. I changed the Markdown formatting, it still looks sane.
2023-11-03 19:15:37 -07:00
Philip Metzger
c783bbce6d FAQ: Add an entry on how Jujutsu saves changes in the working-copy.
This was brought up as a common point of confusion in a Discord discussion ~2 
months ago.
2023-11-02 20:29:06 +01:00
Tal Pressman
6b1217ec6d add FAQ for divergent changes 2023-11-01 16:55:57 +09:00
Ilya Grigoriev
0df851e6e2 glossary.md: Add a stub for "Hidden commits, Abandoned commits" 2023-10-31 23:41:41 -07:00
Ilya Grigoriev
c79920095b glossary.md: Clarify description of "visible commits" 2023-10-31 23:41:41 -07:00
Ilya Grigoriev
4c490d2ca9 revsets.md: correct description of "visible commits" 2023-10-31 23:41:41 -07:00
Ilya Grigoriev
a3f21f7a9d revsets.md: clarify string patterns and file patterns
I had to increase indent on two list items for multiple paragraphs to work in
MkDocs.
2023-10-31 17:49:49 -07:00
Ilya Grigoriev
38daa9abe3 install-and-setup.md: Document binary installation with cargo-binstall
I also mentioned this in the changelog, since people reading it are more likely
to use `binstall` than most.
2023-10-30 15:12:23 -07:00
Ilya Grigoriev
2cd262def3 install-and-setup.md: Make headings more consistent 2023-10-30 15:12:23 -07:00
Yuya Nishihara
0e14a1f04d templater: add local/remote_branches keywords 2023-10-28 11:03:23 +09:00
Yuya Nishihara
01d474563e templater: make branches, tags, git_refs, and git_head return list type
I'm not going to change the default output, but this allows us to highlight
or dim only the @remote component.
2023-10-28 05:29:50 +09:00
Yuya Nishihara
2b33a97c35 templater: add types for local/remote ref names
Both local and remote refs are backed by the same value type since we'll need
some kind of runtime abstraction to represent "branches" keyword (which is a
list of local + remote branches.) It's tedious to implement separate
local/remote/both ref types.

The "unsynced" flag is inverted just because the positive term is slightly
easier to document.
2023-10-28 05:29:50 +09:00
Yuya Nishihara
b30d5bf1c7 templater: allow implicit list-to-boolean cast
I'm going to change "branches" to return a list instead of formatted string,
and I don't think "if(branches, ..)" should be invalidated by that. Perhaps,
a container type like String, Vec<T>, Option<T> can implement the cast.
2023-10-28 05:29:50 +09:00
Ilya Grigoriev
b6eb00d5ff docs/config.toml: update the default diff editor
It's been changed to `:builtin` some time ago.
2023-10-25 13:05:04 -07:00
Ilya Grigoriev
fcd02a6091 merge_tools.toml: add VS Code as a default merge tool.
Thanks to @glencbz for noticing that VS Code works fine now as a
merge tool, and thanks to @solson for suggesting
`merge-tool-edits-conflict-markers = true`.
2023-10-25 12:47:51 -07:00
Martin von Zweigbergk
3a7d21043e docs: fix broken Markdown in github.md, plus various cleanups
While fixing the broken Markdown, I also went through the whole doc
and made various little improvements (hopefully).

Closes #2426.
2023-10-24 21:31:51 -07:00
Martin von Zweigbergk
171896aefa docs: mention the immutable_heads() in our list of built-in aliases 2023-10-23 12:05:09 -07:00
Gabriel Scherer
b0048bca17 tutorial.md: no need to mention heads(x) anymore
Instead we point explicitly at the full documentation on revsets.

Suggested-by: Martin von Zweigbergk <martinvonz@google.com>
2023-10-23 12:01:17 +02:00
Gabriel Scherer
8ade4d083a docs/tutorial.md: introduce both long and short names of each option 2023-10-23 12:01:17 +02:00
Waleed Khan
aacad9dc8c docs: discuss jj commit -i in FAQ.md 2023-10-22 15:37:41 -07:00
Yuya Nishihara
cfcc76571c revset: add support for glob:pattern 2023-10-21 09:55:01 +09:00
Ilya Grigoriev
8762a2274f git-compatibility.md: adjust instructions to convert to colocated repo to match 872265a22 2023-10-18 19:45:47 -07:00
Yuya Nishihara
089503abfb refs: classify push action based on tracking target
Although this is logically correct, the error message is a bit cryptic. It's
probably better to reject push if non-tracking remote branches exist.

#1136
2023-10-17 15:06:03 +09:00
Yuya Nishihara
e0965c4533 git: on push, update jj's view of remote branches without using import_refs()
This means that the commits previously pinned by remote branches are no longer
abandoned. I think that's more correct since "push" is the operation to
propagate local view to remote, and uninteresting commits should have been
locally abandoned.
2023-10-17 15:06:03 +09:00
Yuya Nishihara
9cafff87e1 cli: add API and branch subcommand to track/untrack remote branches
This patch adds MutableRepo::track_remote_branch() as we'll probably need to
track the default branch on "jj git clone". untrack_remote_branch() is also
added for consistency.
2023-10-16 23:21:05 +09:00
Yuya Nishihara
4cd2518be0 git: on import_refs(), respect tracking state of existing remote refs
In this commit, new behavior is tested by using in-memory view data. Data
persistence and track/untrack commands will be implemented soon.
2023-10-16 23:21:05 +09:00
Infra
56a1686925 Add build-essential to install instructions 2023-10-05 09:07:37 -07:00
Ilya Grigoriev
048f993a17 docs index.md: explain that the website sidebar may be hidden
This happens on mobile browsers or when the browser window is too
narrow.
2023-10-04 05:25:37 -07:00
Ilya Grigoriev
7cfeb72328 docs index.md: Make README link a bit more reliable
The original link would likely be broken by the change to
the heading title in https://github.com/martinvonz/jj/pull/2273.
2023-10-04 00:22:12 -07:00
Ilya Grigoriev
2218143968 docs: create a basic homepage for the docs website
Before, https://martinvonz.github.io/jj/latest redirected to
https://martinvonz.github.io/jj/latest/install-and-setup.html.

Now, it will direct people to a basic page with a link to
the repo and a few other useful pages.

An additional motivation is the desire to have a homepage to
link to from
https://github.com/martinvonz/jj/pull/2273#discussion_r1331008117.

Better something very basic than nothing.
2023-10-03 19:58:22 -07:00
Waleed Khan
d9597c55ec docs: use code block for ui.pager config example 2023-10-02 23:37:33 -05:00
Yuya Nishihara
ce0821f06d docs: adjust tracking branches design to deal with "fetch/push && undo"
The original idea was to completely replace git_refs with remotes["git"] by
introducing "forgotten" state, but it turned out to break "fetch && undo"
scenario. There are other ways around, but they also have problems:

* Sets tombstone on forgotten/deleted remote refs, exports remote refs without
  comparing to the known refs.
  * `jj undo` would need to insert tombstone by diffing old/new views.
  * `jj branch forget` would need to preserve the @git branch whereas the other
    remote branches would be forgotten.
* Always overwrites remote refs on export.
  * `jj git export` without importing would discard remote refs.

So, I decided to not remove git_refs. Apparently, it also improves the undo
behavior. In the new model, `jj git fetch && jj undo && jj git fetch` works
even if git_refs isn't rolled back. So we can unify the default of
`jj undo --what`.
2023-09-28 18:00:25 +09:00
Philip Metzger
e158423cb0 Docs: Make github.md a bit clearer
This adresses #1989
2023-09-28 01:11:47 +02:00
Emily Fox
35f11e2cdc docs: add missing word to config.md 2023-09-27 12:26:08 -05:00
Hong Shin
e5ad32e29e docs: update basic workflow to use autogenned branch name 2023-09-26 13:16:44 -07:00
Hong Shin
0c0b924e7a docs: add revset clarification to github.md 2023-09-26 10:59:38 -07:00
Martin von Zweigbergk
a6ef3f0b6c cli: make set of immutable commits configurable
This adds a new `revset-aliases.immutable_heads()s` config for
defining the set of immutable commits. The set is defined as the
configured revset, as well as its ancestors, and the root commit
commit (even if the configured set is empty).

This patch also adds enforcement of the config where we already had
checks preventing rewrite of the root commit. The working-copy commit
is implicitly assumed to be writable in most cases. Specifically, we
won't prevent amending the working copy even if the user includes it
in the config but we do prevent `jj edit @` in that case. That seems
good enough to me. Maybe we should emit a warning when the working
copy is in the set of immutable commits.

Maybe we should add support for something more like [Mercurial's
phases](https://wiki.mercurial-scm.org/Phases), which is propagated on
push and pull. There's already some affordance for that in the view
object's `public_heads` field. However, this is simpler, especially
since we can't propagate the phase to Git remotes, and seems like a
good start. Also, it lets you say that commits authored by other users
are immutable, for example.

For now, the functionality is in the CLI library. I'm not sure if we
want to move it into the library crate. I'm leaning towards letting
library users do whatever they want without being restricted by
immutable commits. I do think we should move the functionality into a
future `ui-lib` or `ui-util` crate. That crate would have most of the
functionality in the current `cli_util` module (but in a
non-CLI-specific form).
2023-09-25 15:41:45 -07:00
Waleed Khan
409356fa5b merge_tools: enable :builtin as default diff/merge editor 2023-09-21 03:29:27 +02:00
Ilya Grigoriev
6d5390d1db cli: add upstream remote to default trunk()
This makes trunk() correct after `jj git fetch --remote upstream --branch
main`.
2023-09-19 20:51:23 -07:00
Ilya Grigoriev
0c31e0ba61 trunk() docs fix: commits aren't tried in order; newest commit wins
That's my understanding of how `latest()` revset works.
2023-09-19 20:51:23 -07:00
Yuya Nishihara
96cb3a6053 docs: use branch@remote syntax in trunk() example
It's simpler, and user-specified trunk() wouldn't need fallback.
2023-09-19 21:29:08 +09:00
Ruben Slabbert
f2f5ded5f0 revsets: add trunk alias with default to main/master/root 2023-09-17 10:17:23 +10:00
Ilya Grigoriev
c45216ed02 templates.md docs: Document string literal format
We are a little weird about which string escapes we support, and we don't
support raw strings.  I thought this might be worth documenting.

Inspired by https://github.com/martinvonz/jj/pull/2251
2023-09-15 20:16:09 -07:00
Ilya Grigoriev
c5f74bc466 docs: mention git pack-refs for co-located repos
As suggested by @yuja in
https://github.com/martinvonz/jj/issues/1841#issuecomment-1720451152

Thanks to @lazywei for pointing out that `git pack-refs --all` is better, at
least on the first run. I haven't checked, but suspect, that because of the
number of `refs/jj` refs jj creates, it might always be better.
2023-09-15 19:49:11 -07:00
Martin von Zweigbergk
21921cfd73 docs: add a section about profiling 2023-09-14 21:15:03 -07:00
Philip Metzger
09a99e36dc docs/design: Clarify run.md a bit.
This is essentially a new version, which clarifies multiple statements about
`jj run`. Notably, it cleans up some mistakes which were overlooked or deemed
good enough in the Google Docs version.
2023-09-14 16:39:40 +02:00
Philip Metzger
5b729a90a9 docs/design: Move the run doc to github.
This ticks another box in #1869.

Co-Authored-By: arxanas <me@waleedkhan.name>
Co-Authored-By: hooper <hooper@google.com>
Co-Authored-By: martinvonz <martinvonz@google.com>
2023-09-14 16:39:40 +02:00
Glen
2c74fa8c7c docs: document script to colocate a jj-only repo
https://github.com/martinvonz/jj/discussions/2230 indicates a lot of
interest in this, so we'd probably want to support this officially at
some point. Until then, document a script that has worked well-enough
for some of us.
2023-09-14 10:00:39 +08:00
Ilya Grigoriev
0cf83ea306 contributing.md: add section about contributing to the docs 2023-09-11 18:22:56 -07:00
Ilya Grigoriev
21f4015cbf install-and-setup.md: explain how to compile the latest release
Also a few minor updates.
2023-09-11 18:21:56 -07:00
Martin von Zweigbergk
70f6e0a452 cargo: enable the watchman feature by default
I think the feature is requested by enough users that we should
include it by default, also for people who install from source (we
include it in the `packaging` feature already).

It increases the size of the binary from 16.5 MiB to 17.8 MiB. I
suspect we'd see some of that increase in size soon anyway, as I'm
probably going to use Tokio for making async backend requests.
2023-09-08 09:34:55 -07:00
Martin von Zweigbergk
1c8d27dc39 faq: add entry about accidentally amended working copy 2023-09-08 08:59:59 -07:00
Ilya Grigoriev
5fc71018d6 config docs: minor fixups
mkdocs can't seem to handle backticks in link anchors for out-of-text links.
2023-09-07 11:01:12 -07:00
James Sully
0946934ca6 revset: Add optional argument n to ancestors() in revset language 2023-09-08 02:50:58 +10:00
Martin von Zweigbergk
233b31fdf2 docs: try to clarify that we want contributors to squash fixup commits
It's happened a few times that contributors misunderstood the
guidelines, so they're clearly not clear enough. Hopefully this
clarifies.
2023-09-07 09:31:45 -07:00
Ilya Grigoriev
2911f414bd docs: remove v0.7.0 shell completion instructions
Now that v0.9.0 is released, it seems appropriate.
2023-09-06 15:35:01 -07:00
Martin von Zweigbergk
d047512115 docs: prefer new revset operator :: over deprecated :
Now that we're very close to a release, it should be fine to use the
new syntax in our documentation. This effecttively backs out
37436f7344.
2023-09-06 13:09:14 -07:00
Martin von Zweigbergk
c7d1932546 release: release version 0.9.0
Thanks to everyone who's contributed!
2023-09-06 10:57:57 -07:00
Ilya Grigoriev
18bcc87794 docs: make co-located repos more prominent, more details
At this point, they are stable enough that I think we should
advertise them and encourage their use. This also explains
some caveats.
2023-09-06 09:15:27 -07:00