Commit graph

13 commits

Author SHA1 Message Date
Benjamin Tan
0c0e001262 git init: add revset alias for trunk() when intializing with existing git repository 2024-07-04 23:04:19 +08:00
Yuya Nishihara
5e7cb3435e git: unset unborn HEAD ref on export
Otherwise, newly created default branch would be re-imported as a new Git HEAD.
This could be addressed by cmd_git_init(), but the same situation can be
crafted by using "git checkout -b".
2024-06-01 11:01:16 +09:00
Yuya Nishihara
00ae8603db tests: use get_log_output() helper in test_git_init.rs
It's copied from test_git_colocated.rs, and switched to commit_id.short()
because full-length commit_id looked too verbose. "all()" history isn't needed,
but it's easier to follow.
2024-06-01 11:01:16 +09:00
Simon Wollwage
320f50e00f cli: rename --all to --all-remotes for branch list 2024-04-01 10:12:13 +09:00
Yuya Nishihara
31525705db cli: add "Hint: " or "Warning: " heading to almost all messages
It's inconsistent that some warnings have headings and some don't, and it seems
the choice is arbitrary. Let's unify the style. There are two exceptions:
1. continued line following labeled message,
2. "unrecognized response" followed by prompt.
2024-03-26 11:23:13 +09:00
Martin von Zweigbergk
e51878f4fd cli: show timestamp in local timezone and without millis and offset
As discussed in #2900, the milliseconds are rarely useful, and it can
be confusing with different timezones because it makes harder to
compare timestamps.

I added an environment variable to control the timestamp in a
cross-platform way. I didn't document because it exists only for tests
(like `JJ_RANDOMNESS_SEED`).

Closes #2900
2024-03-20 07:54:08 -07:00
Yuya Nishihara
601b75c556 tests: move strip_last_line() to common module 2024-03-01 08:51:06 +09:00
Yuya Nishihara
fd0ace4c26 cli: remove redundant --git-repo path canonicalization
It was moved to CLI at 42252a2f00 "cli: on `jj init --git-repo=.`, use
relative path to `.git/`." As far as I can tell, .canonicalize() is needed
to calculate relative path, which is now processed differently in
Workspace::init_external_git() and GitBackend::init_external().
2024-02-28 09:03:16 +09:00
Yuya Nishihara
8d0414549b cli: unblock "jj git init --colocate" in existing Git repo directory
I'm not sure what's the conclusion in #2747, but I don't think there is a
disagreement on allowing --colocate to import existing Git repo.
2024-02-28 09:03:16 +09:00
Yuya Nishihara
b13cfef095 cli: rename --colocated flag of "jj git init" to --colocate (verb)
"jj git clone" has --colocate flag, so let's stick to it.

#2747
2024-02-07 09:12:24 -08:00
jyn
d66fcf2ca0 compile integration tests as a single binary
this greatly speeds up the time to run all tests, at the cost of slightly larger recompile times for individual tests.

this unfortunately adds the requirement that all tests are listed in `runner.rs` for the crate.
to avoid forgetting, i've added a new test that ensures the directory is in sync with the file.

 ## benchmarks

before this change, recompiling all tests took 32-50 seconds and running a single test took 3.5 seconds:

```
; hyperfine 'touch lib/src/lib.rs && cargo t --test test_working_copy'
  Time (mean ± σ):      3.543 s ±  0.168 s    [User: 2.597 s, System: 1.262 s]
  Range (min … max):    3.400 s …  3.847 s    10 runs
```

after this change, recompiling all tests take 4 seconds:
```
;  hyperfine 'touch lib/src/lib.rs ; cargo t --test runner --no-run'
  Time (mean ± σ):      4.055 s ±  0.123 s    [User: 3.591 s, System: 1.593 s]
  Range (min … max):    3.804 s …  4.159 s    10 runs
```
and running a single test takes about the same:
```
; hyperfine 'touch lib/src/lib.rs && cargo t --test runner -- test_working_copy'
  Time (mean ± σ):      4.129 s ±  0.120 s    [User: 3.636 s, System: 1.593 s]
  Range (min … max):    3.933 s …  4.346 s    10 runs
```

about 1.4 seconds of that is the time for the runner, of which .4 is the time for the linker. so
there may be room for further improving the times.
2024-02-06 18:19:41 -08:00
Yuya Nishihara
1adf6b5d6e cli: do initial import of Git refs without touching HEAD
This reimplements the change 9faa4670d5 "cli: on init, import git refs prior
to importing HEAD." Initialization is special because the HEAD ref isn't
available to jj yet, and there is an empty working-copy commit.

The initialization function could be refactored to go through the common code
path, but I think doing that would make future improvement harder. We might
want to initialize tracking branches based on .git/config for example.

Fixes #2942
2024-02-06 17:19:37 +09:00
Essien Ita Essien
2607512815 cli: add a jj git init command.
This initializes a git backed repo.

* It does the same thing as `jj init --git` except that it
  has a --colocated flag to explicitly specify that we want
  the .git repo to be side-by-side the .jj repo in the working
  directory.
* `jj init --git` will keep the current behaviour and will not
  be able to create colocated git backed repos.
* Update test snapshots.
2024-02-05 00:40:58 +00:00