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

665 commits

Author SHA1 Message Date
Martin von Zweigbergk
3c6a922b97 docs: don't hide demos in collapsed regions in the README 2021-10-27 16:09:05 -07:00
Martin von Zweigbergk
04e54b093d demos: make comment lines shorter, to better fit on mobile 2021-10-27 16:09:01 -07:00
Martin von Zweigbergk
6687f98d8a cli and docs: replace "id" by more correct "ID" 2021-10-27 15:06:10 -07:00
Martin von Zweigbergk
3587d4ec7e cli: use bright colors for the current checkout
As @arxanas noted, it's hard to tell which commit is currently checked
out. Hopefully bright colors will help. Maybe setting a background
color would be even clearer, but that's harder to do because the
formatter doesn't support background colors yet.
2021-10-27 14:16:13 -07:00
Martin von Zweigbergk
b3ad965a3b formatter: delete default colors for obsolete, evolution-related labels 2021-10-27 14:13:01 -07:00
Martin von Zweigbergk
452fecb7c4 cli: colorize diff summary and sort by path
The order used to be like Mercurial's and the (lack of) coloring used
to be like Git's. Let's try the opposite :)
2021-10-27 14:13:01 -07:00
Martin von Zweigbergk
7917bad5b2 cli: rename "left"/"right" formatter labels to "removed"/"added" 2021-10-27 13:39:59 -07:00
Martin von Zweigbergk
c13b5ae50e cli: make jj branch --delete/--forget error out if branch doesn't exist 2021-10-26 06:12:17 -07:00
Martin von Zweigbergk
9abee0096f conflicts: propagate errors from materialize_conflict()
All current callers pass in a buffer, so it should never fail, but the
function itself can't know that.
2021-10-24 23:02:00 -07:00
Martin von Zweigbergk
191c1ee166 cli: make "added {} files, modified {} files, ..." message start with uppercase
We pretty consistently start with uppercase so this message stood out
and bothered me.
2021-10-24 12:46:01 -07:00
Martin von Zweigbergk
50058d8a31 cli: show help when jj git remote is called without subcommand 2021-10-23 20:55:18 -07:00
Martin von Zweigbergk
0f46c2453e revset graph: fix formatting I missed in recent commit 2021-10-23 20:53:41 -07:00
Martin von Zweigbergk
a3a13f8bbf demos: update demo recordings with stable graph edge ordering 2021-10-23 20:45:51 -07:00
Martin von Zweigbergk
b4a0e513dd revset graph: make order of edges stable
While working on demos, I noticed that `jj log` output in the
octocat/Hello-World repo was unstable: sometimes the first parent of
the merge was on the left and sometimes it was on the right. This
patch fixes that by sorting the edges by position in the index just
before returning them. It seems that most applications would want
stable output so I put it in the `RevsetGraphIterator` rather than
doing at the call site in the CLI. I ordered them with the reverse
index position rather than forward because it seemed to make the
graphs in the git.git repo slight nicer, with the left-most edge going
between subsequent releases.

There performance difference is within the noise level.
2021-10-23 20:33:59 -07:00
Martin von Zweigbergk
5acd360e86 demos: update conflict-resolution demo link to a lower-resolution version
I forgot to make my terminal window smaller before recording the
previous version.
2021-10-23 14:48:08 -07:00
Martin von Zweigbergk
c661181e08 demos: add demo of basic conflict resolution 2021-10-23 14:40:33 -07:00
Martin von Zweigbergk
78050b3d42 demos: add a --fast mode to speed up recording
It can take quite a while to record a demo. This patch adds a `--fast`
flag for reducing delays to a tenth of the usual. You can play the
recording with `asciinema play -s 0.1` to get close-to-normal speed
(except that command delays will be slower). That way you can adjust
timings with shorter round-trips.
2021-10-23 14:21:15 -07:00
Martin von Zweigbergk
2a5f0991fa demos: replace printf by regular shell variable expansion
This makes it clearer where each variable goes since they're not all
called "%s". I'm about to add more variables.
2021-10-23 09:32:18 -07:00
Martin von Zweigbergk
33bf6ce1d5 view: don't force commits pointed to by refs to be current heads
If you rewrite a commit that's also available on some remote, you'll
currently see both the old version and the new version in the view,
which means they're divergent. They're not logically divergent (the
rewritten version should replace the old version), so this is a UX
bug. I think it indicates that the set of current heads should be
redefined to be the *desired* heads. That's also what I had suspected
in the TODO removed by this change.  I think another indication that
we should hide the old heads even if they have e.g. a remote branch
pointing to them is that we don't want them to be rebased if we
rewrite an ancestor.

So that's what I decided to do: let the view's heads be the desired
heads. The user can still define revsets for showing non-current
commits pointed to by e.g. remote branches.
2021-10-23 09:15:05 -07:00
Martin von Zweigbergk
97612f9e99 demos: add demo of the operation log 2021-10-22 23:52:16 -07:00
Martin von Zweigbergk
74e21acd02 demos: add demo of automatic working copy commit 2021-10-22 21:59:07 -07:00
Martin von Zweigbergk
f72e53376f demos: set title when creating recording
According to asciinema.org, it should be possible to change the title
after uploading, but I couldn't figure out how to do that. Let's set
it when creating the recording. That also means it's one less step to
perform when re-running scripts.
2021-10-22 21:34:54 -07:00
Martin von Zweigbergk
2dd0bf7b12 demos: type faster, pause more
I find it frustrating to wait for the typing, but I need much more
time to think between commands (and users who are new to the tool
surely need even more time).
2021-10-22 18:36:00 -07:00
Martin von Zweigbergk
b1d473eafb demos: make run_command wait for the prompt
Most commands are non-interactive, so this reduces duplication. We can
add another function for running a command and not waiting for a
prompt when we need it.
2021-10-22 18:04:43 -07:00
Martin von Zweigbergk
234cb15ff8 demos: add automated demo of cloning Git repo
The automation is mostly copied from
https://github.com/arxanas/git-branchless/tree/master/demos, so big
thanks to @arxanas for writing that!
2021-10-22 13:56:30 -07:00
Martin von Zweigbergk
f35f2f0c97 docs: update tutorial with removed "at" from diff headers
I forgot to include this in the previous commit.
2021-10-22 13:05:04 -07:00
Martin von Zweigbergk
5098270640 cli: remove "at" from "Modified file at README" etc.
This patch changes the preposition depending on the case and removes
it in most cases.
2021-10-22 12:47:22 -07:00
Martin von Zweigbergk
709b2e85c2 cli: use finish_transaction() for remaining two commands too
I don't think it matters here, but it might in the future, and this is
more consistent anyway.
2021-10-22 12:17:28 -07:00
Martin von Zweigbergk
a9aff0b7fe cli: abandon the initial checkout after cloning Git repo
The CLI code for cloning a Git repo didn't use the usual
`finish_transaction()` method, because we didn't have support for
doing that on a repo that was creating half-way through a
command. That led to a bug where it would leave the initial checkout
(the one on top of the root commit) after checking out the correct
head.
2021-10-22 12:08:47 -07:00
Martin von Zweigbergk
c0ae4b16e8 trees: try to resolve file conflicts after simplifying conflicts
This fixes a bug I've run into somewhat frequently. What happens is
that if you have a conflict on top of another conflict and you resolve
the conflict in the bottom commit, we just simplify the `Conflict`
object in the second commit, but we don't try to resolve the new
conflict. That shows up as an unexpected "conflict" in `jj log`
output, and when you check out the commit, there are actually no
conflicts, so you can just `jj squash` right away.

This patch fixes that bug. It also teaches the code to work with more
than 3 parts in the merge, so if there's a 5-way conflict, for
example, we still try to resolve it if possible.
2021-10-22 09:20:50 -07:00
Martin von Zweigbergk
f1e2124a64 trees: make simplify_conflict() always return a Conflict
The interface is much cleaner this way. The function no longer makes
any writes to the store.
2021-10-20 22:07:42 -07:00
Martin von Zweigbergk
ffa727eb51 cli: add jj undo as shortcut for jj op undo
`jj undo` is probably what people would reach for first. It's also the
most commonly used `jj op` command, so it's nice to make it quick to
type.
2021-10-20 21:52:16 -07:00
Martin von Zweigbergk
ef616222a9 cli: rename ArgMatcher variables from *_matches to *_args
`args` seems to make it clear that these are command-line arguments
(this is not Python, so there's no `*args`). It also avoids the risk
of conflicts and confusion with other matches (e.g. file patterns or
regexes).
2021-10-20 21:46:08 -07:00
Martin von Zweigbergk
38607c1d29 cli: remove (another) mistakenly prefixed underscore from used variable 2021-10-20 21:41:34 -07:00
Martin von Zweigbergk
fa09f1531d cli: remove unused intermediate-level ArgMatches arguments 2021-10-20 17:00:07 -07:00
Martin von Zweigbergk
9a3127e659 cli: remove mistakenly prefixed underscore from used variable 2021-10-20 16:43:03 -07:00
Martin von Zweigbergk
2e4dc019d9 git: don't update public heads for now 2021-10-20 14:23:58 -07:00
Martin von Zweigbergk
579bd4b3bf docs: update alias in tutorial to not use public_heads() revset
We don't update public heads very well yet and I'd like to take a
shortcut and simply not have care about public heads for now.
2021-10-20 14:19:04 -07:00
Martin von Zweigbergk
23c3e02134 stacked_table: don't expect a certain listing order from the file system 2021-10-20 13:53:32 -07:00
Martin von Zweigbergk
c260fea811 GitBackend: move extra metadata from Git notes to stacked-table storage
Git notes (at least as implemented by libgit2) quickly gets really
slow, as noted in issue #7. This patch replaces it by a custom storage
format.

I tested the performance in the git.git repo with just a few hundred
annotated commits (~450, I think) and no sharding. I listed the first
~2900 commits there using `jj log --no-graph -r ,,v1.0.0 -T 'author
"\n"' | wc -l`. That took about 882ms. After this patch, it dropped to
108ms.

I did a similar test in this repo with 12700 annotated commits and
sharding, listing all visible commits. That took 142ms before this
patch (the sharding helps a lot!) and 55ms after.

Closes #3.
Closes #7.
2021-10-20 13:22:59 -07:00
Martin von Zweigbergk
deddd90762 stacked_table: add caching of tables
We don't want to re-read the whole table(s) every time we read extra
metadata for a commit (which is the immediate use-case I'm aiming for
in #7)..
2021-10-20 13:22:36 -07:00
Martin von Zweigbergk
85773cf81f stacked_table: add a generic store based on the stacked-table format
The new store works the same way as the `OpHeadsStore`. It keeps track
of the current head file(s) by recording their names in a
directory. When a write happens, it adds the new head and then removes
the old head. There will be generally be a single head at a time. The
only exception is when there's been concurrent operations (locally, or
remotely, in the case of a distributed file system). When there are
multiple heads files, they are automatically merged. No guarantee is
given about which value wins if the key exists in several heads; the
store is meant to be used for data that's immutable once written. As
long as different keys are written, this is a CRDT. That makes it fit
for solving both #3 and #7.
2021-10-20 13:21:12 -07:00
Martin von Zweigbergk
e86d266e6b stacked_table: add a file format for stacked, sorted tables
I'm trying to replace the Git backend's use of Git notes for storing
metadata (#7). This patch adds a file format that I hope can be used
for that. It's a simple generic format for storing fixed-size keys and
associated variable-size values. The keys are stored in sorted
order. Each key is followed by an offset to the value. The offset is
relative to the first value. All values are concatenated after each
other. I suppose it's a bit like Git's pack files but lacking both
delta-encoding and compression.

Each file can also have a parent pointer (just like the index files
have), so we don't have to rewrite the whole file each time. As with
the index files, the new format squashes a file into its parent if it
contains more than half the number of entries of the parent. The code
is also based on `index.rs`.

Perhaps we can alo replace the default operation storage with this
format. Maybe also the native local backend's storage. We'll need
delta-encoding and compression soon then.
2021-10-20 13:19:32 -07:00
Martin von Zweigbergk
d8795b9ae7 store: move logic for initialization of GitBackend to that type 2021-10-18 08:49:22 -07:00
Martin von Zweigbergk
c3ac110f3b tutorial: avoid a "the same repo" referring back to installation instructions 2021-10-18 08:49:00 -07:00
Martin von Zweigbergk
e8f44fb470 index: remove predecessor information from the index
Since we removed the evolution state in commit 4c4e436f38, we no
longer use the predecessor information in the index, so let's remove
it.
2021-10-17 09:13:31 -07:00
Martin von Zweigbergk
0354b8721b index: transparently reindex if the index is corrupt
I'm about to change the index format (to remove predecessor
information), which will break the format. Let's prepare for that by
having `IndexStore` reindex the repo if it fails to read the index..
2021-10-17 09:13:31 -07:00
Martin von Zweigbergk
6722a79e27 repo: fix crash on upgrade of repo backed by external Git repo
If the repo is backed by Git repo that's not inside `.jj/`, then
there's no `.jj/git/` directory to move into `.jj/store/`.
2021-10-14 16:41:57 -07:00
Martin von Zweigbergk
97b48635f6 repo: move Backend initialization to Store
This is just a cleanup. Now only `Store` knows how to tell which
backend to use.
2021-10-13 23:55:16 -07: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