When using Windows, `@` is a bit of an annoyance to type in the terminal due
to Windows Terminal escape rules, so you actually have to write it with a
backtick in front. It's annoying to remember this and not possible to configure
a different behavior, as far as I can see.
However, there is a smart trick you can do to make this a lot easier: just alias
`@` to the name `at` and be happy. Because:
- It's short: sweet and easy to read, and requires no backticks.
- It's unambiguous: `a` is from commit alphabet, but `t` is from the change alphabet
- It can be typed without a huge loss in efficiency (and one hand, assuming QWERTY).
I believe it was Stephen Jennings who came up with this trick first in Discord,
and I have it in my aliases, but I run into it every time I try to use JJ on a
fresh Windows VM to test stuff. Let's make life a little easier for everyone and
just ship this by default.
Signed-off-by: Austin Seipp <aseipp@pobox.com>
`jj new <commit>` automatically adds the checked out commits into the view head ids. However,
`jj edit` does not.
To reproduce:
```
jj git init test
cd test
jj commit -m "my commit"
jj log -r @- -T commit_id # Save the id
jj abandon -r @-
jj edit <saved_id>
jj log -r :: # Does not show the currently editing commit
```
I'll use a similar setup in "op log", but for each log entry. We might want to
extract some parts to helper function, but I don't have a good idea right now.
CommandHelper::operation_template_extensions() is removed because it's unlikely
to parse operation template without loading a workspace.
I'll add an option to include diffs in "op log", and workspace_env will be used
in order to set up diff/template contexts per operation.
cmd_op_log() is split because of owned/borrowed type differences.
These functions will be used by "op log"/"diff"/"show".
This patch also changed the error type as it's obvious that there are no other
errors to be returned.
It doesn't make sense to reparse revset expression. Let's reuse the parse
result. This also simplifies error handling bits.
OnceCell is switched to the std one as we no longer need get_or_try_init().
Some "operation" commands need a workspace, plus multiple repo views. We
currently load WorkspaceCommandHelper twice for that reason. It works, but
would be messy if "op log" loaded WorkspaceCommandHelper for each log entry.
This patch starts splitting non-repo data from WorkspaceCommandHelper. The
workspace object isn't owned by the environment object so the object can be
freely discarded.
It's a pretty frequent request to have support for turning off
auto-tracking of new files and to have a command to manually track
them instead. This patch adds a `snapshot.auto-track` config to decide
which paths to auto-track (defaults to `all()`). It also adds a `jj
track` command to manually track the untracked paths.
This patch does not include displaying the untracked paths in `jj
status`, so for now this is probably only useful in colocated repos
where you can run `git status` to find the untracked files.
#323
While working on the Buck branch, I have been bitten about a million times by
the following setup:
- Hack away
- Switch back to main
- Run `jj st` after editing a file
- `/buck-out` gets snapshotted, because it isn't ignored
- Trip max snapshot filesize error
- Pain
There are a few ways to skin the cat but this is simplest. It's an incredibly
small addition and it may be all for naught in the long run, but this will stem
the bleeding, at least.
Signed-off-by: Austin Seipp <aseipp@pobox.com>
When loading repos on a server, there is no repo path. We currently
use a placeholder at Google. This patch will let us not do that.
I think we can remove the paths from `Workspace` too, but I'll leave
that for later, if at all.
In `TestBackend`, we simply use the path as key to look up the storage
in memory. That means we can't rely on the file system to look find
the same path given two different representaitons of the same path. We
therefore need to canonicalize the paths if we want to allow the
caller to pass in different paths for the same real path.
`RepoLoader` can be used on a server. You would then call
`RepoLoader::new()`. Let's clarify what `init()` does by renaming it
and documenting it.
I think `WorkspaceLoader`, OTOH, is only useful for loading a
workspace from disk. I also documented that.
We were passing the max file size to snapshot to
`WorkingCopy::snapshot()` via `UserSettings`. It's simpler and more
flexible to set it on `SnapshotOptions` instead.
We had both `repo()` and `mut_repo()` on `Transaction` and I think it
was easy to get confused and think that the former returned a
`&ReadonlyRepo` but both of them actually return a reference to
`MutableRepo` (the latter obviously returns a mutable reference). I
hope that renaming to the more idiomatic `repo_mut()` will help
clarify.
We could instead have renamed them to `mut_repo()` and
`mut_repo_mut()` but that seemed unnecessarily long. It would better
match the `mut_repo` variables we typically use, though.
I'm thinking of adding an option to embed operation diffs in "op log", and
"op log" shouldn't fail at the root operation. Let's make "op diff"/"show"
also work for consistency.
This flag implements three modes:
- `copy`: copy sparse patterns from parent
- `full`: do not copy sparse patterns from parent
- `empty`: clear all paths, equal to `set --clear`
This is useful for various tooling like tools that want to run a parallel
process that queries the build system (without running into locks/blocking.)
I think continuing to copy sparse patterns makes sense as the default behavior.
Signed-off-by: Austin Seipp <aseipp@pobox.com>
This enables workflows like "insert a commit that reformats the code in one of
my project directories".
`jj fix --include-unchanged-files` is an easy way to fix everything in the repo.
`jj fix --include-unchanged-files <file...>` fixes all of the `<files>` even if they are
unchanged.
This is mostly orthogonal to other features, so not many tests are added.
This is a significant and simple enough improvement that I think it's
appropriate to make it here instead of waiting for a `jj run`-based solution.