mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
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
This commit is contained in:
parent
f515a279f7
commit
613aaf59af
|
@ -24,7 +24,7 @@
|
||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd October 12, 2022
|
.Dd November 7, 2022
|
||||||
.Dt GIT-ARC 1
|
.Dt GIT-ARC 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
@ -48,6 +48,7 @@
|
||||||
.Op Ar commit Ns | Ns Ar commit-range
|
.Op Ar commit Ns | Ns Ar commit-range
|
||||||
.Nm
|
.Nm
|
||||||
.Cm update
|
.Cm update
|
||||||
|
.Op Fl m Ar message
|
||||||
.Op Ar commit Ns | Ns Ar commit-range
|
.Op Ar commit Ns | Ns Ar commit-range
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
The
|
The
|
||||||
|
@ -105,6 +106,15 @@ Synchronize the Differential Revisions associated with the
|
||||||
specified commits.
|
specified commits.
|
||||||
Currently only the diff is updated; the review description and other
|
Currently only the diff is updated; the review description and other
|
||||||
metadata are not synchronized.
|
metadata are not synchronized.
|
||||||
|
If a message is specified with
|
||||||
|
.Fl m ,
|
||||||
|
that message is added as a note to the Differential Revision.
|
||||||
|
If no message is supplied,
|
||||||
|
the user's editor will be opened to provide an update message for
|
||||||
|
each revision.
|
||||||
|
If an empty message is supplied via
|
||||||
|
.Fl m ,
|
||||||
|
then no notes will be added when updating Differential Revisions.
|
||||||
.El
|
.El
|
||||||
.Sh CONFIGURATION
|
.Sh CONFIGURATION
|
||||||
These are manipulated by
|
These are manipulated by
|
||||||
|
|
|
@ -53,7 +53,7 @@ Commands:
|
||||||
list <commit>|<commit range>
|
list <commit>|<commit range>
|
||||||
patch <diff1> [<diff2> ...]
|
patch <diff1> [<diff2> ...]
|
||||||
stage [-b branch] [<commit>|<commit range>]
|
stage [-b branch] [<commit>|<commit range>]
|
||||||
update [<commit>|<commit range>]
|
update [-m message] [<commit>|<commit range>]
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Create or manage FreeBSD Phabricator reviews based on git commits. There
|
Create or manage FreeBSD Phabricator reviews based on git commits. There
|
||||||
|
@ -501,7 +501,20 @@ gitarc__stage()
|
||||||
|
|
||||||
gitarc__update()
|
gitarc__update()
|
||||||
{
|
{
|
||||||
local commit commits diff
|
local commit commits diff have_msg msg
|
||||||
|
|
||||||
|
while getopts m: o; do
|
||||||
|
case "$o" in
|
||||||
|
m)
|
||||||
|
msg="$OPTARG"
|
||||||
|
have_msg=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
err_usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
commits=$(build_commit_list "$@")
|
commits=$(build_commit_list "$@")
|
||||||
for commit in ${commits}; do
|
for commit in ${commits}; do
|
||||||
|
@ -514,8 +527,13 @@ gitarc__update()
|
||||||
# The linter is stupid and applies patches to the working copy.
|
# The linter is stupid and applies patches to the working copy.
|
||||||
# This would be tolerable if it didn't try to correct "misspelled" variable
|
# This would be tolerable if it didn't try to correct "misspelled" variable
|
||||||
# names.
|
# names.
|
||||||
arc diff --allow-untracked --never-apply-patches --update "$diff" \
|
if [ -n "$have_msg" ]; then
|
||||||
--head "$commit" "${commit}~"
|
arc diff --message "$msg" --allow-untracked --never-apply-patches \
|
||||||
|
--update "$diff" --head "$commit" "${commit}~"
|
||||||
|
else
|
||||||
|
arc diff --allow-untracked --never-apply-patches --update "$diff" \
|
||||||
|
--head "$commit" "${commit}~"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue