Skip to content

Commit

Permalink
devtools: Deduplicate links from linkify
Browse files Browse the repository at this point in the history
The method linkify just added links for an entry to a list and produced
duplicates if we got more than one changelog line in a PR. We now only
produce a link once per PR.

Signed-off-by: Peter Neuroth <[email protected]>
  • Loading branch information
nepet committed Nov 3, 2023
1 parent b135ba2 commit bd7420d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions devtools/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
Entry = namedtuple("Entry", ["commit", "pullreq", "content", "section"])
Link = namedtuple("Link", ["ref", "content", "url"])


def git(cmd):
cmd = shlex.split(cmd)
out = subprocess.check_output(['git'] + cmd)
Expand Down Expand Up @@ -81,14 +80,14 @@ def get_log_entries(commitrange):


def linkify(entries):
links = []
links = {}
for e in entries:
links.append(Link(
links[e.pullreq] = (Link(
ref='#{}'.format(e.pullreq),
content=e.content,
url="https://github.com/ElementsProject/lightning/pull/{}".format(e.pullreq)
))
return list(set(links))
return list(set(links.values()))


def group(entries):
Expand Down

0 comments on commit bd7420d

Please sign in to comment.