Commit graph

572 commits

Author SHA1 Message Date
Martin von Zweigbergk
96d559a4b4 cli: allow overriding $EDITOR variable by ui.editor config 2022-04-10 09:13:51 -07:00
Martin von Zweigbergk
2958f5791c cli: don't crash if $EDITOR fails 2022-04-10 09:13:51 -07:00
Martin von Zweigbergk
486f49435b cli: if $JJ_CONFIG points to a directory, read all files in it
It's annoying especially for tests to not be able to append to a
config file without knowing the contents (as you have to do with
TOML). Let's read all files in a directory if `$JJ_CONFIG` points to a
directory. Mercurial does that for its `$HGRCPATH` variable.
2022-04-10 09:13:51 -07:00
Martin von Zweigbergk
4be0da3607 cli: teach jj squash to move only changes to specified paths 2022-04-09 16:13:01 -07:00
Martin von Zweigbergk
082ec5ae3b cli: teach jj move to move only changes to specified paths
I quite often want to move the changes to a particular file from one
commit to another. We already support that using `jj move -i`, but
that can be annoying to run because we don't have a TUI for it
(#48). Let's make it possible to do `jj move --from X --to Y <path>`.
2022-04-09 16:13:01 -07:00
Martin von Zweigbergk
9a15e32351 cli: require at least one path for jj untrack
It seems very unlikely that the user would want to untrack all paths
(that's still possible with `jj untrack .`, if they really want to,
and have added all their current paths to the `.gitignore`).
2022-04-09 16:13:01 -07:00
Martin von Zweigbergk
bc3c2db828 cli: print errors to stderr 2022-04-09 16:13:01 -07:00
Martin von Zweigbergk
7a013a59ae cli: add a command for printing the contents of a file in a revision
I'm adding this mostly because it's useful for testing. That's also
the reason it supports displaying conflicts. I didn't call it `cat`
like `hg cat` because I haven't found `hg cat` on multiple files
useful.
2022-04-06 23:31:28 -07:00
Martin von Zweigbergk
6efa47814a release: release version 0.4.0
This release is mostly about the fix for #177, which looks pretty bad
even though I think it is actually harmless. It also has `jj log -p`
contributed by @yuja!
2022-04-02 23:35:15 -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
197f669976 cli: fix git-colocated working copy on Windows
This patch adds a very simple e2e test of having a working copy shared
with Git. The test initially failed on Windows. The symptom was that
the "master" branch did not get updated when we create a commit using
`jj`. That suggested that we didn't correctly detect that the working
copy was shared. After a lot of troubleshooting, I think I mostly
understand what we going on here (thanks to @arxanas for suggesting
https://github.com/mxschmitt/action-tmate). The path we get from
`git2::Repository::workdir()` seems to not be canonicalized in the
same way as `std::fs::canonicalize()` canonicalizes. Specifically, it
does not have the "\\?\" prefix we get from that function. I suppose
that's because libgit2 is a C library and canonicalizes the path using
some other system call.
2022-03-30 22:09:55 -07:00
Yuya Nishihara
a7e3269ed8 log: add -p/--patch option to show diff along with commit meta data
"log -p | less" is the option I often use with hg/git to find interesting
bits from the changelog, and I think it's also valid with jj. Unlike
"hg log -p --stat", "jj log -p --summary" does not show both diff summary
and patch to reflect the internal structure. This behavoir is arguable and
may be changed later.

The logic of show_patch() is extracted from cmd_show().
2022-03-30 16:24:34 -07:00
Martin von Zweigbergk
04ad9a3628 repo: when merging in removed head, rebase descendants (#111) 2022-03-26 22:31:49 -07:00
Martin von Zweigbergk
a663a5d89c repo: don't abandon empty commit if it has descendants
It's unusual for the current commit to have descendants, but it can
happen. In particular, it can easily happen when you run `jj new`. You
probably don't want to abandon it in those cases.
2022-03-26 21:11:42 -07:00
Martin von Zweigbergk
0ceb4f0dce cli: teach jj new to set initial description with -m
I rarely use `jj new`, so this feature is mostly for use in tests.
2022-03-26 21:11:42 -07:00
Martin von Zweigbergk
2f59e8b68a cli: respect $NO_COLOR environment variable 2022-03-23 09:57:42 -07:00
Martin von Zweigbergk
7ba1c6bdb6 config: add support for a $JJ_CONFIG environment variable
It's useful for tests, scripts, and debugging to be able to use
specific config instead of the user's config. That's especially true
for our automated tests because they didn't have a place to read
config from on Windows before this patch (they read their config from
`{FOLDERID_RoamingAppData}`, which I don't think we can override in
tests).
2022-03-23 09:57:42 -07:00
Martin von Zweigbergk
095fb9fef4 config: drop support for ~/.jjconfig
I'm a little hesitant to do this because most tools I'm familiar with
have the config file directly in `~/`. It's also easier to describe
where to put the file if it doesn't vary across platforms. But we're
still early in the project, so let's try it and see if we get any
complaints.
2022-03-23 09:57:42 -07:00
Martin von Zweigbergk
cc13a2ec84 release: include the two recent no-op releases in the changelog
I keep forgetting to update things while doing a release...
2022-03-17 06:03:10 -07:00
Martin von Zweigbergk
a46bda3d49 release: update release notes for 0.3.1
I forgot to do this when I bumped the version number.
2022-03-13 21:54:45 -07:00
Martin von Zweigbergk
c14e138698 cli: expand ~ in core.excludesFile, don't crash when missing
I thought that `std::fs::canonicalize()` expanded "~", but it doesn't
seem to do that, which caused #131. Git seems to do the expansion
itself, so we probably also should. More importantly
`std::fs::canonicalize()` crashes when the file doesn't exist. The
manual expansion we do now does not.

Closes #131.
2022-03-13 12:40:37 -07:00
Martin von Zweigbergk
1777d85550 release: add a changelog 2022-03-12 23:03:01 -08:00