mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 14:48:10 +02:00
find-backports: warn if any commits are not from the first reference
Every branch (for example "nm-1-40") has exactly one next branch, from which patches should be backported (in that example that branch is "nm-1-42"). While "find-backports" searches all newer branches for patches, it does not make it clear form where the patch should come from. That means, if you run the script `contrib/scripts/find-backports origin/nm-1-40` it will check nm-1-42 and main branch, and might suggest to backport patches that are only on main, but not "nm-1-42". That would be wrong, because patches need to first go into nm-1-42, and then backported (from there) further to nm-1-40. Print a warning to highlight that.
This commit is contained in:
parent
9f89910852
commit
65ef6bc9bc
1 changed files with 26 additions and 0 deletions
|
|
@ -139,6 +139,11 @@ def git_all_commits(rnge):
|
||||||
return git_all_commits_grep(rnge)
|
return git_all_commits_grep(rnge)
|
||||||
|
|
||||||
|
|
||||||
|
@memoize
|
||||||
|
def git_all_commits_set(rnge):
|
||||||
|
return set(git_all_commits_grep(rnge))
|
||||||
|
|
||||||
|
|
||||||
def git_commit_sorted(commits):
|
def git_commit_sorted(commits):
|
||||||
commits = list(commits)
|
commits = list(commits)
|
||||||
if not commits:
|
if not commits:
|
||||||
|
|
@ -256,6 +261,10 @@ def git_commits_annotate_cherry_picked(rnge):
|
||||||
return c_dict
|
return c_dict
|
||||||
|
|
||||||
|
|
||||||
|
def git_ref_in_history(ref, rnge):
|
||||||
|
return git_ref_exists(ref) in git_all_commits_set(rnge)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if len(sys.argv) <= 1:
|
if len(sys.argv) <= 1:
|
||||||
ref_head0 = "HEAD"
|
ref_head0 = "HEAD"
|
||||||
|
|
@ -371,5 +380,22 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
print_err(git_logg(commits_good))
|
print_err(git_logg(commits_good))
|
||||||
|
|
||||||
|
not_in = [
|
||||||
|
c
|
||||||
|
for c in commits_good
|
||||||
|
if not git_ref_in_history(c, f"{ref_head}..{ref_upstreams[0]}")
|
||||||
|
]
|
||||||
|
if not_in:
|
||||||
|
print_err("")
|
||||||
|
print_err(
|
||||||
|
f'WARNING: The following commits are not from the first reference "{ref_upstreams[0]}".'
|
||||||
|
)
|
||||||
|
print_err(
|
||||||
|
f' You may want to first backports those patches to "{ref_upstreams[0]}".'
|
||||||
|
)
|
||||||
|
for l in git_logg(git_commit_sorted(not_in)).splitlines():
|
||||||
|
print_err(f" - {l}")
|
||||||
|
print_err("")
|
||||||
|
|
||||||
for c in reversed(commits_good):
|
for c in reversed(commits_good):
|
||||||
print("%s" % (c))
|
print("%s" % (c))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue