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

1590 commits

Author SHA1 Message Date
Yuya Nishihara
9dc2cf802c cli: add helper to set up op template environment for the current repo state
We'll add a few more callers.
2024-09-15 20:40:46 +09:00
Yuya Nishihara
0c0e1b61e3 git-push: just say "Changes to push to <REMOTE>"
"Bookmark changes" sounds like changes will be bookmarked, and "Bookmark" here
is redundant. If we add support for pushing tags, this message will have to be
generalized anyway.
2024-09-15 07:06:56 +09:00
Yuya Nishihara
a48ecf3e62 git-push: remove redundant hash map lookup from print-changes loop 2024-09-15 07:06:56 +09:00
Yuya Nishihara
2f78c25d35 git-push: skip print-changes loop if --quiet 2024-09-15 07:06:56 +09:00
Yuya Nishihara
42f7908b8d git-push: extract function that prints bookmark changes to be pushed 2024-09-15 07:06:56 +09:00
Samuel Tardieu
6e72b1cfb0 git: add --remote option to clone command
This makes it easier to work with multiple remotes at once while
tracking the default branch of the remote used to create the local
repository:

```shell
$ jj git clone --remote upstream https://github.com/upstream-org/repo
$ cd repo
$ jj git remote add origin git@github.com:your-org/repo
$ jj config set --repo git.fetch upstream
```

In the example above, `upstream` is the repository containing the
reference source code that you might want to patch, while `origin` is
your fork where pull-request will be pushed. The branch `main@upstream`
will be tracked.
2024-09-13 18:14:57 +02:00
Yuya Nishihara
41ef9a76de cli: actually test if format_short_change_id() can be parsed
It's usually included in the commit_summary template, but not guaranteed.
2024-09-13 21:59:35 +09:00
Lukas Wirth
1410f2bee7 docs: Remove trailing whitespace in markdown files 2024-09-13 13:06:28 +02:00
Lukas Wirth
bccd8214df conflicts: Highlight change ids in rebase advice 2024-09-13 12:57:56 +02:00
Martin von Zweigbergk
63e616c801 git: restore support for git.push-branch-prefix config but deprecate it 2024-09-12 23:28:30 -07:00
Martin von Zweigbergk
c2220ca4d5 config-schema: update stale push-branch-prefix config
We missed this when we renamed `push-branch-prefix` to
`push-bookmark-prefix`. I changed the description slightly to try to
clarify that it's about the local bookmark that's created before
pushing it to the remote as a branch.
2024-09-12 23:00:20 -07:00
Martin von Zweigbergk
1aa2aec141 bookmarks: update some leftover uses of the word "branch" 2024-09-11 19:19:31 -07:00
Yuya Nishihara
d97a7ba86f cli: fix missed working-copy "bookmark" colors
Quoting style changed because of insta v1.40.0.
2024-09-12 09:02:16 +09:00
Yuya Nishihara
78edc6aba5 op log: add --op-diff option to embed operation diffs
This is basically "log -p" for "op log". The flag name has "op" because --diff
and --patch mean a similar thing in this context. Since -p implies --op-diff,
user can just do "op log -p" if he's okay with verbose op + content diffs.
Note that --no-graph affects both "op log" and "op diff" parts.

We might want to do some style changes later, such as inserting/deleting blank
lines, highlighting headers, etc.
2024-09-12 06:51:45 +09:00
Yuya Nishihara
050cde94ef op diff: apply word wrapping to non-graph template outputs
These contents may be embedded in "op log", and it's probably good to enable
word wrapping consistently.
2024-09-12 06:51:45 +09:00
Yuya Nishihara
babdf6b9c1 cli: relax error type of LogContentFormat::write() 2024-09-12 06:51:45 +09:00
Yuya Nishihara
6154827129 cli: make log word-wrapping helper calculate width eagerly
Multiple graphs will be nested in "op log" output, and things would be messy if
we had to calculate graph widths lazily. Let's simply make LogContentFormat
track the current available width no matter if ui.log-word-wrap is off.
2024-09-12 06:51:45 +09:00
Philip Metzger
d9c68e08b1 everything: Rename branches to bookmarks
Jujutsu's branches do not behave like Git branches, which is a major
hurdle for people adopting it from Git. They rather behave like
Mercurial's (hg) bookmarks. 

We've had multiple discussions about it in the last ~1.5 years about this rename in the Discord, 
where multiple people agreed that this _false_ familiarity does not help anyone. Initially we were 
reluctant to do it but overtime, more and more users agreed that `bookmark` was a better for name 
the current mechanism. This may be hard break for current `jj branch` users, but it will immensly 
help Jujutsu's future, by defining it as our first own term. The `[experimental-moving-branches]` 
config option is currently left alone, to force not another large config update for
users, since the last time this happened was when `jj log -T show` was removed, which immediately 
resulted in breaking users and introduced soft deprecations.

This name change will also make it easier to introduce Topics (#3402) as _topological branches_ 
with a easier model. 

This was mostly done via LSP, ripgrep and sed and a whole bunch of manual changes either from
me being lazy or thankfully pointed out by reviewers.
2024-09-11 18:54:45 +02:00
Yuya Nishihara
d04ff1213f op diff: set up diff/template context without using WorkspaceCommandHelper
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.
2024-09-10 07:06:43 +09:00
Yuya Nishihara
1e17078eb5 op log: leverage WorkspaceCommandEnvironment to parse template
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.
2024-09-10 07:06:43 +09:00
Yuya Nishihara
e0da3ec010 cli: move some template helpers to WorkspaceCommandEnvironment
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.
2024-09-10 07:06:43 +09:00
Yuya Nishihara
1da9ebcec1 cli: cache parsed revsets.short-prefixes expression
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().
2024-09-10 07:06:43 +09:00
Yuya Nishihara
90791216c5 cli: move revset-related contexts to WorkspaceCommandEnvironment
This makes it clear that RevsetParseContext doesn't depend on repo view.
2024-09-10 07:06:43 +09:00
Yuya Nishihara
9ca6c99508 cli: extract WorkspaceCommandEnvironment that doesn't depend on a repo
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.
2024-09-10 07:06:43 +09:00
Yuya Nishihara
54443c9a8d cli: remove unneeded &mut Ui requirement from WorkspaceCommandHelper
These functions just print messages, and never change Ui state such as
pagination.
2024-09-10 07:06:43 +09:00
Martin von Zweigbergk
f36f4ad257 cli: make paths to auto-track configurable, add jj track
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
2024-09-09 07:49:55 -07:00
Yuya Nishihara
653e8087da workspace: make workspace_root() and repo_path() return slice &Path
It's common to return &PathBuf as &Path.
2024-09-08 05:40:52 +09:00
Yuya Nishihara
47307556dd working_copy: pass SnapshotOptions by reference
Though SnapshotOptions can be cheaply cloned, it doesn't make much sense that
snapshot() consumes a settings-like object.
2024-09-08 04:51:21 +09:00
Martin von Zweigbergk
0b6714a33c workspace: take old repo path as separate argument
As I mentioned in recent patches, I'm about to remove
`ReadonlyRepo::repo_path()`.
2024-09-07 12:20:02 -07:00
Martin von Zweigbergk
bfb16a4c54 cli: get repo path from WorkspaceCommandHelper, not from ReadonlyRepo
I'd like to remove `ReadonlyRepo::repo_path()` since it doesn't make
sense when the repo is stored in a database.
2024-09-07 12:20:02 -07:00
Martin von Zweigbergk
8d090628c3 transaction: rename mut_repo() to idiomatic repo_mut()
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.
2024-09-07 10:51:43 -07:00
Martin von Zweigbergk
e5e95225d4 cleanup: inline some short single-use mut_repo variables 2024-09-07 10:51:43 -07:00
Martin von Zweigbergk
5fbc819fc1 cleanup: avoid some unnecessary uses of mutable repo reference 2024-09-07 10:51:43 -07:00
Yuya Nishihara
5bae3eaa74 cli: remove unneeded Display for SparseInheritance
Since it's a ValueEnum, clap knows how to stringify the default value.
2024-09-07 10:17:37 +09:00
Yuya Nishihara
b263882e4b config-schema: add signing.backend=none to the list of enum variants 2024-09-07 10:17:08 +09:00
Yuya Nishihara
c3ed3e3781 evolog: use predecessor_ids() where commit object isn't needed 2024-09-07 09:09:27 +09:00
Yuya Nishihara
25819dd1c9 evolog: inline show_predecessor_patch() 2024-09-07 09:09:27 +09:00
Yuya Nishihara
03487af192 diff: extract inter-diff helper
This isn't as primitive as show_diff() or show_patch(), but there are three
callers. Let's add a helper method to remove repo argument.
2024-09-07 09:09:27 +09:00
Yuya Nishihara
f473d7bb7e op diff: pass merged repo in to DiffRenderer
Since DiffRenderer borrows a repo, it shouldn't be constructed from the base
WorkspaceCommandHelper.
2024-09-07 09:09:27 +09:00
Yuya Nishihara
b7caaf586b op diff: pass DiffRenderer in to show_op_diff() by reference
show_op_diff() doesn't need an ownership of renderer.
2024-09-07 09:09:17 +09:00
Yuya Nishihara
5bff5cdef0 op diff: create formatter by show_op_diff() callers
This will help embed operation diffs in "op log".
2024-09-07 09:09:17 +09:00
Yuya Nishihara
ea8f543d5a op show: accept root operation by mapping empty parents to root
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.
2024-09-07 09:09:17 +09:00
Austin Seipp
a31fe7f6d6 cli: implement workspace add --sparse-patterns
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>
2024-09-06 16:22:47 -05:00
Danny Hooper
bf543402cc cli: fix: add --include-unchanged-files flag to allow fixing as yet unchanged files
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.
2024-09-06 13:50:28 -05:00
Martin von Zweigbergk
fee706dfea signing: allow disabling by setting backend to "none"
We don't seem to have a way to override the config to disable
signing. This patch lets you do that by setting
`signing.backend="none"`.
2024-09-05 21:02:22 -07:00
Yuya Nishihara
6ea46b930b op diff: resolve GraphStyle by caller, remove &CommandHelper argument
show_op_diff() has many arguments. Let's make it a bit less.
2024-09-06 09:51:10 +09:00
Yuya Nishihara
dda0980c4d graphlog: inline node_template_for_key()
It's easier to follow than function call with 3 string parameters.
2024-09-06 09:51:10 +09:00
Yuya Nishihara
36ab165b57 cli: parse graph node settings strictly 2024-09-06 09:51:10 +09:00
Yuya Nishihara
406ead241b graphlog: load settings by caller
I'll make it error out if the style name is invalid.
2024-09-06 09:51:10 +09:00
Yuya Nishihara
bd7cbaaffb graphlog: add enum describing graph style 2024-09-06 09:51:10 +09:00