CommitRef now stores raw author/committer headers and parses them when needed.
Since parsing errors would have been detected at .try_to_commit_ref(), this
patch makes new decode errors propagate as before.
Fixes#8350, #8214
This also means that this field should not become a `List<String>`,
though it would make sense to create a new type for it (which could be
converted into `List<String>` in two different ways, with or without
quoting).
An example of squashing `ysrnknol` into `rtsqusxu`:
```
<<<<<<< conflict 1 of 1
+++++++ rtsqusxu 2768b0b9 "A" (squash destination)
updated in destination
%%%%%%% diff from: vpxusssl 38d49363 "B" (parents of squashed commit)
\\\\\\\ to: ysrnknol 7a20f389 "C" (squashed commit)
-base
+squashed
>>>>>>> conflict 1 of 1 ends
```
Or with only partial changes selected:
```
<<<<<<< conflict 1 of 1
+++++++ rtsqusxu 2768b0b9 "A" (squash destination)
updated in destination
%%%%%%% diff from: vpxusssl 38d49363 "B" (parents of squashed commit)
\\\\\\\ to: selected changes for squash (from ysrnknol 7a20f389 "C")
-base
+selected changes
>>>>>>> conflict 1 of 1 ends
```
Commands `jj log`, `jj evolog`, and `jj op log` automatically added a
terminating newline when the expanded template did not include one in graph
mode. No-graph mode did not do this, so the expanded template could combine with
any following content (diff, op changes, etc) in confusing or problematic ways.
Instead of trying to compensate in all cases, remove the auto-fixups. Users
should confirm their custom templates still expand correctly for their needs.
Since the last update, `-d` has been renamed to `-o/--onto`, the
local backend has been renamed to the simple backend, and colocation is
enabled by default.
Now that we can put the "from" and "to" sides on separate lines, we can
use the normal "(no terminating newline)" comment on each side
separately. This should also be more clear, since previously the
"(no terminating newline)" comment could possibly be confused for
"(removes terminating newline)".
Before:
```
<<<<<<< conflict 1 of 1
+++++++ rtsqusxu 2768b0b9 "commit A" (no terminating newline)
grapefruit
%%%%%%% diff from: vpxusssl 38d49363 "merge base"
\\\\\\\ to: ysrnknol 7a20f389 "commit B" (adds terminating newline)
-grape
+grape
>>>>>>> conflict 1 of 1 ends
```
After:
```
<<<<<<< conflict 1 of 1
+++++++ rtsqusxu 2768b0b9 "commit A" (no terminating newline)
grapefruit
%%%%%%% diff from: vpxusssl 38d49363 "merge base" (no terminating newline)
\\\\\\\ to: ysrnknol 7a20f389 "commit B"
-grape
+grape
>>>>>>> conflict 1 of 1 ends
```
It would be good to include the word "divergent" in the log when a
change is divergent, since users are often unsure what's happening when
they see a divergent change, and giving them a term to search for would
be helpful. However, I don't think it looks good to put this label next
to the change ID itself if both are the same color, since it ends up
being hard to distinguish from the change offset at a glance. Also,
putting the label next to the change ID also messes up the alignment of
fields in the log. Therefore, I think it looks better to put the
"divergent" label at the end of the line.
Since divergence and hidden commits are similar, it makes sense for both
labels to be in the same place, so I also moved the hidden label to the
end for consistency.
One downside is that the labels are less obviously connected with the
change ID itself due to them being farther apart. I think this could be
fine, since they are still visually connected by being the same color.
An example with parents `rtsqusxu` and `ysrnknol`:
```
<<<<<<< conflict 1 of 1
%%%%%%% diff from: vpxusssl 38d49363 "description of base"
\\\\\\\ to: rtsqusxu 2768b0b9 "description of left"
-base
+left
+++++++ ysrnknol 7a20f389 "description of right"
right
>>>>>>> conflict 1 of 1 ends
```
Since conflict labels are generally going to be long, this introduces a
new "note" conflict marker (`\\\\\\\`), which can be used to split the
"diff" conflict marker (`%%%%%%%`) across two lines:
```
<<<<<<< conflict 1 of 1
%%%%%%% diff from: vpxusssl 38d49363 "description of base"
\\\\\\\ to: rtsqusxu 2768b0b9 "description of left"
-base
+left
+++++++ ysrnknol 7a20f389 "description of right"
right
>>>>>>> conflict 1 of 1 ends
```
Conflict labels will generally start with lowercase change IDs, so
making all of the text lowercase makes it more consistent. I also
removed the "contents of" text, since conflict labels will already be
long enough, and this text doesn't add anything. Similarly, I removed
the "(conflict 1 of 1)" note from the Git conflict markers since Git
doesn't include this information, and including it would result in extra
long lines once we add conflict labels.
Several commands accept both positional arguments and a `-r` flag for
specifying revisions. The `-r` flag exists for consistency with other
commands, but was previously hidden from help output.
Instead of unhiding `-r` (which would clutter the Options section),
document the aliasing by adding `[aliases: -r]` to the positional
argument's help text. This makes the relationship discoverable while
keeping the help output clean.
Commands updated: abandon, describe, duplicate, edit, metaedit, new, show
Fixes#8104
The help text for `jj split` was confusing about what happens to
"selected" vs "remaining" changes, especially with the `-o/-A/-B` flags.
This change:
- Adds ASCII diagrams showing the commit graph transformations for
default split, --parallel, and -o/-A/-B modes
- Clarifies that by default, selected changes stay in the original
commit while remaining changes go to a new child
- Explains that with -o/-A/-B, selected changes are extracted to a
new commit at the destination while remaining changes stay in place
- Improves the --message flag description to clarify it applies to
the first commit (containing selected changes)
- Adds explanatory text to the -o, -A, and -B flag descriptions
Rename parameter type `String` to `StringLiteral` where methods require
a literal string known at parse time rather than a dynamic expression.
This makes the documentation faithful to the underlying code, which uses
`expect_string_literal()` and reports "Expected string literal" errors.
Add a new `StringLiteral` type section explaining the distinction.
Fixes#7068
Since String provides more convenient functions for searching/splitting than
OsString, it should be simpler to convert relative PathBuf to String first. The
tricky part is "right-to-left" version of .split_inclusive("/"), but the
original code wasn't readable either.
"if !paths.is_changed()" is removed since the formatting function can now handle
unchanged paths.
copied_path.to_diff() returns Option<Diff<T>> because it seemed silly to compare
before/after paths when the caller knows the entry isn't copied/renamed.
This is an easy part of Git extra table GC. The implementation is quite similar
to SimpleOpStore::gc(). Since we don't delete unreachable "commit" entries from
the table segments, this wouldn't improve runtime performance. Directory lookup
might get slightly faster thanks to fewer file entries, though.
#12, #8312
This is pretty low level, but we can at least know which extras table files are
active. The --key-size parameter doesn't matter so long as it is smaller than
the actual key size, but we might add sanity check later.
The 'gerrit upload' cli command is meant to support uploading commits
that have an explicit "Change-Id: ..." footer, and those that don't. In
the latter case, a temporary copy of the commit being uploaded will be
created, with the Change-Id set based on the jj change id.
Prior to this commit, there was a bug in this implementation when a
chain of commits contained some with Change-Id footers and some without.
Say we have commits a->b->c, where b has no Change-Id footer but c does
(this case is what's now tested in the test_gerrit_upload_local case).
The old logic would:
- create a new version of b (let's call it b*), with a CommitId footer,
and populate the 'old_to_new' map with 'b -> b*'
- not create a new version of c, and populate the 'old_to_new' map with
'c -> c'
- push the 'new' version of c, which is c itself. However, c has b as a
parent, not b*, so this fails to send to gerrit because b has no
Commit-Id footer!
After this commit, we create a new temporary commit if either the
description is changed (as before), or if any parents are different from
the original commit's parents. This does not change the behavior for
either the all-explicit or all-implicit ChangeId cases, but fixes the
behavior in this mixed case.
The 'gerrit upload' command has logic to handle commits with the
"Change-Id" explicitly set within the commit message, and commits
without the Change-Id explicitly set. This commit adds a test for the
behavior when all commits have the Change-Id explicitly set.
Also fix typo in existing test comment
It's usually going to be easier for a user to run the same command again
but with a change offset appended, so I think these are more helpful
than commit IDs.