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

143 commits

Author SHA1 Message Date
Samuel Tardieu
a7aed0171d style: fix typos found by codespell 2023-01-28 07:23:45 -08:00
Martin von Zweigbergk
9ac4fdb11c docs: describe color configuration 2023-01-27 13:16:26 -08:00
Martin von Zweigbergk
d8942d5f96 cli: rename ui.graph.format to ui.graph.style
I think of it more as style than a format, so using `style` in the
config key makes sense to me.

I didn't bother making upgrades easy by supporting the old name since
this was just released and only a few developers probably have it set.
2023-01-27 10:36:26 -08:00
Martin von Zweigbergk
0b99e5b16e graphlog: enable Sapling's graph styles by default
I would also rename the feature, but I hope we can instead soon make
it a non-optional dependency and delete the feature.
2023-01-27 09:46:57 -08:00
Yuya Nishihara
a7d02e66de docs: use fenced code blocks and enable syntax highlighting of toml snippets 2023-01-27 13:53:20 +09:00
Martin von Zweigbergk
c5cc2e6d46 tutorial: delete obsolete mention of aliases
The heading says it's going to explain aliases, but it doesn't, and
now that we've documented aliases in config.md, we probably don't need
to mention it in the tutorial.
2023-01-26 18:15:23 -08:00
Martin von Zweigbergk
772d6c47dd docs: document configuration of aliases 2023-01-26 18:15:23 -08:00
Martin von Zweigbergk
d4ed8f32b3 docs: format config.md 2023-01-26 18:15:23 -08:00
Martin von Zweigbergk
780e257b89 docs: fix a typo in config.md and add a missing comma 2023-01-26 18:15:23 -08:00
Ilya Grigoriev
8c5a14d28a contributing.md: Add a link to the "Comprehensive Rust" course
This is something I wish I had when I first contributed to `jj`.
2023-01-25 21:10:10 -08:00
Samuel Tardieu
e4f6dadfad workspace: add a root subcommand to print the workspace root path 2023-01-24 16:53:54 +01:00
Philip Metzger
c252f3eb04 Docs: Fix a dangling ref.
During the initial review, we missed that I wrote `detached head` 
in the link to https://www.git-scm.com/docs/git-checkout#_detached_head 
instead of `detached`. This corrects the link.
2023-01-20 20:05:05 +01:00
Martin von Zweigbergk
f7324768a7 docs: fix some typos in github.md, and reformat it 2023-01-19 09:45:10 -08:00
Michael Forster
27228ce292 Update MSRV to 1.61
This is needed for compatibility with the sapling dag crate.
2023-01-19 10:29:39 +01:00
Ilya Grigoriev
e7c434d492 Make ui.unique-prefixes default to brackets 2023-01-17 22:01:09 -08:00
Ilya Grigoriev
67b81a77b8 Config: ui.unique-prefixes to show id shortest unique prefixes
Currently, the possible values are `underscore` and `none`. For now, `none`
is the default, since the `underscore` value messes up copy and pasting of
ids. In the future, an `underline` value should be implemented and will
likely become the default.

Screenshot of `underscore`: https://user-images.githubusercontent.com/4123047/212502483-4119fb17-0601-4335-9770-196e36a6bc31.png
2023-01-17 22:01:09 -08:00
Samuel Tardieu
2832d7c739 config: allow configuration of git remotes for fetch and push operations
The `git.fetch` and `git.push` keys can be used in the configuration file
for the default to use in `jj git fetch` and `jj git push` operations.

By defaut, "origin" is used in both cases.
2023-01-17 19:04:11 +01:00
Vamsi Avula
60d1537731 let branches and remote_branches revset functions take needles as arguments
- branches has the signature branches([needle]), meaning the needle is optional (branches() is equivalent to branches("")) and it matches all branches whose name contains needle as a substring
- remote_branches has the signature remote_branches([branch_needle[, remote_needle]]), meaning it can be called with no arguments, or one argument (in which case, it's similar to branches), or two arguments where the first argument matches branch names and the second argument matches remote names (similar to branches, remote_branches(), remote_branches("") and remote_branches("", "") are all equivalent)
2023-01-16 12:15:30 +05:30
Ilya Grigoriev
50321f851f revsets.md: Add a sentence to clarify connected 2023-01-14 15:52:51 -08:00
Samuel Tardieu
3d870068c2 log: add (empty) in front of an empty commit description 2023-01-14 16:00:42 +01:00
Ilya Grigoriev
d197eddea6 docs/working-copy.md: Mention jj resolve 2023-01-13 13:26:24 -08:00
Martin von Zweigbergk
82829813d6 docs: don't recommend running cargo fmt in the background
Running `cargo fmt` while you're working in an editor means that you
may lose changes because of a race:

1. Your editor reads version X of file
2. `cargo fmt` reads version X
3. You save version Y from your editor
4. `cargo fmt` saves version Z, replacing Y
2023-01-12 11:50:02 -08:00
Yuya Nishihara
ea96ea3ffe cli: load configs from .jj/repo/config.toml
Since per-repo config may contain CLI settings, it must be visible to CLI.
Therefore, UserSettings::with_repo() -> RepoSettings isn't used, and its
implementation is nullified by this commit.

#616
2023-01-07 11:33:12 +09:00
Philip Metzger
48356817ba [Docs]: Add some more documentation on how to work with github.
The document roughly describes some workflows, which help new users
to start with github.
2023-01-01 16:36:09 +01:00
Ilya Grigoriev
18722bbf36 cmd: Remove the -i option to jj restore.
It is superceded by the new options to the `jj diffedit` command.
2022-12-21 08:15:06 -08:00
Ilya Grigoriev
c9706fc0d4 Rename jj touchup to jj diffedit 2022-12-21 08:15:06 -08:00
Ilya Grigoriev
8f9cc3f4e8 Instructions and better config for Vim as a diff editor
After I changed `merge-tools.vimdiff.program` to `vim`, using
`vimdiff` as a diff editor wouldn't work at all. 

Out of the box, it's still not a good experience. I included a
recommendation of a plugin to install to make it better.
2022-12-17 22:08:50 -08:00
Martin von Zweigbergk
86cd0fa570 docs: touch up contributor guide, mentioning cargo nextest --workspace
It can be confusing that the lib crate is not tested when you run
`cargo test` without `--workspace` from the root directory. Also,
`nextest` is a non-obvious quality-of-life improvement, so let's
suggest that.
2022-12-16 22:08:17 -08:00
Martin von Zweigbergk
9d040fef78 docs: indent conflict marker examples to not confuse tools
When importing `conflicts.md` into the Google repo, our internal tools
complained that it contained conflict markers. Similarly, if you ever
get an actual merge conflict in the file, the working-copy
snapshotting would parse our sample conflict markers here, forcing you
to work around it. Let's avoid that by indenting the conflict
markers. Hopefully readers will understand that the leading space is
not part of the markers.
2022-12-12 16:20:40 -08:00
Martin von Zweigbergk
29db672a5c tutorial: mention jj edit and when it's useful
I made some other little touchups while at it.

Closes #840
2022-12-09 22:28:33 -08:00
Martin von Zweigbergk
1dbf4df3ea docs: mention that the "view" object knows about all workspaces
I seem to have forgotten to update this when I added support for
workspaces a while back.

I made some other little touchups while at it.
2022-12-08 17:30:29 -08:00
Martin von Zweigbergk
a0573b1737 cli: add a command for updating a stale working copy
When a workspace's working-copy commit is updated from another
workspace, the workspace becomes "stale". That means that the working
copy on disk doesn't represent the commit that the repo's view says it
should. In this state, we currently automatically it to the desired
commit next time the user runs any command in the workspace. That can
be undesirable e.g. if the user had a slow build or test run started
in the working copy. It can also be surprising that a checkout happens
when the user ran a seemingly readonly command like `jj status`.

This patch makes most commands instead error out if the working copy
is stale, and adds a `jj workspace update-stale` to update it. The
user can still run commands with `--no-commit-working-copy` in this
state (doing e.g. `jj --no-commit-working-copy rebase -r @ -d @--` is
another way of getting into the stale-working-copy state, by the way).
2022-12-05 08:50:52 -08:00
Martin von Zweigbergk
c5c89b9e9b pager: default to less -FRX
As dbarnett@ reported on #9, our default of `less`, combined with our
default of enabling color on TTYs, means that we print ANSI codes to
`less` by default. Unless the user has set e.g. `$LESS=R`, `less` is
going to escape those codes, resulting in garbage like this:

```
@ ESC[1;35mbb39c26a29feESC[0m ESC[1;33m(no email configured)ESC[0m ESC[1;36m2022-12-03....
```

I guess most of us didn't notice because we have something like
`$LESS=FRX` set.

This patch changes our default from `less` to `less -FRX`. Those are
the flags we're using for our internal hg distribution at Google, and
that has seemed quite uncontroversial.

I added a pointer from the changelog to the tracking issue while at
it.
2022-12-04 00:00:31 -08:00
Ilya Grigoriev
8222ba94cf Documentation for jj resolve and merge tool config 2022-12-03 15:12:40 -08:00
Martin von Zweigbergk
69f85dfd27 docs: describe how we do code reviews 2022-12-02 13:05:32 -08:00
Yuya Nishihara
de639c3ef1 cli: accept command arguments specified by array
It should be more reliable than parsing a command string into array.

Also updated some of the doc example to use array syntax. I don't think
"C:/Program Files" was parsed properly, but might work thanks to Windows
magic.
2022-12-02 15:44:10 +09:00
Ilya Grigoriev
52fadc046e Miscellaneous improvements to config docs
Also moves the "relative timestamps" section to make merge tool
docs fit in better.
2022-11-29 20:55:11 -08:00
Benjamin Saunders
ce0aa95162 docs: clarify diff editor interface 2022-11-29 17:58:02 -08:00
Glen Choo
7c2400f3e5 ui: add pager
Teach Ui's writing functions to write to a pager without touching the
process's file descriptors. This is done by introducing UiOutput::Paged,
which spawns a pager that Ui's functions can write to.

The pager program can be chosen via `ui.pager`. (defaults to Defaults to
$PAGER, and 'less' if that is unset (falling back to 'less' also makes
the tests pass).

Currently, commands are paginated if:

- they have "long" output (as defined by jj developers)
- jj is invoked in a terminal

The next commit will allow pagination to be turned off via a CLI option.
More complex pagination toggling (e.g. showing a pager even if the
output doesn't look like a terminal, using a pager for shorter ouput) is
left for a future PR.
2022-11-30 06:14:39 +08:00
Yuya Nishihara
48d10d648c revset: add unary negate (or set complement) operator '~y'
Because a unary negation node '~y' is more primitive than the corresponding
difference node 'x~y', '~y' is easier to deal with while rewriting the tree.
That's the main reason to add RevsetExpression::NotIn node.

As we have a NotIn node, it makes sense to add an operator for that. This
patch reuses '~' token, which I feel intuitive since the other set operators
looks like bitwise ops. Another option is '!'.

The unary '~' operator has the highest precedence among the set operators,
but they are lower than the ranges. This might be counter intuitive, but
useful because a prefix range ':x' can be negated without parens.

Maybe we can remove the redundant infix operator 'x ~ y', but it isn't
decided yet.
2022-11-29 15:46:15 +09:00
Yuya Nishihara
70292f79b7 revset: implement function alias expansion
Function parameters are processed as local symbols while substituting
alias expression. This isn't as efficient as Mercurial which caches
a tree of fully-expanded function template, but that wouldn't matter in
practice.
2022-11-29 04:17:12 +09:00
Yuya Nishihara
c5ed3e1477 revset: for short hash, look up both commit and change ids to disambiguate
Because the use of the change id is recommended, any operation should abort
if a valid change id happens to match a commit id. We still try the commit
id lookup first as the change id lookup is more costly.

Ambiguous change/commit id is reported as AmbiguousCommitIdPrefix for now.
Maybe we can merge AmbiguousCommit/ChangeIdPrefix errors into one?

Closes #799
2022-11-28 17:30:53 +09:00
Ilya Grigoriev
ff42dede05 Polish jj development environment suggestions
Fixups to b33126e1b
2022-11-27 23:43:21 -08:00
Ilya Grigoriev
b33126e1b0 Document suggestions for a jj development environment
I worte up some things I wish I knew when I wrote my first PR.
2022-11-27 12:57:10 -08:00
Yuya Nishihara
8b00a64ab2 cli: load revset aliases from config file
Aliases are loaded at WorkspaceCommandHelper::new() as it's easier to warn
invalid declarations there. Not all commands use revsets, but many do, so
I think it's okay to always pay the loading cost. Parsing the declaration
part (i.e. a symbol) should be fast anyway.

The nested error message isn't super readable, but seems good enough.

Config syntax to bikeshed:
- naming: [revset-alias] vs [revset-aliases] ?
- function alias will need quotes: 'f(x)' = 'x'
2022-11-27 20:12:22 +09:00
Ruben Slabbert
01817e4321 feature: support relative timestamps as a config option 2022-11-27 08:35:17 +10:00
Ruben Slabbert
68b77d123d feature: support git credential helpers 2022-11-19 22:06:27 -08:00
Martin von Zweigbergk
57ff990fe8 docs: describe git commit --fixup equivalent
It's probably not obvious that `jj move` can be used for the `git
commit --fixup` usecase.
2022-11-19 14:22:34 -08:00
Yuya Nishihara
a81ebeb85e revset: add empty() predicate to find commits with no file change
The expression 'x ~ empty()' is identical to 'x & file(".")', but more
intuitive.

Note that 'x ~ empty()' is slower than 'x & file(".")' since the negative
intersection isn't optimized right now. I think that can be handled as
follows: 'x ~ filter(f)' -> 'x & filter(!f)' -> 'filter(!f, x)'
2022-11-16 08:50:33 +09:00
Martin von Zweigbergk
50ba571527 log: move commit ID off to the right
We have talked about showing the commit ID only for divergent changes
because it's generally easier to work with the change ID, and it's
less likely to result in a divergent change. However, it's useful to
have the commit ID available for pasting into e.g. a commit message or
the GitHub UI. To try to steer users towards using the change ID, this
commit moves the commit ID off to the right in the log output.

I put it just after the "divergent" field, because that makes it close
to how I imagine it would look if we decided to hide the commit ID
except for divergent changes. I was thinking that could be rendered as
"divergent (abc123)". So if we add config to hide the commit ID, then
it would be rendered almost the same for divergent commits (just with
the added parentheses). It would also make sense to replace the
"divergent" field by a question mark on the change ID, since change
IDs basically behave like branches. If we do that, then the placement
of the commit ID I picked in this commit does not make sense.
2022-11-14 07:49:52 -08:00