History log of /freebsd-current/tools/tools/git/git-arc.sh
Revision Date Author Comments
# 2f68f647 06-May-2024 John Baldwin <jhb@FreeBSD.org>

git-arc: Add list mode support for the update command

This can be particularly useful to do bulk-updates of multiple commits
using the same message, e.g.

git arc update -lm "Move function xyz to libfoo" main..myfeature

Similar to the list mode for the create command, git arc will list all
the candidate revisions with a single prompt. Once that is confirmed,
all the revisions are updated without showing the diffs or pausing
further prompts.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D45050


# 280085ef 27-Mar-2024 Mina Galić <freebsd@igalic.co>

tools/git: ensure git-arc is more platform indepdendent

Summary:
Linux systems' tail doesn't have `-r`.
Instead, we can use git's own `--reverse` sorting for `rev-list`s.

Reviewed by: markj, imp, jhibbits
Differential Revision: https://reviews.freebsd.org/D39975


# e1735b35 06-Feb-2024 Warner Losh <imp@FreeBSD.org>

git-arc: Retain color status messages

Newer versions of archanist have an --ansi option to always include the
ansi colors when doing an arc list (or any command really). Add this to
the arc list that's relevant. Add filter to filter out the 'bolding'
though since that interferes with our parsing. This should restore the
color output after df834e06bbc7.

Fixes: df834e06bbc7
Sponsored by: Netflix
Reviewed by: markj, jhb
Differential Revision: https://reviews.freebsd.org/D43459


# 787cb30d 14-Jan-2024 Warner Losh <imp@FreeBSD.org>

git-arc: Add -c flag to patch to commit the change

git arc patch -c D1234 will download differential D1234, try to apply it
to the tree, and if successful will ask phab for the title and
summary. It will construct a commit message with that, the reviewers,
and the differential revision. It also tries its best to deduce the
proper 'author' to use for the commit, and warn if it thinks it has made
a bad choice.

Sponsored by: Netflix
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D39992


# 9f48ef1f 14-Jan-2024 Warner Losh <imp@FreeBSD.org>

git-arc: Cope with extra output

On my machine, for reasons beyond my understanding, I get this warning
two times when running arc:

Warning: Module "openssl" is already loaded in Unknown on line 0

so grep -v ^Warning: on all the arc call-conduit calls to filter them
out so we can properly parse the JSON with jq.

Sponsored by: Netflix
Reviewed by: markj, jhb
Differential Revision: https://reviews.freebsd.org/D36583


# df834e06 14-Jan-2024 Warner Losh <imp@FreeBSD.org>

git-arc: Just strip escape sequences form arc log

Just strip escape sequences and Warning: lines from 'arc list' output. I
upgraded and they changed and git arc list broke. This restores its
functionality.

Note: jhb didn't like this, so if others object, I'll fix...

Sponsored by: Netflix
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D36553


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 613aaf59 07-Nov-2022 John Baldwin <jhb@FreeBSD.org>

git-arc: Accept message via -m when updating reviews.

If a -m argument is given to update, it is passed through to arc diff
when updating each review. Note that if an empty message is specified
via -m, arc diff will update the review without adding a note.

If an -m argument is not given, then the user's editor is invoked by
arc to supply a message for each review matching the previous
behavior.

This can be used to simplify the process for updating a set of
reviews, e.g.:

git checkout foo
git rebase main
git arc update -m "Rebase" main..

This will rebase the 'foo' branch and update the reviews for all
commits on the branch without invoking the user's editor separately
for each review.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D37260


# 6a720fb9 03-Oct-2022 Mark Johnston <markj@FreeBSD.org>

git-arc: Fix handling of review title containing double quotes


# c4d06691 24-Aug-2022 Mark Johnston <markj@FreeBSD.org>

git-arc: Respect GIT_EDITOR and GIT_PAGER


# 43d0c4d2 24-Aug-2022 Mark Johnston <markj@FreeBSD.org>

git-arc: Fix whitespace


# 54854864 17-Aug-2022 John Baldwin <jhb@FreeBSD.org>

git-arc: Use --head to avoid changing the checkout.

Rather than using 'git checkout' to move to the commit in question for
create and update, use the '--head' argument to 'arc diff'. This
avoids the need to alter the current checkout and the related bits to
save/restore HEAD in the current checkout.

Reviewed by: imp, markj
Differential Revision: https://reviews.freebsd.org/D36248


# eaab493e 13-Jul-2022 Mark Johnston <markj@FreeBSD.org>

git-arc: Fix the -y option


# 99589993 14-Feb-2022 Mark Johnston <markj@FreeBSD.org>

git-arc: Fix review title matching

Properly handle the case where the title of one commit is a suffix or
prefix of the title of a second commit, and one wishes to create reviews
for both.

Reported by: chuck


# 964035c4 18-Nov-2021 Gleb Smirnoff <glebius@FreeBSD.org>

git-arc: with "create" allow to specify parent of the first commit

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D33045


# 8a004a98 06-Sep-2021 Robert Wing <rew@FreeBSD.org>

git-arc: allow word splitting in build_commit_list()

git-rev-list expects commits to be listed separately, allow word
splitting and disable shellcheck SC2086 when using git-rev-list
to build the commit list.

Fixes: 4fd0c6ab1a9e ("Fix most shellcheck warnings in git-arc.sh")
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D31838


# 142cb88b 25-Mar-2021 Alex Richardson <arichardson@FreeBSD.org>

git-arc.sh: Make it compatible with Ubuntu 18.04

dash does not allow function names containing a ":", so replace it with
a '_'. Additionally, Ubunutu 18.04 ships git 2.17 which does not support
the `--default false` flag for git config.

Reviewed By: markj
Differential Revision: https://reviews.freebsd.org/D29374


# 4fd0c6ab 25-Mar-2021 Alex Richardson <arichardson@FreeBSD.org>

Fix most shellcheck warnings in git-arc.sh

Mostly adding quotes and replacing egrep/fgrep with grep -E/grep -F

Reviewed By: markj
Differential Revision: https://reviews.freebsd.org/D29373


# c49b0753 03-Mar-2021 Mark Johnston <markj@FreeBSD.org>

git-arc: Handle commit ranges in the "update" verb

Reported by: imp


# cd6114d1 18-Feb-2021 Mark Johnston <markj@FreeBSD.org>

git-arc: Preserve the commit author when staging commits

Reported by: jhb


# 57ba8673 18-Feb-2021 Mark Johnston <markj@FreeBSD.org>

git-arc: Globally save and restore the git checkout head

This script uses -e, so it's prone to exiting in awkward places. In
particular, if arc diff fails, the script just exits without restoring
the checkout.

Mitigate this for now by using a global variable to record the previous
checkout and use a trap handler to restore it in the face of errors. A
better solution might be to use arc diff's --head parameter but that
will require more testing.

Reported by: kevans
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D28631


# 62374dfa 12-Feb-2021 Mark Johnston <markj@FreeBSD.org>

git-arc: Use a separate message file

Rather than putting revision metadata in .git/arc/create-message, create
a tmpfile and use that. Otherwise arc diff always prompts about it and
in some cases complains because its standard input is piped.

Reported by: imp
Differential Revision: https://reviews.freebsd.org/D28614


# 3279329b 05-Feb-2021 Mark Johnston <markj@FreeBSD.org>

tools/git: Add git-arc

This is a handy script for creating and updating Differential revisions
from git commits. It tries to avoid forcing the user to manage their
git tree in any particular way, but makes two major assumptions:
- there is a one-to-one mapping between git commits and Differential
revisions,
- the title of a Differential revision is the same as the summary line
of the corresponding commit.

A verbose description of the script's functionality is provided in its
usage message, which should probably be converted to a man page.

A description of workflows using git-arc is here:
https://lists.freebsd.org/pipermail/freebsd-hackers/2021-January/056979.html

There are some loose ends but this is functional enough to be useful.

Discussed with: jhb
Differential Revision: https://reviews.freebsd.org/D28334