MCPcopy
hub / github.com/pandas-dev/pandas / get_authors

Function get_authors

doc/sphinxext/announce.py:59–108  ·  view source on GitHub ↗
(revision_range)

Source from the content-addressed store, hash-verified

57
58
59def get_authors(revision_range):
60 pat = "^.*\\t(.*)$"
61 lst_release, cur_release = (r.strip() for r in revision_range.split(".."))
62
63 if "|" in cur_release:
64 # e.g. v1.0.1|HEAD
65 maybe_tag, head = cur_release.split("|")
66 assert head == "HEAD"
67 if maybe_tag in this_repo.tags:
68 cur_release = maybe_tag
69 else:
70 cur_release = head
71 revision_range = f"{lst_release}..{cur_release}"
72
73 # authors, in current release and previous to current release.
74 # We need two passes over the log for cur and prev, one to get the
75 # "Co-authored by" commits, which come from backports by the bot,
76 # and one for regular commits.
77 xpr = re.compile(r"Co-authored-by: (?P<name>[^<\n]+)\s")
78 cur = set(
79 xpr.findall(
80 this_repo.git.log("--grep=Co-authored", "--pretty=%b", revision_range)
81 )
82 )
83 cur |= set(re.findall(pat, this_repo.git.shortlog("-s", revision_range), re.M))
84
85 pre = set(
86 xpr.findall(this_repo.git.log("--grep=Co-authored", "--pretty=%b", lst_release))
87 )
88 pre |= set(re.findall(pat, this_repo.git.shortlog("-s", lst_release), re.M))
89
90 # Homu is the author of auto merges, clean him out.
91 cur.discard("Homu")
92 pre.discard("Homu")
93
94 # Rename contributors according to mapping.
95 for old_name, new_name in CONTRIBUTOR_MAPPING.items():
96 old_name_decoded = codecs.decode(old_name, "rot13")
97 new_name_decoded = codecs.decode(new_name, "rot13")
98 if old_name_decoded in pre:
99 pre.discard(old_name_decoded)
100 pre.add(new_name_decoded)
101 if old_name_decoded in cur:
102 cur.discard(old_name_decoded)
103 cur.add(new_name_decoded)
104
105 # Append '+' to new authors.
106 authors = [s + " +" for s in cur - pre] + list(cur & pre)
107 authors.sort()
108 return authors
109
110
111def get_pull_requests(repo, revision_range):

Callers 1

build_componentsFunction · 0.85

Calls 6

stripMethod · 0.80
splitMethod · 0.80
findallMethod · 0.80
decodeMethod · 0.80
itemsMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected