Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,14 @@ branch made the series `queued`, all four patches by message-id.
even though its patches reach that tree through a pull. Following
pulls upward is not in MAINTAINERS.
- Mainline (`torvalds/linux`) is never proposed as a maintainer tree.
- **Series the mail calls `applied` are included** (2026-11-11): the
first live run skipped every DONE state, so the two series a
maintainer had answered "Applied" never got their trees (input, iio),
and nothing could confirm the mail.
- **"not in" names at most two trees.** With 29 trees checked, the note
on an applied series listed them all, and `list` cut it after the
first ("not in battery …" on an input patch). More than two are
counted; `show` still lists each.
- **Defaults, so a kernel checkout needs no options**: MAINTAINERS from
`--maintainers`, else the mainline tree, else the current directory's
repository; Next/Trees from `--next-trees`, else the next tree's copy,
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

## 0.2.0

- **`tree discover`** finds the maintainer trees for your open series:
the MAINTAINERS sections covering their files (as get_maintainer.pl
reads them), their `T:` trees, and the branch from linux-next's
Expand All @@ -10,6 +12,10 @@
mainline tree or the current directory, Next/Trees from linux-next. For
a tree whose branch neither file names, it lists the branches and asks
which one (in a terminal), or prints the `tree add` command to finish.
Series a maintainer's mail calls applied are included, so their tree
can confirm it.
- An applied series missing from more than two trees says "not in any
of the N trees checked" instead of naming them all.

## 0.1.0

Expand Down
2 changes: 1 addition & 1 deletion src/patchtrack/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Track an author's patches on public-inbox mailing lists."""

__version__ = "0.1.0"
__version__ = "0.2.0"
10 changes: 6 additions & 4 deletions src/patchtrack/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,8 +632,9 @@ def cmd_tree(args, db):
then their source of truth (``tree rm`` refuses them).

``tree discover`` finds the trees for you. Run in a kernel checkout,
``patchtrack tree discover --add`` is all it takes. For each open
series it reads the files the patches touch, finds the MAINTAINERS
``patchtrack tree discover --add`` is all it takes. For each series
not yet found in a tree (open ones, and those a maintainer's mail
calls applied) it reads the files the patches touch, finds the MAINTAINERS
sections that cover them (as ``get_maintainer.pl`` does) and lists
their ``T:`` trees. Where a ``T:`` line names no branch, linux-next's
``Next/Trees`` supplies the one that feeds linux-next. A tree in
Expand Down Expand Up @@ -761,7 +762,8 @@ def _tree_discover(args, db):
found = _load(args, db)
heads, to_add, open_ends, elsewhere = {}, {}, {}, []
for fam in series.families(found, db.closed()):
if fam.closed is not None or (not args.all and fam.state in series.DONE):
# "applied" stays in: the mail says so, and its tree is how to confirm it
if fam.closed is not None or (not args.all and fam.state in series.DONE - {"applied"}):
continue
s = fam.head
if not routed_to & {a.lower() for a in s.to}:
Expand Down Expand Up @@ -1150,7 +1152,7 @@ def command(name, func, helptext):
sp.add_argument("--no-ls-remote", dest="ls_remote", action="store_false",
help="discover: do not list the branches of trees whose branch is unknown")
sp.add_argument("--add", action="store_true", help="discover: add the trees whose branch is known")
sp.add_argument("--all", action="store_true", help="discover: applied and merged series too")
sp.add_argument("--all", action="store_true", help="discover: queued, in-next, merged and superseded series too")
sp.add_argument("-a", "--author", action="append", help="discover: default: every author synced")
sp.add_argument("-l", "--list", help="discover: only series found by a sync of this inbox")
sp.set_defaults(func=cmd_tree)
Expand Down
7 changes: 6 additions & 1 deletion src/patchtrack/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,12 @@ def _derive(s):
s.evidence += "; no \"applied\" mail in the thread"
elif done == 1:
s.state = "applied"
if misses:
if len(misses) > 2:
# With trees discovered for every subsystem, naming them all hides
# the fact; `show` lists each tree's result.
s.evidence += (f"; not in any of the {len(misses)} trees checked, as of "
f'{max(misses.values())[:16].replace("T", " ")}')
elif misses:
# Today's most useful fact: a maintainer said so, the trees do not show it yet.
s.evidence += "; not in " + ", ".join(
f'{t} as of {w[:16].replace("T", " ")}' for t, w in sorted(misses.items()))
Expand Down
5 changes: 5 additions & 0 deletions tests/test_maintainers.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,17 @@ def setUp(self):
self.db_path = os.path.join(self.tmp.name, "t.sqlite3")
db = store.Store(self.db_path)
for tag, path, to in (("net", "drivers/net/a.c", "netdev@example.org"),
("taken", "drivers/net/b.c", "netdev@example.org"),
("vendor", "drivers/net/vendor/x.c", "netdev@example.org"),
("other", "drivers/net/a.c", "other-project@example.org")):
m = mail(f"{tag}-1@x", f"[PATCH] {tag}: change", ME,
body=f"Change.\n---\ndiff --git a/{path} b/{path}\n--- a/{path}\n+++ b/{path}\n"
"@@ -1 +1 @@\n-a\n+b\n")
m["To"] = to
db.add(m)
# a maintainer's "Applied" reply: its tree is how to confirm it
db.add(mail("taken-reply@x", "Re: [PATCH] taken: change", "net@example.org", irt="taken-1@x",
body="Applied to net-next, thanks!", date="Tue, 06 Oct 2026 10:00:00 +0000"))
db.commit()
db.close()

Expand Down Expand Up @@ -204,6 +208,7 @@ def test_report(self):
self.assertIn("https://github.com/vendor/wireless (no branch", out)
self.assertIn("another project's series): 1\n [PATCH] other: change", out)
self.assertNotIn("torvalds", out)
self.assertIn("[PATCH] taken: change (1 patch) [applied]", out)
self.assertIn("branches: main pending queue", out)
self.assertIn("patchtrack tree add vendor-wireless --repo", out)

Expand Down
9 changes: 9 additions & 0 deletions tests/test_trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,15 @@ def test_mail_says_applied_tree_does_not(self):
self.assertEqual(s.state, "applied")
self.assertIn("not in foo as of 2026-10-26 00:00", s.evidence)

def test_many_trees_missing_are_counted_not_listed(self):
names = ["a", "b", "c"]
s = self.series_with({1: [row(n, "maintainer", None) for n in names]}, applied_mail=True)
self.assertEqual(s.state, "applied")
self.assertIn("not in any of the 3 trees checked, as of 2026-10-26 00:00", s.evidence)
self.assertNotIn("not in a as of", s.evidence)
s = self.series_with({1: [row(n, "maintainer", None) for n in names[:2]]}, applied_mail=True)
self.assertIn("not in a as of 2026-10-26 00:00, b as of", s.evidence)


if __name__ == "__main__":
unittest.main()
Loading