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

511 commits

Author SHA1 Message Date
Martin von Zweigbergk
014cf6e297 cli: make short description for jj describe fit on one line 2021-09-09 10:55:56 -07:00
Martin von Zweigbergk
77662c0674 readme: add "Status" section and stop saying it's not ready for use
I have been using the tool myself for 7-8 months now, and the UX has
improved substantially, so I think it's ready for use.
2021-09-08 10:40:13 -07:00
Martin von Zweigbergk
118d0cc31d cli: clarify that --help provides more help than -h
It turns out that `--help` provides a longer version of the help text
than `-h` does. I only discovered that because I was wondering what
the difference between `clap::App::about()` and
`clap::App::long_about()` was. There's clap-rs/clap#1015 for tracking
it in clap, but let's clarify it ourselves for now by changing the
help text for `-h/--help`.
2021-09-08 10:01:57 -07:00
Martin von Zweigbergk
826e69a10c cli: add help texts for all CLI arguments 2021-09-08 09:51:50 -07:00
Martin von Zweigbergk
ad96820642 cli: add concepts guide about the operation log 2021-09-06 22:24:55 -07:00
Martin von Zweigbergk
b3a93b903f cli: add concept guide about the working copy 2021-09-04 11:46:00 -07:00
Martin von Zweigbergk
49e1462fe5 working_copy: delete two obsolete TODOs about ignores
We have had support for ignores via `.gitignore` files since
3b326a942c, and we haven't had the problem with the temporary
`.git/` directory created by libgit2 since 88f7f4732b.
2021-09-03 23:10:45 -07:00
Martin von Zweigbergk
fa73b17c66 cli: add jj concepts subcommand for concept help, starting with "branches"
With this commit, you can run `jj concepts branches` to get help about
the "branches" concept. We don't have much help for other commands and
their arguments yet, but I'm starting with concept guides so we can
point to them as we add help for commands and their arguments.

I initially tried to make the command to get help be `jj help
--concept branches`. That would require replacing clap's
implementation of the help command with our own. clap-rs/clap#1350
prevented me from doing that. But I'm pretty happy with having it
under `jj concepts` anyway. It's probably more discoverable that way.

I tried to mimic clap's styling with yellow headings.
2021-09-02 23:06:46 -07:00
Martin von Zweigbergk
fddcaaada1 cli: set custom, imperative messages for --help and --version
Clap uses present tense by default (e.g. "Prints help information"). I
considered switching our message to that style, but I found it harder
to describe some flags that way.
2021-09-02 11:01:02 -07:00
Martin von Zweigbergk
d7cc09e918 cli: disable --version on subcommands
`jj st --version` and `jj op log --version` don't make any sense.
2021-09-02 11:01:02 -07:00
Martin von Zweigbergk
4e9be8d2a4 rustfmt: format string literals 2021-09-02 11:01:02 -07:00
Martin von Zweigbergk
88fef10eac cleanup: use literal newlines in string literals
I'm about to enable `rustfmt`'s formatting of string literals, and
that makes these string literals with escaped newlines harder to read.
2021-09-02 11:01:02 -07:00
Martin von Zweigbergk
ccdd651953 working_copy: ignore .git directory/file when writing tree to store
Git doesn't want `.git` entries in its trees, so at least when using
the Git backend, we need to ignore such paths. Let's just ignore
`.git` paths regardless of backend to keep it simple.

Closes #24.
2021-09-01 08:40:28 -07:00
Martin von Zweigbergk
538bec22ff tutorial: clarify that rustup install nightly doesn't change the default 2021-09-01 08:08:18 -07:00
Martin von Zweigbergk
ecbbac23be cli: require argument for jj open
The current checkout is always open, so it doesn't make sense to have
that as default.
2021-08-30 00:07:55 -07:00
Martin von Zweigbergk
f27ca16a16 rewrite: when rebasing descendants, actually rebase them
When I added the function for rebasing descendants, I forgot to call
the existing `rebase()` function and instead simply created a new
commit with the new parents but the old contents.
2021-08-29 09:42:37 -07:00
Martin von Zweigbergk
f13f15e057 cli: add jj rebase -s and make jj rebase -r rebase descendants onto parents
I think it makes sense to have a version of rebase that rebases the
descendants of the rebased commit onto the parents of the rebased
commit. Let's make `jj rebase -r` do just that. Let's also add `jj
rebase -s` (matching Mercurial's `hg rebase -s`) for rebasing a commit
and its descendants onto another commit.

Since both flavors of the command now explicitly rebase the
descendants (just to different destinations), I also made the command
not evolve orphans afterwards. That would have made sense regardless
of this commit.
2021-08-28 10:01:00 -07:00
Martin von Zweigbergk
4e0a89b3dd rewrite: add a function for rebasing descendant commits
This should be useful in lots of places. For example, `jj rebase -r`
currently rebases all descendants, because that's what the auto-evolve
feature does. I think it would be nice to instead copy from
Mercurial's `-s` flag for also rebasing descendants. Then `jj rebase
-r` can be made to pull a commit out of a stack, rebasing descendants
onto the rebased commit's parents. I also intend to use this
functionality for rebasing descendants when remote branches have been
rewritten.
2021-08-28 10:01:00 -07:00
Martin von Zweigbergk
658b41b4e9 revset: add methods on RevsetExpression for constructing them
This makes it much easier to create `RevsetExpression` instances
programmatically.
2021-08-28 10:00:59 -07:00
Martin von Zweigbergk
451451563b revset: work with Rc<RevsetExpression> everywhere
It's about break-even in this commit to `Rc` everywhere, but it will
allow big savings in the next commit.
2021-08-25 22:53:57 -07:00
Martin von Zweigbergk
52678237a7 cli: after cloning git repo, update to remote's HEAD 2021-08-25 21:42:32 -07:00
Martin von Zweigbergk
723ebb3809 cleanup: restructure escaped newlines to make new rustc happy 2021-08-18 10:06:15 -07:00
Martin von Zweigbergk
e99e86e826 tests: use CommitGraphBuilder in test_refs.rs
I guess I forgot about the helper when I added these tests recently.
2021-08-18 09:58:44 -07:00
Martin von Zweigbergk
c310477765 cleanup: fix formatting of commands.rs 2021-08-18 09:58:17 -07:00
Martin von Zweigbergk
b4d0549146 cli: make jj status report conflicted branches
This change makes `jj status` include a section about conflicted local
branches and another section about conflicted remote branches. They
show up only if there are conflicts. They include hints about how to
resolve.
2021-08-15 19:40:55 -07:00
Martin von Zweigbergk
5493b44ba5 cli: update branches when working copy committed 2021-08-15 19:01:14 -07:00
Martin von Zweigbergk
e66d3120c5 cli: evolve descendants when working copy committed 2021-08-15 19:01:14 -07:00
Martin von Zweigbergk
2afed65132 working_copy: move logic for creating commit to caller
The auto-rebasing of descendants doesn't work if you have an open
commit checked out, which means that you may still end up with orphans
in that case (though that's usually a short-lived problem since they
get rebased when you close the commit). I'm also about to make
branches update to successors, but that also doesn't work when the
branch is on a working copy commit that gets rewritten. To fix this
problem, I've decided to let the caller of `WorkingCopy::commit()`
responsible for the transaction.

I expect that some of the code that this change moves from the lib
crate to the cli crate will later move back into the lib crate in some
form.
2021-08-15 18:55:09 -07:00
Martin von Zweigbergk
0d24e72260 cli: extract a helper for evolving descendants
I want to reuse this bit of code for evolving descendants of a
rewritten working copy commit.

I expect this to change again soon (I'll probably make it do a regular
rebase instead of evolve), but this will do for now.
2021-08-15 18:37:08 -07:00
Martin von Zweigbergk
7deba1172c tests: remove an unnecessary wc.commit() right after wc.check_out() 2021-08-15 18:37:08 -07:00
Martin von Zweigbergk
3c1a9b4d10 cli: update branches after rewriting commits
This makes it so (local) branches get updated when the commit they
point to gets rewritten. If the branch was conflicted, we just print a
warning and don't update the branch (though one could imagine
rewriting the conflict). We also just print a warning if the new
target is unclear because the commit was rewritten into multiple new
commits (divergent).

The updating doesn't work when the working copy commit gets rewritten
because the working copy changed on disk. That's because that's done
in a separate transaction inside `working_copy.rs`. That's similar to
how orphans of the working copy commit don't get automatically
evolved. I'll fix both problems soon.
2021-08-15 18:35:24 -07:00
Martin von Zweigbergk
8fe4433c9c cli: make revision argument positional for jj describe
I missed this command in the previous change.
2021-08-15 18:29:02 -07:00
Martin von Zweigbergk
8ad60f8c99 cli: make revision argument position for some commands
For example, `jj open/close` doesn't seem to make sense with paths, so
let's save the user from typing "-r".
2021-08-15 17:20:26 -07:00
Martin von Zweigbergk
45f926c234 cli: don't require --allow-backwards when creating a branch
If a branch doesn't exist yet, it's clearly safe to move it "forward"
to any commit (it was simply a bug that we required
`--allow-backards`).
2021-08-11 11:15:14 -07:00
Martin von Zweigbergk
7f335a4632 repo: remove some incorrect "mut" modifiers 2021-08-11 10:58:38 -07:00
Martin von Zweigbergk
aba0d200e2 cleanup: fix bad formatting of commands.rs 2021-08-11 10:58:22 -07:00
Martin von Zweigbergk
42090c8078 cli: make jj branches also list remote branches if different from local 2021-08-11 09:19:20 -07:00
Martin von Zweigbergk
4878c94052 cli: color branch name and conflict marker in jj branches output 2021-08-11 09:15:08 -07:00
Martin von Zweigbergk
4594932fc0 git: remove trailing single quotes from error messages 2021-08-11 08:21:42 -07:00
Martin von Zweigbergk
81ba65e3a5 git: force push when not known to be a fast-forward
With this change, we no longer fail if the user moves a branch
sideways or backwards and then push.

The push should ideally only succeed if the remote branch is where we
thought it was (like `git push --force-with-lease`), but that requires
rust-lang/git2-rs#733 to be fixed first.
2021-08-04 23:28:42 -07:00
Martin von Zweigbergk
d555e0c326 git: when fetching, prune refs that have been deleted on the remote
Otherwise remote-tracking branches just pile up.

It seems that both git and libgit2 remove the remote-tracking branch
when you push a deletion, so `jj branch --delete foo; jj git push
--branch foo` already sees `foo` disappear locally as well. However,
if a branch has been deleted on the remote, we would never know before
this change.
2021-08-04 23:00:43 -07:00
Martin von Zweigbergk
8b8aff171e cli: delete branch from git remote when pushing locally deleted branch 2021-08-04 22:50:52 -07:00
Martin von Zweigbergk
e57948347e git: extract a function that can be reused for pushing branch-deletion 2021-08-04 22:14:43 -07:00
Martin von Zweigbergk
7dc82c1580 cli: make jj git push push given branch
Now that we have native branches, we can make `jj git push` only be
about pushing a branch to a remote branch with the same name.

We may want to add back support for the more advanced case of pushing
an arbitrary commit to an arbitrary branch later, but let's get the
common case simplified first.
2021-08-04 22:14:43 -07:00
Martin von Zweigbergk
f85613cf66 cli: make branch command's --delete flag actually a flag, and require name arg
I had forgotten to make the `delete` argument a flag by giving it a
name, so instead it conflicted with `name` argument, as tests
discovered.

While at it, I also made `name` required. It wasn't before because I
originally had a single command for `jj branch` and `jj branches` and
then I didn't think to make it required when I split them up.
2021-08-04 14:26:50 -07:00
Martin von Zweigbergk
10b2e25c30 cli: add a command for listing branches 2021-08-04 14:07:19 -07:00
Martin von Zweigbergk
40a260a37f cli: add a command for updating branches 2021-08-04 14:04:06 -07:00
Martin von Zweigbergk
aeab6660d9 revsets: add branches() and tags() functions
The `branches()` function resolves to all "adds" on both local and
remote branches.
2021-08-04 12:03:13 -07:00
Martin von Zweigbergk
15132a1166 cli: replace git refs by branches and tags in log output
Now that our own branches and tags are updated when git refs are
updated and the user can use them to specify revisions, we can start
displaying them instead of the git refs. This commit adds new
`branches` and `tags` template keywords and updates the default
templates to use them instead of `git_refs`.
2021-08-04 11:53:37 -07:00
Martin von Zweigbergk
7fad705062 revsets: add support for resolving symbols as tags and branches
This adds support for resolving tags and branches in revsets. Branches
and tags can be resolved by specifying their name (e.g. "main"). To
specify a branch's target on a remote, use e.g. "main@origin". In case
of conflicts, they get resolved to their "adds".
2021-08-04 11:42:03 -07:00