Commit graph

31 commits

Author SHA1 Message Date
Yuya Nishihara
139fe08419 templater: fix id of brackets-prefix format to respect total length
I think the intent of '- 1' here is the separator length, which was
originally ':'. Alternatively, we can ensure that prefix + remainder is
always 12 chars.
2023-01-19 16:41:50 +09:00
Ilya Grigoriev
e7c434d492 Make ui.unique-prefixes default to brackets 2023-01-17 22:01:09 -08:00
Martin von Zweigbergk
d8feed9be4 copyright: change from "Google LLC" to "The Jujutsu Authors"
Let's acknowledge everyone's contributions by replacing "Google LLC"
in the copyright header by "The Jujutsu Authors". If I understand
correctly, it won't have any legal effect, but maybe it still helps
reduce concerns from contributors (though I haven't heard any
concerns).

Google employees can read about Google's policy at
go/releasing/contributions#copyright.
2022-11-28 06:05:45 -10:00
Martin von Zweigbergk
50ba571527 log: move commit ID off to the right
We have talked about showing the commit ID only for divergent changes
because it's generally easier to work with the change ID, and it's
less likely to result in a divergent change. However, it's useful to
have the commit ID available for pasting into e.g. a commit message or
the GitHub UI. To try to steer users towards using the change ID, this
commit moves the commit ID off to the right in the log output.

I put it just after the "divergent" field, because that makes it close
to how I imagine it would look if we decided to hide the commit ID
except for divergent changes. I was thinking that could be rendered as
"divergent (abc123)". So if we add config to hide the commit ID, then
it would be rendered almost the same for divergent commits (just with
the added parentheses). It would also make sense to replace the
"divergent" field by a question mark on the change ID, since change
IDs basically behave like branches. If we do that, then the placement
of the commit ID I picked in this commit does not make sense.
2022-11-14 07:49:52 -08:00
Martin von Zweigbergk
4ec2092e57 templates: allow using string in if-condition; use in default template
Given how easy this was, I can't believe I didn't make the change
sooner.

I haven't updated the screenshots in the readme because I plan to make
some further changes to the default template. I'll update them after
those changes.
2022-11-13 20:24:24 -08:00
Martin von Zweigbergk
92f6571b31 cli: use "hint" style for hint about using --git-repo=. 2022-11-12 17:58:22 -08:00
Martin von Zweigbergk
6a15cc02bf cli: print hints using "hint" style, not "error" style
Several lines of red text can be overwhelming, and makes it harder to
tell the hint from the error. Let's separate the hint from the error
instead. This matches what hg does. Having the hints separated out
also means that we could have a single config to turn them off.
2022-11-12 17:58:22 -08:00
Yuya Nishihara
5d42c9ebca cli: handle init destination error gracefully 2022-11-05 22:50:29 +09:00
Martin von Zweigbergk
0870c47559 cli: on init, don't crash when Git repo doesn't exist 2022-11-03 19:27:17 -07:00
Yuya Nishihara
55184237e1 cli: suggest 'jj init --git-repo' if .git directory already exists
I made new empty repository by mistake, and didn't notice it until I ran
'jj status'.
2022-10-31 01:00:40 +09:00
Martin von Zweigbergk
af4d183c7e cleanup: automated fixes by new Clippy version 2022-10-09 12:20:15 -07:00
Martin von Zweigbergk
043d118f1f cli: disallow initializing repo with native backend by default
The native backend is just a proof of concept and there's no real
reason to use it other than for testing, so let's reduce the risk of
accidentally creating repos using it.
2022-10-09 01:00:03 -07:00
Martin von Zweigbergk
0865b1ccff cli: show placeholder text for empty commit message
It can be confusing that some commits (typically the working copy)
don't have a description. Let's show a placeholder text in such cases.

I chose the format to match the "(no email configured)" message we
already have.
2022-05-18 09:16:04 -07:00
Martin von Zweigbergk
8ef00a3498 tests: re-run with insta crate version b9d99e87065b 2022-04-28 16:55:10 -07:00
Martin von Zweigbergk
8745ee7030 cli: use . in output for current directory instead of empty string 2022-04-20 13:52:25 -07:00
Martin von Zweigbergk
710d51c45b tests: move testutils from src/ to tests/ 2022-04-02 14:22:58 -07:00
Martin von Zweigbergk
034fbb47e3 cli: fix crash when initializing workspace colocated with Git repo
When initializing a workspace that shares its working copy with a Git
repo (i.e. `jj init --git-repo=.`), we import refs and HEAD when
creating the `WorkspaceCommandHelper` (as we do for all commands when
the working copy is shared). That makes the explicit import we do in
`cmd_init()` unnecessary. It also makes the checkout of HEAD I added
for the fix of #102 unnecessary. More importantly, as @yuja reported
in #177, it makes the command crash (at least if the repo is small
enough that the two checkouts happen within a second). I think the
problem is that the second checkout tries to create the same commit
except that the Change ID is different (the problem is not the
predecessors as I speculated in the issue tracker). The fix is to
simply avoid doing the redundant work. We still need a proper fix for
#27 eventually.

Closes #177.
2022-03-30 22:09:55 -07:00
Martin von Zweigbergk
23c7581ce1 tests: add a convenience function for running jj successfully
We very often expect success, and we sometimes want to get the stdout,
too. Let's add a convenience function for that. It saves a lot of
lines of code.
2022-03-26 21:11:42 -07:00
Martin von Zweigbergk
f6ba34f3c3 cli: when initializing repo backed by Git repo, check out Git's HEAD
Closes #102.
2022-03-10 12:53:40 -08:00
Martin von Zweigbergk
d475710d29 cli: print relative path to newly initialized repo
It's easier to test relative paths (no need to strip some prefix) and
it seems more user-friendly as well.
2022-03-10 12:53:40 -08:00
Martin von Zweigbergk
42252a2f00 cli: on jj init --git-repo=., use relative path to .git/
When the backing Git repo is inside the workspace (typically directly
in `.git/`), let's point to it by a relative path so the whole
workspace can be moved without breaking the link.

Closes #72.
2022-03-05 09:37:48 -08:00
Martin von Zweigbergk
bbf4ba4118 cli: on jj init --git-repo, point to Git repo's .git/
When using an internal Git repo (`jj init --git`), we make
`.jj/repo/store/git_target` point directly to the repo (which is bare
in that case). It makes sense to do the same when using an external
Git repo (`jj init --git-repo`), so the contents of
`.jj/repo/store/git_target` doesn't depend on whether the user
included the `.git/` on the CLI.
2022-03-05 09:37:48 -08:00
Martin von Zweigbergk
711f65303c tests: use assert_cmd for e2e tests
I didn't know about `assert_cmd` when I wrote the few e2e tests we
have. Let's switch to it and remove our own similar helpers.
2022-03-02 22:00:24 -08:00
Martin von Zweigbergk
ca055d91d9 workspace: store repo in .jj/repo/ (#13)
The `.jj/` directory contains information about two distinct parts:
the repo and the working copy. Most subdirectories are related to the
repo; only `.jj/working_copy/` is about the working copy. Let's move
the repo-related bits into a new `.jj/repo/` subdirectory. That makes
it clearer that they're related to the repo. It will probably also be
easier to manage when we have support for multiple workspaces backed
by a single repo.
2022-02-02 08:15:22 -08:00
Martin von Zweigbergk
51c351f272 cli: rename --git-store to --git-repo
"store" is just used internally, it's not something we should expose
to users.
2022-02-02 08:13:10 -08:00
Martin von Zweigbergk
1b6efdc3f8 repo: make .jj/store a directory also in Git-backed repos
I think this is just cleaner, and it gives us room to put other
store-related data in the `.jj/store/` directory. I may want to use
that place for writing the metadata we currently write in Git notes
(#7).
2021-10-13 23:42:25 -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
Jun Wu
2f93ebd42c commands: do not use debug print for path
"{:?}" escapes `\` to `\\` for Windows paths. That breaks tests checking
paths without using "{:?}". Use PathBuf::display() in both commands and
tests to get consistent output.

This fixes test_init_local, test_init_git_internal, and
test_init_git_external on Windows.
2021-03-14 15:51:32 -07:00
Martin von Zweigbergk
abc9dc1733 cargo: rename crates to names available on crates.io
I'm preparing to publish an early version before someone takes the
name(s) on crates.io. "jj" has been taken by a seemingly useless
project, but "jujube" and "jujube-lib" are still available, so let's
use those.
2021-01-03 10:16:00 -08:00
Martin von Zweigbergk
a8a9f7dedd init: add support for creating new repo backed by bare git repo in .jj/git/
It's annoying to have to have the Git repo and Jujube repo in separate
directories. This commit adds `jj init --git`, which creates a new
Jujube repo with an empty, bare git repo in `.jj/git/`. Hopefully the
`jj git` subcommands will eventually provide enough functionality for
working with the Git repo that the user won't have to use Git commands
directly. If they still do, they can run them from inside `.jj/git/`,
or create a new worktree based on that bare repo.

The implementation is quite straight-forward. One thing to note is
that I made `.jj/store` support relative paths to the Git repo. That's
mostly so the Jujube repo can be moved around freely.
2020-12-28 00:54:03 -08:00
Martin von Zweigbergk
6b1427cb46 import commit 0f15be02bf4012c116636913562691a0aaa7aed2 from my hg repo 2020-12-12 00:23:38 -08:00