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

160 commits

Author SHA1 Message Date
Martin von Zweigbergk
edef604c88 cli: use "@" in graph to indicate the current checkout and head operation
This both helps find the current checkout and head operation and
hopefully helps teach the user that "@" is the symbol for the working
copy. I removed the current "<--" indication from the graph (and
non-graph) log template. Hopefully the "@" is clear enough on its own,
but we may want to add back some further indication later. We'll see.
2021-05-31 10:54:00 -07:00
Martin von Zweigbergk
03ea8779df cli: make diff editor configurable
This patch adds a simple `ui.diff-editor` config, which defaults to
`meld`. This fixes issue #10.
2021-05-31 09:40:29 -07:00
Martin von Zweigbergk
38a3462d4e cli: clarify "Now at: <commit>" message as "Working copy now at: <commit>"
I considered even changing the message to "Checking out: <commit>" as
that's technically more correct (the message is printed when the
view's checkout is updated, i.e. before the working copy is
updated). However, I worried that users would find it confusing that
e.g. `jj close` would result in a "Checking out: " message, even
though that's what actually happens.
2021-05-31 09:01:59 -07:00
Martin von Zweigbergk
83c460449b cli: remove overly verbose "Leaving: <commit>" message
I remember adding that message a long time ago so the user has a trace
of working copy commit ids in the terminal output. They should be able
to get the same information from the operation log combined with
e.g. `jj st --at-op`.
2021-05-31 08:55:08 -07:00
Martin von Zweigbergk
4a3ba5b8e4 cli: allow using --at-op=@ to refer to head operation
We already support using "@" to refer to the head operation when doing
e.g. `jj op undo -o @`. This patch adds support for `--at-op=@`. It
also makes that the default.
2021-05-28 23:05:16 -07:00
Martin von Zweigbergk
082b34206e cli: abbreviate operation ids to 12 hex digits 2021-05-28 22:48:39 -07:00
Martin von Zweigbergk
b26d9817c0 cli: add support for looking up operation id by prefix
This fixes issue #16.
2021-05-28 22:34:02 -07:00
Martin von Zweigbergk
b0fe2564d4 cli: don't commit working copy when using --at-op
The working copy is related to the current repo state; it makes little
sense to commit the working copy when looking at an old repo state.
2021-05-28 11:08:24 -07:00
Martin von Zweigbergk
b48e06a94b cli: make jj status get the working copy commit from the view
This prepares `jj status` for working better on an old repo state
(with `--at-op`). When looking at an old repo state, the "working
copy" should reflect the state from that state, i.e. the view's
"checkout", not the current working copy.
2021-05-28 10:56:03 -07:00
Martin von Zweigbergk
11005ae9b8 cli: make condition for committing working copy slightly smarter
Before this patch, `jj log` would always commit the working copy and
most other commands would commit the working copy only if they were
passed a revset of exactly "@". This patch makes it so they all commit
the working copy unless they are passed just a symbol other than "@"
(typically a commit id). That means that we will not commit the
working copy if the user does `jj diff -r abc123`, but we will if they
do `jj diff -r :abc123`. It's clearly unnecessary in both those cases,
and we should fix, but this is probably good enough for now.
2021-05-28 10:31:17 -07:00
Martin von Zweigbergk
440a423b54 cli: allow pruning more than one revision 2021-05-28 10:14:37 -07:00
Martin von Zweigbergk
bbbdb11289 cli: consistently check that a commit can be rewritten before rewriting it
This patch adds checks in all (?) commands that rewrite commits to
make sure the commit they're about to rewrite is allowed to be
rewritten. The only check we do is that it's not a root commit. We
should at least add checks for public commits later.
2021-05-28 09:44:50 -07:00
Martin von Zweigbergk
69e3da46d8 cli: add a helper for parsing a revset and possibly committing working copy 2021-05-28 09:30:03 -07:00
Martin von Zweigbergk
749317f82d cli: replace "evolve" by "rebase" in a help text about jj prune
Now that we auto-evolve after most operations, the user may not know
what "evolve" means. Even before that, the way `jj evolve` resolved
orphans after pruning was by rebasing them.
2021-05-28 09:28:09 -07:00
Martin von Zweigbergk
e658cc0084 revsets: add a RevsetExpression::evaluate() method for convenience 2021-05-28 09:01:34 -07:00
Martin von Zweigbergk
080a9b37ff cli: make jj st show parent commit before working copy commit
Perhaps it makes more sense to display the working copy commit just
above the changes in the working copy commit, even though that means
that the order between the working copy commit and the parent becomes
the opposite of the order in `jj log`.
2021-05-23 22:09:02 -07:00
Martin von Zweigbergk
ba8ff31e32 cli: make the working copy changes in jj status clearer 2021-05-23 22:08:34 -07:00
Martin von Zweigbergk
dcfc888f50 cli: remove "Done" message at end of git clone
It's probably obvious that the cloning is done when the command
finishes.
2021-05-23 22:08:09 -07:00
Martin von Zweigbergk
54f6165ef1 repo_path: replace remaining uses of DirRepoPath by RepoPath 2021-05-19 15:11:04 -07:00
Martin von Zweigbergk
c66990d3a3 repo_path: rename from() to from_internal_{,dir}_string()
Since `RepoPath` can be either a file or a directory, I made its name
not include `file`.
2021-05-19 15:11:04 -07:00
Martin von Zweigbergk
03ae1b747c repo_path: remove FileRepoPath in favor of just RepoPath
I had initially hoped that the type-safety provided by the separate
`FileRepoPath` and `DirRepoPath` types would help prevent bugs. I'm
not sure if it has prevented any bugs so far. It has turned out that
there are more cases than I had hoped where it's unknown whether a
path is for a directory or a file. One such example is for the path of
a conflict. Since it can be conflict between a directory and a file,
it doesn't make sense to use either. Instead we end up with quite a
bit of conversion between the types. I feel like they are not worth
the extra complexity. This patch therefore starts simplifying it by
replacing uses of `FileRepoPath` by `RepoPath`. `DirRepoPath` is a
little more complicated because its string form ends with a '/'. I'll
address that in separate patches.
2021-05-19 15:11:04 -07:00
Martin von Zweigbergk
1fe8f6ac27 cli: on init, give a proper error message instead crashing when repo exists 2021-05-19 14:53:37 -07:00
Martin von Zweigbergk
f0cec5ddc8 cli: when run in git repo, hint about creating a jj repo backed by it 2021-05-19 14:30:21 -07:00
Martin von Zweigbergk
525a5116a2 RepoLoader: stop returning Result since the functions cannot currently fail 2021-05-19 14:12:54 -07:00
Martin von Zweigbergk
6809a88d42 cleanup: use ReadonlyRepo returned from Transaction::commit()
I thought I had looked for this case and cleaned up all the places
when I made `Transaction::commit()` return a new `ReadonlyRepo`. I
must have forgotten to do that, because there we tons of places to
clean up left.
2021-05-19 14:04:52 -07:00
Martin von Zweigbergk
6233782914 cli: print file paths as relative and using OS directory separator in diff
I missed the paths we show in `jj diff` in my recent patch.
2021-05-16 21:13:16 -07:00
Martin von Zweigbergk
31f3984728 cli: use placeholder name/email if not configured instead of crashing 2021-05-16 14:52:44 -07:00
Martin von Zweigbergk
b97d25038b cli: restore newline after each file in jj files 2021-05-16 14:49:00 -07:00
Martin von Zweigbergk
b671eca7ad cli: print file paths as relative and using OS directory separator 2021-05-16 13:43:23 -07:00
Martin von Zweigbergk
bb83c3d509 cli: rename restore command's arguments to "from" and "to"
I keep thinking of them as "from" and "to" rather than "source" and
"destination", so it probably makes sense to use those words.
2021-05-16 09:34:33 -07:00
Martin von Zweigbergk
66460477b7 cli: add instructions for all diff-editing (aka interactive) commands
Now when you do e.g. `jj split`, you'll get a `JJ-INSTRUCTIONS` file
as part of the diff you're editing.
2021-05-16 09:31:16 -07:00
Martin von Zweigbergk
e29cef7918 cli: remove trailing blank lines from commit description after editing 2021-05-16 09:26:30 -07:00
Martin von Zweigbergk
f96130d21c cli: include some instructions in editor when editing commit description 2021-05-16 09:24:19 -07:00
Martin von Zweigbergk
798a6f7a74 cli: make concurrent description-editing not use the same file
If you ran two concurrent `jj describe` (for example) before this
patch, they'd both try to open an editor on the same file. This patch
fixes that by randomizing the filename. It also deletes the file at
the end so the `.jj/` directory is not cluttered by these files.
2021-05-15 17:01:28 -07:00
Martin von Zweigbergk
d42e6c77b2 project: rename project from Jujube to Jujutsu
"Jujutsu" is probably much more familiar and relatable to most
people. Also, I'm still not sure how "jujube" is supposed to be
pronounced :P
2021-05-15 10:28:40 -07:00
Martin von Zweigbergk
6a5f9dd06b cli: rebase orphans after every command (except for evolve)
It's annoying to have to run run `jj evolve`, and it's easy to forget
(especially after updating the description of the working copy
parent), so let's just always do it. Unlike most VCSs, we don't have
to worry about merge conflicts since we can represent them in commits.
2021-05-15 09:16:19 -07:00
Martin von Zweigbergk
a71c56e5e1 evolution: rewrite orphan resolution as iterator 2021-05-15 09:16:19 -07:00
Martin von Zweigbergk
79b5b8d681 evolution: rewrite divergence resolution as iterator
This commit rewites the divergence-resolution part of `evolve()` as an
iterator (though not implementing the `Iterator` trait). Iterators are
just much easier to work with: they can easily be stopped, and errors
are easy to propagate. This patch therefore lets us propagate errors
from writing to stdout (typically pipe errors).
2021-05-15 09:16:19 -07:00
Martin von Zweigbergk
31eff96cb7 cli: record full argv in operation log
When using the command line interface (which is the only interface so
far), it seems more useful to see the exact command that was run than
a logical description of what it does. This patch makes the CLI record
that information in the operation metadata in a new key/value field. I
put it in a generic key/value field instead of a more specialized
field because the key/value field seems like a useful thing to have in
general. However, that means that we "have to" do shell-escaping when
saving the data instead of leaving the data unescaped and adding the
shell-escaping when presenting it. I added very simple shell-escaping
for now.
2021-05-09 22:42:13 -07:00
Martin von Zweigbergk
383d6f3613 cli: create another helper for carrying inputs to commands
This type will soon have the full command line so that can be passed
in as metadata when starting transactions.
2021-05-08 23:35:54 -07:00
Martin von Zweigbergk
1ef85e621a cli: don't commit working copy more than once per command 2021-05-08 22:57:43 -07:00
Martin von Zweigbergk
6d3c4c144c cli: make RepoCommand helper automatically update checkout by default
Almost all commands should update the checkout after rewriting
commits, so this patch teaches the `RepoCommand` helper to take care
of that by default.
2021-05-08 22:57:40 -07:00
Martin von Zweigbergk
6716a5f069 cli: teach RepoCommand to commit transaction and update working copy 2021-05-08 22:49:33 -07:00
Martin von Zweigbergk
e913f03a06 cli: introduce a helper type for commands that act on a repo
This patch introduces a type that keeps some state that is used by
commands that act on a repo (i.e. most commands). The short-term goal
with this refactoring is to use the new type for passing the full
list of command-line arguments as metadata on the transaction.

This patch on its own is a net increase in lines of code. Hopefully
that can be reversed with some further patches.
2021-05-08 22:48:27 -07:00
Martin von Zweigbergk
2566f6c0fa cli: pass only &UserSettings instead of &Ui into some helpers
This is to prepare for putting some common code for writing commands
into a struct.
2021-05-08 13:53:27 -07:00
Martin von Zweigbergk
5116d46a32 cli: delete obsolete "writeworkingcopy" debug command 2021-05-08 13:53:18 -07:00
Martin von Zweigbergk
647f714cd7 cli: stop reloading repo after committing transaction
Sinc `Transaction::commit()` now returns the resulting repo, we can
simply use that. That seems to save about 30ms in the git.git repo.
2021-05-08 13:51:38 -07:00
Martin von Zweigbergk
9e3e6f03a1 repo: store Operation object, not just its ID in ReadonlyRepo
This change simplifies a bit on its own, and it will help with the
next change as well.
2021-05-07 22:53:11 -07:00
Martin von Zweigbergk
4dc41f1d47 cli: add support for command aliases
This commit adds support for defining command aliases. The aliases are
read from the `[alias]` section and are expected to be TOML arrays
with one element per argument.
2021-05-02 23:01:51 -07:00
Martin von Zweigbergk
33da97f0bf revsets: add iterator adapter for rendering simplified graph of set
When rendering a non-contiguous subset of the commits, we want to
still show the connections between the commits in the graph, even
though they're not directly connected. This commit introduces an
adaptor for the revset iterators that also yield the edges to show in
such a simplified graph.

This has no measurable impact on `jj log -r ,,v2.0.0` in the git.git
repo.


The output of `jj log -r 'v1.0.0 | v2.0.0'` now looks like this:

```
o   e156455ea491 e156455ea491 gitster@pobox.com 2014-05-28 11:04:19.000 -07:00 refs/tags/v2.0.0
:\  Git 2.0
: ~
o c2f3bf071ee9 c2f3bf071ee9 junkio@cox.net 2005-12-21 00:01:00.000 -08:00 refs/tags/v1.0.0
~ GIT 1.0.0
```

Before this commit, it looked like this:

```
o e156455ea491 e156455ea491 gitster@pobox.com 2014-05-28 11:04:19.000 -07:00 refs/tags/v2.0.0
| Git 2.0
| o   c2f3bf071ee9 c2f3bf071ee9 junkio@cox.net 2005-12-21 00:01:00.000 -08:00 refs/tags/v1.0.0
| |\  GIT 1.0.0
```

The output of `jj log -r 'git_refs()'` in the git.git repo is still
completely useless (it's >350k lines and >500MB of data). I think
that's because we don't filter out edges to ancestors that we have
transitive edges to. Mercurial also doesn't filter out such edges, but
Git (with `--simplify-by-decoration`) seems to filter them out. I'll
change it soon so we filter them out.
2021-05-01 14:56:52 -07:00