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

884 commits

Author SHA1 Message Date
Martin von Zweigbergk
2af6b4c58d tests: don't create workspaces in operation tests 2022-02-05 15:35:59 -08:00
Martin von Zweigbergk
2eb46fda8a tests: don't create workspaces in diff-summary tests 2022-02-05 15:31:09 -08:00
Martin von Zweigbergk
978cafe387 tests: don't create workspaces in RevsetGraphIterator tests 2022-02-05 15:30:27 -08:00
Martin von Zweigbergk
214c0793b0 tests: don't create workspaces in MutableRepo tests 2022-02-05 15:27:02 -08:00
Martin von Zweigbergk
10fbe2cb55 tests: don't create workspaces in revset tests 2022-02-05 15:13:07 -08:00
Martin von Zweigbergk
8d5587355b tests: don't create workspaces in rewrite tests 2022-02-05 15:02:10 -08:00
Martin von Zweigbergk
fbc13440a1 tests: don't create workspaces in tree-merge tests 2022-02-05 13:47:48 -08:00
Martin von Zweigbergk
db47e14f69 tests: don't create workspaces in repo-loading tests 2022-02-05 13:47:48 -08:00
Martin von Zweigbergk
0fd3b8ef1a tests: don't create workspaces in view tests
Even the checkout tests need only a repo!
2022-02-05 13:47:48 -08:00
Martin von Zweigbergk
785212d05d tests: don't create workspaces in git tests 2022-02-05 13:45:41 -08:00
Martin von Zweigbergk
e871f64d1e tests: don't create workspaces in index tests 2022-02-05 13:45:41 -08:00
Martin von Zweigbergk
abedeeaacf tests: rename init_repo() to init_workspace()
Most tests need a repo but don't need a working copy. Let's have a
function for setting up a test repo. But first, let's free up the name
`init_repo()` by renaming it to `init_workspace()` (which is also more
accurate).
2022-02-05 13:02:19 -08:00
Martin von Zweigbergk
731aa7578e cli: allow specifying a custom workspace name
We use the destination directory's basename as the workspace
name. Let's allow the user to choose a different name.
2022-02-05 11:27:41 -08:00
Martin von Zweigbergk
0ee09c9f29 cli: don't allow creating multiple workspaces with the same name
It's harmless but potentially confusing to have multiple workspaces
with the same ID (it would mean that they always have the same
checkout). Let's just prevent it for now. We can add an override later
if people think of usecases for it.
2022-02-05 11:15:51 -08:00
Martin von Zweigbergk
53b458a601 cli: clarify error when trying to forget non-existent workspace
When you try to forget a workspace that doesn't exist, we say "Nothing
changed.", since the transaction is empty. Let's have a specific error
instead.
2022-02-05 11:04:11 -08:00
Martin von Zweigbergk
62f541e8cd tests: check that workspace's repo path match canonicalized source path
Hopefully this will fix the failing test on Windows.
2022-02-02 22:22:52 -08:00
Martin von Zweigbergk
f6628923dc cli: when checking if jj co destination is checked out, handle absence (#13)
When you run `jj co abc123` and that commit is already checked out, we
just print a message. The condition for that assumed that the checkout
existed, which it won't if you just ran `jj workspace forget`. Let's
avoid that crash, especially since `jj co` is an easy way to restore
the working copy if you had accidentally run `jj workspace forget`
(though `jj undo` is even easier).
2022-02-02 21:56:58 -08:00
Martin von Zweigbergk
ef60da0472 cli: add a command for forgetting a workspace (#13) 2022-02-02 21:52:40 -08:00
Martin von Zweigbergk
4eddb72edb cli: add a command for listing workspaces (#13) 2022-02-02 21:37:34 -08:00
Martin von Zweigbergk
bcece02084 cli: indicate each workspace's checkout in log (#13)
It seems helpful to show in the log output which commit is checked out
in which workspace, so let's try that. I made it only show the
information if there are multiple checkouts for now.
2022-02-02 21:36:14 -08:00
Martin von Zweigbergk
5da9d600fd cli: add a command for adding an additional workspace (#13)
With all the groudwork done, everything should just work with multiple
workspaces now. So let's add a command for creating workspaces.
2022-02-02 17:00:03 -08:00
Martin von Zweigbergk
c09a4e15c5 workspace: add a function for initializing additional workspace (#13) 2022-02-02 17:00:03 -08:00
Martin von Zweigbergk
5fd060ca18 workspace: load repo from another workspace if .jj/repo is a file (#13)
In workspaces added after the initial one, the idea is to have
`.jj/repo` be a file whose contents is a path to the location of the
repo directory in some other workspace.
2022-02-02 13:47:07 -08:00
Martin von Zweigbergk
a6ef792ba6 repo: initialize without checkouts, let Workspace add it (#13)
As part of creating a new repository, we create an open commit on top
of the root and set that as the current checkout. Now that we have
support for multiple checkouts in the model, we also have support for
zero checkouts, which means we don't need to create that commit on top
of the root when creating the repo. We can therefore move out of
`ReadonlyRepo`'s initialization code and let `Workspace` instead take
care of it. A user-visible effect of this change is that we now create
one operation for initilizing the repo and another one for checking
out the root commit. That seems fine, and will be consistent with the
additional operation we will create when adding further workspaces.
2022-02-02 11:09:12 -08:00
Martin von Zweigbergk
f2e7086172 cli: make jj [obs]log highlight current workspace's checkout (#13)
We should highlight (with bright colors by default) the current
workspace's checkout, not the default workspace's checkout.
2022-02-02 10:44:13 -08:00
Martin von Zweigbergk
92af544de0 templater: make current_checkout be about the current workspace (#13)
We don't use the `current_checkout` keyword in out default templates,
but let's still fix it, so it refers to the current workspace.
2022-02-02 10:33:10 -08:00
Martin von Zweigbergk
012b4c4d8e revsets: add syntax for a particular workspace's checkout (#13)
Because we record each workspace's checkout in the repo view, we can
-- unlike other VCSs -- let the user refer to any workspace's checkout
in revsets. This patch adds syntax for that, so you can show the
contents of the checkout in workspace "foo" with `jj show foo@`. That
won't automatically commit that workspace's working copy, however.
2022-02-02 10:05:31 -08:00
Martin von Zweigbergk
5b46fa3282 cli: make jj status show status for the current workspace (#13)
`jj status` shows the status for the default workspace. Make it use
the current workspace instead.
2022-02-02 08:15:22 -08:00
Martin von Zweigbergk
3588934fc1 cli: when updating onto new commit from jj new, use right workspace (#13)
`jj new` will update onto the new commit if the previous commit was
the current checkout. That code needs to use the current workspace's
checkout.
2022-02-02 08:15:22 -08:00
Martin von Zweigbergk
ee641bf7ad cli: when exporting Git HEAD, use right workspace's new checkout (#13)
If the workspace is shared with a Git repo, we sometimes update Git's
HEAD ref. We should get the new checkout from the right workspace ID
when doing that (though I'm not sure we'll ever support sharing the
working copy with Git in a non-default workspace).
2022-02-02 08:15:22 -08:00
Martin von Zweigbergk
72b5d9a8c5 cli: when importing Git HEAD, abandon right workspace's old commit (#13)
When importing Git HEAD, we already use the right workspace ID for the
new checkout, but the old checkout we abandon is always the default
workspace's. We should fix that even if we will never support sharing
a working copy with Git in a non-default workspace.
2022-02-02 08:15:22 -08:00
Martin von Zweigbergk
48bbb3abc0 cli: use right workspace when checking if working copy has changed (#13)
Before committing the working copy, we check if the working copy is
checked out to the commit we expect based on the repo's view. We
always use the default workspace's checkout, so we need to fix that.
2022-02-02 08:15:22 -08:00
Martin von Zweigbergk
9cabb7eb35 cli: add an early return and reduce indentation (#13) 2022-02-02 08:15:22 -08:00
Martin von Zweigbergk
daaf735e4b cli: update working copy to current workspace's checkout (#13)
When updating the working copy after committing a transaction, we
should update it based on the right checkout.
2022-02-02 08:15:22 -08:00
Martin von Zweigbergk
5f38213e91 cli: detect concurrent working copy change in right workspace (#13)
We detect concurrent working copy changes by checking that the old
commit matches the repo's view. We should use the current workspace
when looking up the checkout in the view.
2022-02-02 08:15:22 -08:00
Martin von Zweigbergk
a41fcb39eb repo: respect workspace ID for old checkout (#13)
When checking out a new commit, we look at the old checkout to see if
it's empty so we should abandon it. We current use the default
workspace's checkout. We need to respect the workspace ID we're given
in `MutableRepo::check_out()`, and we need to be able to deal with
that workspace not existing yet (i.e. this being the first checkout in
that workspace).
2022-02-02 08:15:22 -08:00
Martin von Zweigbergk
ac0d040bb5 rewrite: update all checkouts, not just the default workspace's (#13) 2022-02-02 08:15:22 -08:00
Martin von Zweigbergk
6d3e2017f8 view: merge checkouts for all workspaces, not just the default one (#13) 2022-02-02 08:15:22 -08:00
Martin von Zweigbergk
766c01a6d9 view: add workspace_id argument to set_checkout() (#13) 2022-02-02 08:15:22 -08:00
Martin von Zweigbergk
fb8fbdc4b3 working_copy: keep track of workspace ID (#13)
This patch makes it so the workspace ID can be stored in
`.jj/working_copy/checkout`. The workspace ID is still always
"default".
2022-02-02 08:15:22 -08:00
Martin von Zweigbergk
0098edd3d2 op_store: add support for tracking multiple workspaces (#13)
This patch teaches the `View` object to keep track of the checkout in
each workspace. It serializes that information into the `OpStore`. For
compatibility with existing repos, the existing field for a single
workspace's checkout is interpreted as being for the workspace called
"default".

This is just an early step towards support for multiple
workspaces. Remaining things to do:

 * Record the workspace ID somewhere in `.jj/` (maybe in
   `.jj/working_copy/`)

 * Update existing code to use the workspace ID instead of assuming
   it's always "default" as we do after this patch

 * Add a way of indicating in `.jj/` that the repo lives elsewhere and
   make it possible to load a repo from such workspaces

 * Add a command for creating additional workspaces

 * Show each workspace's checkout in log output
2022-02-02 08:15:22 -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
8fe21b0438 docs: mention history rewriting as a feature in README
I think we have better support rewriting history than most other tools
do, so it seems worth mentioning.
2022-01-28 23:07:52 -08:00
Martin von Zweigbergk
377741c5c6 docs: make "features" in readme a heading with sub-headings instead of bullets
The list of features outgrew the bullet form a long time ago...
2022-01-28 22:45:55 -08:00
Martin von Zweigbergk
35e0b855a9 tests: avoid depending on .jj/ structure in test_bad_locking (#13) 2022-01-28 22:28:32 -08:00
Martin von Zweigbergk
35f0c17380 workspace: rename some symbols related to .jj/ to jj_dir (#13) 2022-01-28 21:31:51 -08:00
Martin von Zweigbergk
0725d4326d repo: don't create unused .jj/view/ directory 2022-01-28 21:27:13 -08:00
Martin von Zweigbergk
81edd92523 workspace: take over creation of .jj/working_copy/ from repo.rs (#13)
It's clearly `Workspace`'s job to create `.jj/working_copy/`, I must
have just forgotten to move it there.
2022-01-28 20:35:13 -08:00
Martin von Zweigbergk
c74882b3c0 cli: fix typo "one revisions" 2022-01-28 17:01:58 -08:00