Page MenuHomeFreeBSD

D58126.id181706.diff
No OneTemporary

D58126.id181706.diff

diff --git a/tools/tools/git/git-mfc b/tools/tools/git/git-mfc
--- a/tools/tools/git/git-mfc
+++ b/tools/tools/git/git-mfc
@@ -31,6 +31,11 @@
return f'{commit.hexsha} ("{commit.summary}")'
+def commit_match(commit, author, committer):
+ return (author is None or author in commit.author.email) and \
+ (committer is None or committer in commit.committer.email)
+
+
def origin_branch():
"""
Determine the default origin branch by parsing sys/conf/newvers.sh.
@@ -245,7 +250,7 @@
return origins
-def dangling(repo, upstream, author=None):
+def dangling(repo, upstream, author=None, committer=None):
"""
Find commits in the current branch which have been cherry-picked from
upstream but are missing fixup commits.
@@ -258,7 +263,7 @@
refs = mfc_origins(repo, commit, warn=True)
for ref in refs:
picked.append(ref.hexsha)
- if author is None or author in commit.author.email:
+ if commit_match(ref, author, committer):
mine.append(ref.hexsha)
# Create a mapping of all upstream commits to their fixups,
# tracking reverts as we go.
@@ -301,7 +306,7 @@
return None
-def pending(repo, upstream, author=None, baking=False):
+def pending(repo, upstream, author=None, committer=None, baking=False):
"""
Find commits in the upstream branch that have an "MFC after:" tag, whose
waiting period has elapsed, and which have not been cherry-picked to the
@@ -339,8 +344,7 @@
# Not yet eligible for MFC.
continue
- if author is not None and author not in commit.author.email:
- # Don't report commits that don't match the requested author.
+ if not commit_match(commit, author, committer):
continue
committed = datetime.datetime.fromtimestamp(
@@ -388,7 +392,7 @@
)
parser.add_argument(
'-a', '--author', type=str, default=None,
- help='Filter --pending/--dangling results by author (default: current user)',
+ help='Filter --pending/--dangling results by author (default: ignore author)',
)
parser.add_argument(
'--all', action='store_true',
@@ -399,6 +403,10 @@
help='With --pending, also show commits whose MFC-after period '
'has not yet elapsed',
)
+ parser.add_argument(
+ '-c', '--committer', type=str, default=None,
+ help='Filter --pending/--dangling results by committer (default: current user)',
+ )
parser.add_argument(
'--dangling', action='store_true',
help='Find cherry-picked commits in the current branch that are '
@@ -455,24 +463,27 @@
if not args.n:
repo.remotes[remote].fetch(origin)
- show_all = getattr(args, 'all')
- if show_all:
- author = None
- elif args.author:
- author = args.author
- elif args.dangling or args.pending:
- author = repo.config_reader().get_value('user', 'email', default=None)
- if author is None:
- err(1, "could not determine user email; use -a or --all")
- else:
- author = None
+ # Do we want to filter commits by author or committer? By default, use
+ # the current git user's email to match the committer field.
+ author = committer = None
+ if not getattr(args, 'all'):
+ user_email = repo.config_reader().get_value('user', 'email', default=None)
+ if args.author:
+ author = args.author
+
+ if args.committer:
+ committer = args.committer
+ else:
+ committer = user_email
+ if committer is None:
+ err(1, "could not determine user email; use -c or --all")
if args.dangling:
- missing = dangling(repo, upstream, author=author)
+ missing = dangling(repo, upstream, author=author, committer=committer)
for fixup, commit in missing:
print(f'{commit_summary(fixup)} fixes {commit_summary(commit)}')
elif args.pending:
- results = pending(repo, upstream, author=author,
+ results = pending(repo, upstream, author=author, committer=committer,
baking=args.baking)
for commit, ready_date, ready in results:
date_str = ready_date.strftime('%Y-%m-%d')
diff --git a/tools/tools/git/git-mfc.1 b/tools/tools/git/git-mfc.1
--- a/tools/tools/git/git-mfc.1
+++ b/tools/tools/git/git-mfc.1
@@ -19,6 +19,7 @@
.Nm
.Fl -pending
.Op Fl a Ar author
+.Op Fl c Ar committer
.Op Fl -all
.Op Fl -baking
.Op Fl -origin Ar branch
@@ -26,6 +27,7 @@
.Nm
.Fl -dangling
.Op Fl a Ar author
+.Op Fl c Ar committer
.Op Fl -all
.Op Fl -origin Ar branch
.Op Fl r Ar remote
@@ -84,7 +86,7 @@
tags whose waiting period has elapsed and which have not already been
cherry-picked to the current branch.
Commits that have been reverted upstream are excluded.
-By default, only commits authored by the current user
+By default, only commits committed by the current user
.Pq as determined by Xr git-config 1
are shown.
.It
@@ -96,7 +98,7 @@
finds commits in the current branch that have been cherry-picked from the
origin branch but are missing associated fixup commits.
Fixup commits that have been reverted upstream are excluded.
-By default, only cherry-picks authored by the current user
+By default, only cherry-picks committed by the current user
.Pq as determined by Xr git-config 1
are considered.
.El
@@ -109,6 +111,13 @@
or
.Fl -dangling ,
filter results to commits whose author email contains the given string.
+By default, the author field of commits is ignored.
+.It Fl c Ar committer , Fl -committer Ar committer
+With
+.Fl -pending
+or
+.Fl -dangling ,
+filter results to commits whose committer email contains the given string.
By default, the value of
.Va user.email
from

File Metadata

Mime Type
text/plain
Expires
Wed, Jul 15, 6:14 PM (8 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35109320
Default Alt Text
D58126.id181706.diff (5 KB)

Event Timeline