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

320 commits

Author SHA1 Message Date
Waleed Khan
409356fa5b merge_tools: enable :builtin as default diff/merge editor 2023-09-21 03:29:27 +02:00
Ruben Slabbert
f2f5ded5f0 revsets: add trunk alias with default to main/master/root 2023-09-17 10:17:23 +10:00
Zachary Dremann
2177dc0657 Allow \0 escape for nulls
This allows safely getting e.g. multiple descriptions, and knowing where the
boundaries are
2023-09-14 17:11:05 -04:00
Martin von Zweigbergk
8bfb6c10fd cli: add jj op log --no-graph
Seems useful, and makes it consistent with the `jj log` and `jj
obslog`.
2023-09-10 15:17:43 -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
James Sully
0946934ca6 revset: Add optional argument n to ancestors() in revset language 2023-09-08 02:50:58 +10:00
Martin von Zweigbergk
bafd1b568e changelog: more orphan entries under headings 2023-09-06 11:32:48 -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
Yuya Nishihara
a868b2d9a5 revset: do not lookup unimported tags or remote branches by unqualified name
Since e7e49527ef "git: ensure that remote branches never diverge", the last
known "refs/remotes" ref should be synced with the corresponding remote branch.
So we can always trust the branch@remote expression. We don't need "refs/tags"
lookup either since tags should have been imported by git::import_refs().

FWIW, I'm thinking of reorganizing view.git_refs() map as per-remote views.
It would be nice if we can get rid of revsets and template keywords exposing
low-level Git ref primitives.
2023-09-06 13:42:22 +09:00
Philip Metzger
f131dc9814 commands: Implement next and prev
This is a naive implementation, which cannot deal with multiple children
or parents stemming from merges.

Note: I gave each command separate a separate argument struct
for extensibility. 

Fixes #878
2023-09-05 23:13:39 +02:00
Yuya Nishihara
b0c8e9ef62 revset: add 0-ary "::" and ".." operators as short for "all()" and "~root()"
Suppose "x::y" is the operator that defaults to "root()::visible_heads()"
respectively, "::" is identical to "all()". Since we've just changed the
behavior of "..y", ".." is now "root()..visible_heads()" meaning "~root()".
2023-09-05 10:40:04 +09:00
Yuya Nishihara
6b2ad23f8f revset: evaluate "..y" expression to "root()..y"
This seems useful since the root commit is often uninteresting. It's also
consistent with "x::y" in a way that the left operand defaults to "root()".
2023-09-05 10:40:04 +09:00
Yuya Nishihara
e3c85d6ecc revset: convert root symbol to function
The idea is that we can fully eliminate special symbols that would otherwise
shadow user branches, tags, or change ID prefixes.

Closes #2095
2023-09-04 10:36:30 +09:00
Yuya Nishihara
35a596ff66 git: prohibit creation of remote named "git"
#1690
2023-08-29 22:50:46 +09:00
Yuya Nishihara
f422f1300c templater: move empty signature placeholder to user template
This patch also extracts format_detailed_signature() function to deduplicate
the "show" template bits.

The added placeholder templates aren't labeled as "empty". If needed, I think
the whole template can be labeled as "empty" (or "empty_commit") just like
"working_copy".

Closes #2112
2023-08-27 09:38:36 +09:00
Yuya Nishihara
75ebdf69a1 revset: parse @ like operator (but without alias substitution)
This is what I proposed in #2095. @ is now an operator to concatenate symbols.

Unlike the other operators, lhs/rhs of @ is not a target of alias substitution.
'x' in 'x@y' doesn't look like a named variable, though it's technically
possible to allow definition of an alias expanded to a symbol of specific remote
or vice versa. This will probably apply to the kind:pattern syntax, where
aliases are expanded due to the current implementation restriction. I've added
a TODO comment about that.
2023-08-26 07:47:12 +09:00
Zachary Dremann
ac448202da templates: Add more string methods
Add starts_with/ends_with/remove_prefix/remove_suffix/substr methods to string when templating.
2023-08-24 11:24:07 -04:00
Vladimir Petrzhikovskii
386f002f5a git: add --all-remotes to git fetch 2023-08-24 12:52:41 +02:00
Martin von Zweigbergk
0dcd2fa265 cli: make jj git push default to -r 'remote_branches()..@'
The way `jj git push` without arguments chooses branches pointing to
either `@` or `@-` is unusual and difficult to explain. Now that we
have `-r`, we could instead default it to `-r '@-::@'`. However, I
think it seems likely that users will want to push all local branches
leading up to `@` from the closest remote branch. That's typically
what I want. This patch changes the default to do that.
2023-08-23 15:00:03 -07:00
Piotr Kufel
2109a7b488 Fix .gitignore handling of ignored directories
- Ignore .gitignore files from untracked directories
 - Do not allow un-ignoring files within ignored directories
2023-08-22 22:08:32 -07:00
Ilya Grigoriev
038867fd3f merge_tools: Allow 3-pane diff editing
As discussed in https://github.com/martinvonz/jj/discussions/1905#discussioncomment-6589673
2023-08-21 20:19:15 -07:00
Martin von Zweigbergk
5f3df4aaea revset: resolve "@" symbol's workspace id earlier (while parsing)
We resolve file paths into repo-relative paths while parsing the
revset expression, so I think it's consistent to also resolve which
workspace "@" refers to while parsing it. That means we won't need the
workspace context both while parsing and while resolving symbols.

In order to break things like `author("martinvonz@")` (thanks to @yuja
for catching this), I also changed the parsing of working-copy
expressions so they are not allowed to be
quoted. `author(martinvonz@)` will therefore be an error now. That
seems like a small improvement anyway, since we have recently talked
about making `root` and `[workspace]@` not parsed as other symbols.
2023-08-20 17:57:18 -07:00
Preston Van Loon
ac5d8eb784 Add UTC format for timestamp formats. Thanks to @rauljordan for these changes.
Add tests for new UTC timestamp format

Add documentation for timestamp utc

Update CHANGELOG.md
2023-08-20 17:24:09 -05:00
Oscar Bonilla
5bd726f77d Add jj diffs --stat option 2023-08-19 23:49:16 -07:00
Yuya Nishihara
b6794ca04a revset: rename literal:"" prefix to exact:""
Per discussion in #2107, I believe "exact" is preferred.

We can also change the default to exact match, but it doesn't always make
sense. Exact match would be useful for branches(), but not for description().
We could define default per predicate function, but I'm pretty sure I cannot
remember which one is which.
2023-08-19 11:33:57 +09:00
Emily Fox
3f8ac2198d commits: use empty strings instead of placeholders for missing name or email
This commit replaces the functions `UserSettings::user_name_placeholder()`` and
`UserSettings::user_email_placeholder()` with `const` `&str`s to emphasize that
the placeholder strings must not be changed to support commits without
names or email addresses made before this change.
2023-08-18 17:22:59 -05:00
Emily Fox
fde6e43aa8 CHANGELOG: more precise description of mine() 2023-08-18 17:13:45 -05:00
Ben Saunders
351e7feef5 working_copy: don't snapshot new files larger than 1MiB by default 2023-08-17 19:29:38 -07:00
Yuya Nishihara
81f1ae38b3 revset: add literal:"string" pattern syntax
The syntax is slightly different from Mercurial. In Mercurial, a pattern must
be quoted like "<kind>:<needle>". In JJ, <kind> is a separate parsing node, and
it must not appear in a quoted string. This allows us to report unknown prefix
as an error.

There's another subtle behavior difference. In Mercurial, branch(unknown) is
an error, whereas our branches(literal:unknown) is resolved to an empty set.
I think erroring out doesn't make sense for JJ since branches() by default
performs substring matching, so its behavior is more like a filter.

The parser abuses DAG range syntax for now. It can be rewritten once we remove
the deprecated x:y range syntax.
2023-08-17 07:42:12 +09:00
Emily Fox
9ba9ecd708 revset: add function mine() 2023-08-16 11:00:14 -05:00
Martin von Zweigbergk
873634a80e cli: when splitting change without description, skip it on second part
One use case for `jj split` is when creating a new commit from some of
the changes in the working copy. If there's no description on the
working-copy commit in that case, it seems better to not ask the user
to provide one when they're splitting the commit either.
2023-08-15 10:12:12 -07:00
Anton Bulakh
dc6e1d7dee cli: hide irrelevant information about root commit in default log templates
I've extracted the `builtin_log_root` template for users to customize the
default templates without fully overriding them, for example I would remove
the change_id/commit_id for myself - and we discussed in Discord that leaving
those makes sense for the user to be reminded/teached that the root commit has
a change id made from z's.
2023-08-15 18:54:59 +03:00
Anton Bulakh
82923afcc5 templater: add root keyword
Similar to other boolean flags, such as "working_copy" or "empty".
We could test something like
`"0000000000000000000000000000000000000000".contains(commit_id)`
like I did for myself, but first of all this is ugly, and secondly the root
commit id is not guaranteed to be 40 zeroes as custom backend implementations
could have some other root.
2023-08-15 18:54:59 +03:00
Piotr Kufel
a8b02de5c3 Allow editing user-specific config file outside of a repo
This addresses #2054.
2023-08-13 11:35:56 -07:00
Vamsi Avula
bc57754c58 cli: add support for setting default description
That is, jj will use ui.default_description as a starting point when
user is about to describe an empty change.

I think it might be confusing to do this with -m / --stdin (violates
WYSIWYG), so I'm only doing this when jj invokes an editor.

Also, this could evolve into a proper template in the future instead of
just plain text, to allow inheriting from parent change(s), for example.

Partially addresses #1354.
2023-08-13 23:59:15 +05:30
Zachary Dremann
062f7a252b cli: Allow repeated -m options for multi-paragraph descriptions
Emulates git's behavior:
https://www.git-scm.com/docs/git-commit#Documentation/git-commit.txt--mltmsggt
2023-08-13 05:06:35 -04:00
Matt Stavola
4760b565c5 configs: add the ability to disable paging via ui.paginate 2023-08-11 12:45:53 -04:00
Yuya Nishihara
17b45d642f cli: add "--limit N" option to log-like commands
Copied from Mercurial. This isn't a revset predicate since our revset is
conceptually unordered.
2023-08-11 10:40:40 +09:00
Martin von Zweigbergk
a367f13c72 configs: use Notepad as default editor on Windows 2023-08-10 17:09:07 +00:00
Yuya Nishihara
b2101d15c8 cli: detect .git symlink as a colocated workspace
Maybe we could load GitBackend without resolving .git symlink, but that would
introduce more subtle bugs. Instead, we calculate the expected Git workdir path
from the canonical ".git" path.

Fixes #2011
2023-08-10 14:53:54 +09:00
Martin von Zweigbergk
56472297f0 git: add support for SSH authentication with ed25519 or ed25519-sk
This makes it possible to use ed25519 and ed25519-sk keys by trying
them one at a time. However, it still fails if one of them is
password-protected; we don't try the next key in that case.
2023-08-09 03:44:03 +00:00
Martin von Zweigbergk
c752b43db1 git: only try to use ssh-agent once per connection
As reported in #1970, SSH authentication would sometimes run into a
loop where it repeatedly tries to use ssh-agent for authentication
without making progess. The problem can be reproduced by simply
removing `$SSH_AUTH_KEY` from your environment (and not having a Git
credentials helper configured, I think).

This seems to be a bug introduced by b104f8e154c21. That commit meant
to make it so we attempt to use ssh-agent and fall back to using
(password-less) keys after that. The problem is that
`git2::Cred::ssh_key_from_agent()` just returns an object that will be
used later for looking up the credentials from ssh-agent, so the call
will not fail because ssh-agent is not reachable.

This commit attempts to fix the problem by having the credentials
callback attempt to use ssh-agent only once.
2023-08-08 07:41:13 +00:00
Ilya Grigoriev
74d9970908 config: Rename push.branch-prefix option to git.push-branch-prefix
This is for consistency with other `git.` options. See also
https://github.com/martinvonz/jj/pull/1962#discussion_r1282605185
2023-08-07 19:10:10 -07:00
Piotr Kufel
10cdef49f2 Allow initializing with bare git repositories 2023-08-03 23:54:27 -07:00
Yuya Nishihara
0b9d23c3ad cli: add option to generate textual diff by external command
This is basic implementation. There's no config knob to enable the external
diff command by default. It reuses the merge-tools table because that's how
external diff/merge commands are currently configured. We might want to
reorganize them in #1285.

If you run "jj diff --tool meld", GUI diff will open and jj will wait for
meld to quit. This also applies to "jj log -p". The "diff --tool gui" behavior
is somewhat useful, but "log -p --tool gui" wouldn't. We might want some flag
to mark the tool output can't be streamed.

Another thing to consider is tools that can't generate directory diffs. Git
executes ext-diff tool per file, but we don't. Difftastic can compare
directories, and doing that should be more efficient since diffs can be
computed in parallel (at the expense of unsorted output.)

Closes #1886
2023-08-03 13:53:37 +09:00
Ilya Grigoriev
315f698231 cli: New -changes-in argument to jj restore + docs
Also updates docstrings for `diffedit`, `abandon` in related ways. The changes
are a bit too intertwined to comfortable split into a separate commit.
2023-08-01 15:28:00 -07:00
Chris Poucet
56e6233f9e commands: Support the option of colocating a git repo with a jj repo
This adds the new --colocate flag to `jj git clone`.

```
jj git clone --colocate https://github.com/foo/bar
```

is effectively equivalent to:

```
git clone https://github.com/foo/bar
cd bar
jj init --git-repo=.
```
2023-07-29 18:43:17 +02:00
Martin von Zweigbergk
9c8d8b73b8 cli: replace --allow-large-revsets by use of all: prefix
See the earlier commit introducing the `::` operator for reasoning.
2023-07-28 22:30:40 -07:00
Martin von Zweigbergk
aaf5df95a8 rebase/new: make --allow-large-revset no longer also allow duplicates
The `--allow-large-revset` option for `jj rebase` and `jj new` is used
for allowing a single revset to resolve to more than one destination
commit. It also means that duplicate commits between individual
revsets are allowed (e.g. `jj rebase -d x -d 'x|y'`). I'm about to
replace the first meaning of the flag by a revset function. I don't
think it's worth keeping the flag only for the second meaning, so I'm
just removing the feature instead. We can add it back under a
different name (`--allow-duplicate-destinations`?) if people care
about it.
2023-07-28 22:30:40 -07:00
Martin von Zweigbergk
c183b94aef cli: warn when using : revset operator 2023-07-28 22:30:40 -07:00