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

644 commits

Author SHA1 Message Date
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
Martin von Zweigbergk
dba72af857 repo: move creation of directories .jj/* directories closer and earlier 2021-10-13 22:49:37 -07:00
Martin von Zweigbergk
ca796b49f0 docs: describe how to set up commmand-line completion 2021-10-13 20:45:55 -07:00
Martin von Zweigbergk
56e0f1254b docs: move initial configuration from tutorial to README
It seems better to have all the one-time setup in the README.
2021-10-13 20:37:48 -07:00
Martin von Zweigbergk
e9f57332cc cli: rename jj git refresh to jj git import
I've been planning to add a command for exporting refs to the backing
Git repo, so `jj git import` and `jj git export` seem like obvious
names then.
2021-10-13 16:16:33 -07:00
Martin von Zweigbergk
08b5193942 docs: update tutorial with new diff headers
I forgot to update the tutorial in the previous commit.
2021-10-13 16:13:25 -07:00
Martin von Zweigbergk
7731b8d902 cli: make color-words diff handle all file types
Diffs between certain combinations of file types were not handled by
`jj diff` (for example, a diff between a conflict and another conflict
would not show a diff). This change fixes that, and also makes added
and removed files get printed with color and line numbers, which I've
often wanted.
2021-10-13 15:48:25 -07:00
Martin von Zweigbergk
efba256bc2 cli: rename color-words functions to include color_words 2021-10-13 14:01:23 -07:00
Martin von Zweigbergk
c0a26f7642 conflicts: work around rust-lang/rust#89716 2021-10-13 13:41:09 -07:00
Martin von Zweigbergk
b4b64eb7e5 conflicts: add tests of conflict materialization 2021-10-13 13:40:25 -07:00
Martin von Zweigbergk
d914cc1dfd cli: add jj git remote remove command 2021-10-13 11:08:01 -07:00
Martin von Zweigbergk
e4f7795fd3 cli: add jj git remote add command
The user currently has to edit `.jj/git/config` (or run `git
--git-dir=.jj/git config`) to manage remotes in the underlying Git
repo. That's not very discoverable (and we may change the path some
day), so let's provide a command for it.
2021-10-13 10:59:29 -07:00
Martin von Zweigbergk
d8c0282873 revset: make head() accept candidate set to find heads within
With this change, you can do e.g. `heads(remote_branches())`. That
should currently be the same as `public_heads()`, except that we don't
yet remove public heads when remote branches have been updated. Having
this support should be generally useful, but I may use it in the short
term specifically for depending less on the public heads, until I get
around to keeping them up to date.
2021-10-13 09:41:20 -07:00
Martin von Zweigbergk
aebdd4e8fd revset: add all() function 2021-10-13 09:28:11 -07:00
Martin von Zweigbergk
5874d5abfb revset: add none() function 2021-10-13 09:24:08 -07:00
Martin von Zweigbergk
8fef1c2068 docs: move installation instructions from tutorial to README
I also changed the instructions to use `cargo install --git` pointing
straight to GitHub, so we don't have the naming conflict with the jj
repo created in the tutorial.
2021-10-13 08:52:40 -07:00
Martin von Zweigbergk
0e3b4b406a README: remove the empty "Future plans" section
This section has always been empty (IIRC). I think we'll use GitHub
issues for tracking remaining work instead.
2021-10-13 08:44:29 -07:00
Martin von Zweigbergk
8bbfe9731e cleanup: let newer Clippy fix a few things it found 2021-10-13 08:27:44 -07:00
Martin von Zweigbergk
94408f01e0 revset: extract a function for creating a revset from commit ids
This is just to avoid some repetition.
2021-10-10 12:44:35 -07:00
Martin von Zweigbergk
8465a578be revset: split out a new remote_branches() from branches()
It seems useful to be able to use `remote_branches()` in revsets
e.g. for filtering out commits known on remotes.
2021-10-10 12:24:48 -07:00
Martin von Zweigbergk
ebcd946732 cli: make default diff format configurable
This change adds a `diff.format` config option, which can be set to
"git", "color-words", or "summary".

Closes #33.
2021-10-10 09:37:07 -07:00
Martin von Zweigbergk
7add35999f cli: add support for Git's unified diff format
As #33 says, the default diff we have can be hard to read and it
cannot be used for use with other tools. This patch adds a `jj diff
--git` mode for showing Git's flavor of unified diffs.

We should add a config option to get these diffs by default. For
interchange with other tools, we also need a way of turnning off color
codes in output (it's currently always on, even when when not printing
to a TTY).
2021-10-10 00:10:19 -07:00