Skip to content

Commit f248f8a

Browse files
committed
Add example for extracting uplift data from Bugzilla
Added a code example demonstrating how to extract uplift requests and approvals from Bugzilla bug histories.
1 parent c3b6696 commit f248f8a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/data.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,32 @@ for bug in bugzilla.get_bugs():
2020
print(bug["id"])
2121
```
2222

23+
### Uplift Data
24+
25+
Here is an example of how to extract uplift requests and approvals from Bugzilla bug histories:
26+
27+
```py
28+
from bugbug import bugzilla, db
29+
30+
db.download(bugzilla.BUGS_DB)
31+
32+
for bug in bugzilla.get_bugs():
33+
for history in bug["history"]:
34+
for change in history["changes"]:
35+
if change["added"].startswith("approval-mozilla"):
36+
uplift_tags = change["added"].split(", ")
37+
for uplift_tag in uplift_tags:
38+
release_channel = uplift_tag[len("approval-mozilla-") : -1]
39+
if uplift_tag.endswith("?"):
40+
print(
41+
f"Uplift: Requested \tBug {bug['id']}\t{history['when']} \t{release_channel}"
42+
)
43+
elif uplift_tag.endswith("+"):
44+
print(
45+
f"Uplift: Approved \tBug {bug['id']}\t{history['when']} \t{release_channel}"
46+
)
47+
```
48+
2349
## Phabricator Revisions
2450

2551
```py

0 commit comments

Comments
 (0)