bugbug 0.0.660__tar.gz → 0.0.661__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. {bugbug-0.0.660 → bugbug-0.0.661}/PKG-INFO +1 -1
  2. bugbug-0.0.661/VERSION +1 -0
  3. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/repository.py +148 -27
  4. bugbug-0.0.660/VERSION +0 -1
  5. {bugbug-0.0.660 → bugbug-0.0.661}/.gitignore +0 -0
  6. {bugbug-0.0.660 → bugbug-0.0.661}/LICENSE +0 -0
  7. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/__init__.py +0 -0
  8. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/bug_features.py +0 -0
  9. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/bug_snapshot.py +0 -0
  10. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/bugzilla.py +0 -0
  11. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/build_platforms.py +0 -0
  12. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/code_search/__init__.py +0 -0
  13. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/code_search/function_search.py +0 -0
  14. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/code_search/mozilla.py +0 -0
  15. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/code_search/parser.py +0 -0
  16. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/code_search/searchfox_api.py +0 -0
  17. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/code_search/searchfox_data.py +0 -0
  18. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/code_search/searchfox_download.py +0 -0
  19. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/commit_features.py +0 -0
  20. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/db.py +0 -0
  21. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/feature_cleanup.py +0 -0
  22. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/github.py +0 -0
  23. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/issue_features.py +0 -0
  24. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/issue_snapshot.py +0 -0
  25. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/labels/annotateignore.csv +0 -0
  26. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/labels/bug_nobug.csv +0 -0
  27. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/labels/defect_enhancement_task.csv +0 -0
  28. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/labels/defect_enhancement_task_e.csv +0 -0
  29. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/labels/defect_enhancement_task_h.csv +0 -0
  30. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/labels/defect_enhancement_task_p.csv +0 -0
  31. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/labels/defect_enhancement_task_s.csv +0 -0
  32. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/labels/regression_bug_nobug.csv +0 -0
  33. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/labels/regressionrange.csv +0 -0
  34. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/labels/str.csv +0 -0
  35. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/labels/tracking.csv +0 -0
  36. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/labels.py +0 -0
  37. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/model.py +0 -0
  38. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/model_calibration.py +0 -0
  39. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/__init__.py +0 -0
  40. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/accessibility.py +0 -0
  41. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/annotate_ignore.py +0 -0
  42. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/assignee.py +0 -0
  43. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/backout.py +0 -0
  44. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/browsername.py +0 -0
  45. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/bugtype.py +0 -0
  46. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/component.py +0 -0
  47. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/component_specific.py +0 -0
  48. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/defect.py +0 -0
  49. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/defect_enhancement_task.py +0 -0
  50. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/devdocneeded.py +0 -0
  51. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/fenixcomponent.py +0 -0
  52. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/fixtime.py +0 -0
  53. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/invalid_compatibility_report.py +0 -0
  54. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/needsdiagnosis.py +0 -0
  55. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/perf_regression_predictor.py +0 -0
  56. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/performancebug.py +0 -0
  57. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/qaneeded.py +0 -0
  58. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/rcatype.py +0 -0
  59. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/regression.py +0 -0
  60. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/regressionrange.py +0 -0
  61. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/regressor.py +0 -0
  62. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/severity.py +0 -0
  63. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/spambug.py +0 -0
  64. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/stepstoreproduce.py +0 -0
  65. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/testconfigdimensions.py +0 -0
  66. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/testconfigselect.py +0 -0
  67. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/testfailure.py +0 -0
  68. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/testselect.py +0 -0
  69. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/tracking.py +0 -0
  70. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/uplift.py +0 -0
  71. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/models/worksforme.py +0 -0
  72. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/nlp.py +0 -0
  73. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/__init__.py +0 -0
  74. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/calibration.py +0 -0
  75. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/commit_risk.py +0 -0
  76. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/datasets.py +0 -0
  77. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/extraction.py +0 -0
  78. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/label_policy.py +0 -0
  79. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/push_status.py +0 -0
  80. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/regression_commits.py +0 -0
  81. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/regression_labeling.py +0 -0
  82. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/selection_pairs.py +0 -0
  83. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/simulation/__init__.py +0 -0
  84. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/simulation/capacity.py +0 -0
  85. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/simulation/detection.py +0 -0
  86. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/simulation/metrics.py +0 -0
  87. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/simulation/optimize.py +0 -0
  88. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/simulation/splits.py +0 -0
  89. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/simulation/stats.py +0 -0
  90. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/simulation/strategies.py +0 -0
  91. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/simulation/timeline.py +0 -0
  92. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/sql/__init__.py +0 -0
  93. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/sql/perf_alerts.sql +0 -0
  94. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/sql/perf_capacity_background.sql +0 -0
  95. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/sql/perf_capacity_builds.sql +0 -0
  96. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/sql/perf_capacity_eligible.sql +0 -0
  97. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/sql/perf_capacity_labels.sql +0 -0
  98. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/sql/perf_capacity_pools.sql +0 -0
  99. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/sql/perf_capacity_workers.sql +0 -0
  100. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/sql/perf_pushes.sql +0 -0
  101. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/sql/perf_task_costs.sql +0 -0
  102. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/sql/perf_task_filter.sql +0 -0
  103. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/task_costs.py +0 -0
  104. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/perf/task_labels.py +0 -0
  105. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/phabricator.py +0 -0
  106. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/redash.py +0 -0
  107. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/rust_code_analysis_server.py +0 -0
  108. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/sklearn_utils.py +0 -0
  109. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/swarm.py +0 -0
  110. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/test_scheduling.py +0 -0
  111. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/test_scheduling_features.py +0 -0
  112. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/__init__.py +0 -0
  113. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/base.py +0 -0
  114. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/code_review/__init__.py +0 -0
  115. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/code_review/agent.py +0 -0
  116. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/code_review/data_types.py +0 -0
  117. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/code_review/database.py +0 -0
  118. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/code_review/langchain_tools.py +0 -0
  119. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/code_review/prompts.py +0 -0
  120. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/code_review/protocols.py +0 -0
  121. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/code_review/review_context.py +0 -0
  122. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/code_review/review_context_schema.py +0 -0
  123. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/code_review/scorer.py +0 -0
  124. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/code_review/utils.py +0 -0
  125. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/comment_matching/agent.py +0 -0
  126. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/comment_matching/prompts.py +0 -0
  127. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/comment_resolution/__init__.py +0 -0
  128. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/comment_resolution/agent.py +0 -0
  129. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/core/__init__.py +0 -0
  130. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/core/connection.py +0 -0
  131. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/core/data_types.py +0 -0
  132. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/core/exceptions.py +0 -0
  133. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/core/llms.py +0 -0
  134. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/core/platforms/__init__.py +0 -0
  135. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/core/platforms/base.py +0 -0
  136. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/core/platforms/bugzilla.py +0 -0
  137. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/core/platforms/patch_apply.py +0 -0
  138. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/core/platforms/phabricator.py +0 -0
  139. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/core/text.py +0 -0
  140. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/core/validators.py +0 -0
  141. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/patch_summarization/__init__.py +0 -0
  142. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/patch_summarization/agent.py +0 -0
  143. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/patch_summarization/prompts.py +0 -0
  144. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/suggestion_filtering/__init__.py +0 -0
  145. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/suggestion_filtering/agent.py +0 -0
  146. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/tools/suggestion_filtering/prompts.py +0 -0
  147. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/utils.py +0 -0
  148. {bugbug-0.0.660 → bugbug-0.0.661}/bugbug/vectordb.py +0 -0
  149. {bugbug-0.0.660 → bugbug-0.0.661}/pyproject.toml +0 -0
  150. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/__init__.py +0 -0
  151. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/analyze_training_metrics.py +0 -0
  152. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/backout_related_test_regressions.py +0 -0
  153. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/bug_classifier.py +0 -0
  154. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/bug_retriever.py +0 -0
  155. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/check.py +0 -0
  156. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/check_all_metrics.py +0 -0
  157. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/ci_failures_matching.py +0 -0
  158. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/comment_classifier.py +0 -0
  159. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/comment_level_labeler.py +0 -0
  160. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/comment_resolver_runner.py +0 -0
  161. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/commit_classifier.py +0 -0
  162. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/commit_retriever.py +0 -0
  163. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/compatibility_report_classifier.py +0 -0
  164. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/gcp_logs_retriever.py +0 -0
  165. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/generate_landings_risk_report.py +0 -0
  166. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/generate_sheet.py +0 -0
  167. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/get_type_labels.py +0 -0
  168. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/get_untriaged.py +0 -0
  169. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/github_issue_classifier.py +0 -0
  170. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/github_issue_retriever.py +0 -0
  171. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/inline_comments_data_collection.py +0 -0
  172. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/integration_test.sh +0 -0
  173. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/maintenance_effectiveness_indicator.py +0 -0
  174. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/microannotate_generator.py +0 -0
  175. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/past_bugs_by_unit.py +0 -0
  176. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/perf_alerts_retriever.py +0 -0
  177. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/perf_commit_risk_scorer.py +0 -0
  178. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/perf_regression_predictor.py +0 -0
  179. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/perf_scheduling_simulator.py +0 -0
  180. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/redundant_failures.py +0 -0
  181. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/regressor_finder.py +0 -0
  182. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/retrieve_ci_failures.py +0 -0
  183. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/retrieve_training_metrics.py +0 -0
  184. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/retrieve_try_pushes.py +0 -0
  185. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/review_comments_retriever.py +0 -0
  186. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/revision_retriever.py +0 -0
  187. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/shadow_scheduler_stats.py +0 -0
  188. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/test_scheduling_history_retriever.py +0 -0
  189. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/testing_policy_stats.py +0 -0
  190. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/trainer.py +0 -0
  191. {bugbug-0.0.660 → bugbug-0.0.661}/scripts/trainer_extract_args.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: bugbug
3
- Version: 0.0.660
3
+ Version: 0.0.661
4
4
  Summary: ML tools for Mozilla projects
5
5
  Author-email: Marco Castelluccio <mcastelluccio@mozilla.com>
6
6
  License-Expression: MPL-2.0
bugbug-0.0.661/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.661
@@ -353,15 +353,44 @@ def get_last_commit(
353
353
  return last_commit[0] if last_commit else None
354
354
 
355
355
 
356
- # The offset of each commit in the commits DB, by node, to find them without reading the whole DB.
356
+ # The offset of each commit in the commits DB, by node, and the nodes of the commits of each bug (by
357
+ # "bug:<id>" keys, see _get_bug_key), to find them without reading the whole DB.
357
358
  COMMITS_INDEX_DB = "data/commits_index.lmdb"
358
359
  # The size of the part of the commits DB which is indexed.
359
360
  COMMITS_INDEX_SIZE_KEY = b"$indexed_size$"
360
- # The serialized commits start with their node (see Commit.to_dict).
361
+ # The serialized commits start with their node, followed by their author and bug ID (see
362
+ # Commit.to_dict). The key can't be found inside the author, as its quotes are escaped.
361
363
  COMMIT_LINE_PREFIX = b'{"node":"'
364
+ COMMIT_BUG_ID_KEY = b',"bug_id":'
362
365
  COMMITS_INDEX_BLOCK_SIZE = 16 * 1024 * 1024
363
366
 
364
367
 
368
+ def _get_bug_key(bug_id: int) -> bytes:
369
+ return b"bug:%d" % bug_id
370
+
371
+
372
+ def _split_nodes(nodes: bytes) -> list[bytes]:
373
+ return [nodes[i : i + 40] for i in range(0, len(nodes), 40)]
374
+
375
+
376
+ def _parse_commit_line(line: bytes) -> tuple[bytes, int | None]:
377
+ """Get the node and the bug ID of a serialized commit, without parsing it whole if possible."""
378
+ if line.startswith(COMMIT_LINE_PREFIX):
379
+ bug_id_start = line.find(COMMIT_BUG_ID_KEY)
380
+ if bug_id_start != -1:
381
+ value_start = bug_id_start + len(COMMIT_BUG_ID_KEY)
382
+ value_end = line.find(b",", value_start)
383
+ value = line[value_start : value_end if value_end != -1 else -1]
384
+ node_start = len(COMMIT_LINE_PREFIX)
385
+ return (
386
+ line[node_start : node_start + 40],
387
+ None if value == b"null" else int(value),
388
+ )
389
+
390
+ commit = orjson.loads(line)
391
+ return commit["node"].encode("ascii"), commit.get("bug_id")
392
+
393
+
365
394
  def _update_commits_index(index: LMDBDict) -> None:
366
395
  # The offset in the DB of the start of `pending`, the part of the DB read but not indexed yet.
367
396
  pos = int(bytes(index.get(COMMITS_INDEX_SIZE_KEY, b"0")))
@@ -375,12 +404,11 @@ def _update_commits_index(index: LMDBDict) -> None:
375
404
  start = 0
376
405
  # Only the complete lines are indexed, in case the DB is being written to.
377
406
  while (end := pending.find(b"\n", start)) != -1:
378
- node_start = start + len(COMMIT_LINE_PREFIX)
379
- if pending.startswith(COMMIT_LINE_PREFIX, start):
380
- node = pending[node_start : node_start + 40]
381
- else:
382
- node = orjson.loads(pending[start:end])["node"].encode("ascii")
407
+ node, bug_id = _parse_commit_line(pending[start:end])
383
408
  index[node] = str(pos + start).encode("ascii")
409
+ if bug_id is not None:
410
+ bug_key = _get_bug_key(bug_id)
411
+ index[bug_key] = bytes(index.get(bug_key, b"")) + node
384
412
  start = end + 1
385
413
  pending = pending[start:]
386
414
  pos += start
@@ -422,6 +450,29 @@ def _get_commits_offsets(nodes: Iterable[str]) -> dict[str, int]:
422
450
  index.close()
423
451
 
424
452
 
453
+ def get_bug_nodes_in_db(bug_ids: Iterable[int]) -> dict[int, list[str]]:
454
+ """Return the nodes of the commits of each of `bug_ids` which are in the commits DB.
455
+
456
+ The nodes are in the order of the DB. The index of the DB is updated first with the commits
457
+ added to the DB since the last update.
458
+ """
459
+ if not os.path.exists(COMMITS_DB):
460
+ return {bug_id: [] for bug_id in bug_ids}
461
+
462
+ index = LMDBDict(COMMITS_INDEX_DB)
463
+ try:
464
+ _update_commits_index(index)
465
+ return {
466
+ bug_id: [
467
+ node.decode("ascii")
468
+ for node in _split_nodes(bytes(index.get(_get_bug_key(bug_id), b"")))
469
+ ]
470
+ for bug_id in bug_ids
471
+ }
472
+ finally:
473
+ index.close()
474
+
475
+
425
476
  def get_nodes_in_db(nodes: Iterable[str]) -> set[str]:
426
477
  """Return the commits among `nodes` which are in the commits DB."""
427
478
  return set(_get_commits_offsets(nodes))
@@ -1440,22 +1491,30 @@ def set_commits_to_ignore(
1440
1491
 
1441
1492
 
1442
1493
  def download_coverage_mapping() -> None:
1494
+ # The DB is built from the whole file, which is large, so only when it changes.
1495
+ is_built = os.path.exists("data/coverage_mapping.lmdb")
1443
1496
  commit_to_coverage = get_coverage_mapping(False)
1444
1497
 
1445
1498
  try:
1446
- utils.download_check_etag(
1447
- "https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/project.relman.code-coverage.production.cron.latest/artifacts/public/commit_coverage.json.zst",
1448
- "data/coverage_mapping.json.zst",
1449
- )
1450
-
1451
- zstd_decompress("data/coverage_mapping.json")
1452
- assert os.path.exists("data/coverage_mapping.json")
1499
+ if (
1500
+ utils.download_check_etag(
1501
+ "https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/project.relman.code-coverage.production.cron.latest/artifacts/public/commit_coverage.json.zst",
1502
+ "data/coverage_mapping.json.zst",
1503
+ )
1504
+ or not is_built
1505
+ ):
1506
+ zstd_decompress("data/coverage_mapping.json")
1507
+ assert os.path.exists("data/coverage_mapping.json")
1453
1508
 
1454
- with open("data/coverage_mapping.json", "r") as f:
1455
- data = json.load(f)
1509
+ with open("data/coverage_mapping.json", "r") as f:
1510
+ data = json.load(f)
1456
1511
 
1457
- for commit_hash, commit_stats in data.items():
1458
- commit_to_coverage[commit_hash.encode("utf-8")] = pickle.dumps(commit_stats)
1512
+ for commit_hash, commit_stats in data.items():
1513
+ commit_to_coverage[commit_hash.encode("utf-8")] = pickle.dumps(
1514
+ commit_stats
1515
+ )
1516
+ else:
1517
+ logger.info("The commit->coverage mapping didn't change")
1459
1518
  except requests.exceptions.HTTPError as e:
1460
1519
  logger.error("Failure downloading commit->coverage mapping %s", e)
1461
1520
 
@@ -1502,18 +1561,26 @@ def set_commit_coverage(commits: Iterable[CommitDict]) -> None:
1502
1561
 
1503
1562
 
1504
1563
  def download_component_mapping():
1564
+ # The DB is built from the whole file, which is large, so only when it changes.
1565
+ is_built = os.path.exists("data/component_mapping.lmdb")
1505
1566
  path_to_component = get_component_mapping(False)
1506
1567
 
1507
- utils.download_check_etag(
1508
- "https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.v2.mozilla-central.latest.source.source-bugzilla-info/artifacts/public/components.json",
1509
- "data/component_mapping.json",
1510
- )
1511
-
1512
- with open("data/component_mapping.json", "r") as f:
1513
- data = json.load(f)
1568
+ if (
1569
+ utils.download_check_etag(
1570
+ "https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.v2.mozilla-central.latest.source.source-bugzilla-info/artifacts/public/components.json",
1571
+ "data/component_mapping.json",
1572
+ )
1573
+ or not is_built
1574
+ ):
1575
+ with open("data/component_mapping.json", "r") as f:
1576
+ data = json.load(f)
1514
1577
 
1515
- for path, component in data.items():
1516
- path_to_component[path.encode("utf-8")] = "::".join(component).encode("utf-8")
1578
+ for path, component in data.items():
1579
+ path_to_component[path.encode("utf-8")] = "::".join(component).encode(
1580
+ "utf-8"
1581
+ )
1582
+ else:
1583
+ logger.info("The file->component mapping didn't change")
1517
1584
 
1518
1585
  close_component_mapping()
1519
1586
 
@@ -1706,6 +1773,27 @@ def get_backsout(hg: hglib.client, revs: list[bytes]) -> dict[str, list[str]]:
1706
1773
  }
1707
1774
 
1708
1775
 
1776
+ def get_backedoutby(hg: hglib.client, revs: list[bytes]) -> dict[str, str]:
1777
+ """Get the node of the commit backing out each of the given commits ("" if none).
1778
+
1779
+ Only the backouts which are in the local repository are known.
1780
+ """
1781
+ if len(revs) == 0:
1782
+ return {}
1783
+
1784
+ args = hglib.util.cmdbuilder(
1785
+ b"log",
1786
+ template="{node}\\0{backedoutby}\\0",
1787
+ rev=revs,
1788
+ )
1789
+ out = hg.rawcommand(args).split(b"\x00")[:-1]
1790
+
1791
+ return {
1792
+ node.decode("ascii"): backedoutby.decode("ascii")
1793
+ for node, backedoutby in hglib.util.grouper(2, out)
1794
+ }
1795
+
1796
+
1709
1797
  BACKOUT_DESC_RE = re.compile(
1710
1798
  r"^(Backed out|Back out|Backout|Revert\b)|This reverts commit", re.I | re.M
1711
1799
  )
@@ -1915,6 +2003,39 @@ def pull(repo_dir: str, branch: str, revision: str, update: bool = False) -> Non
1915
2003
  trigger_pull()
1916
2004
 
1917
2005
 
2006
+ def get_stack(repo_dir: str, branch: str, rev: str) -> list[bytes]:
2007
+ """The nodes of the patches in the stack of a revision, like utils.get_hgmo_stack.
2008
+
2009
+ On try, they are computed from the local repository with the automationrelevant
2010
+ revset of the hgmo extension, which hg.mozilla.org uses for automationrelevance:
2011
+ the draft ancestors of the revision (from the phases pulled from try). On other
2012
+ repositories, the stack is made of the changesets of the push of the revision,
2013
+ which are only known by hg.mozilla.org, so it is retrieved from there.
2014
+ """
2015
+ if branch != "try" or not re.fullmatch(r"[0-9a-f]{40}", rev):
2016
+ return utils.get_hgmo_stack(branch, rev)
2017
+
2018
+ with hglib.open(repo_dir) as hg:
2019
+ changesets = json.loads(
2020
+ hg.rawcommand(
2021
+ hglib.util.cmdbuilder(
2022
+ b"log",
2023
+ rev=f"sort(automationrelevant({rev}))".encode("ascii"),
2024
+ template=b"json(node, files)",
2025
+ config=["hgmo.automationrelevantdraftancestors=true"],
2026
+ )
2027
+ )
2028
+ )
2029
+
2030
+ return [
2031
+ changeset["node"].encode("ascii")
2032
+ for changeset in changesets
2033
+ # Like get_hgmo_stack, don't analyze empty changesets or changesets which
2034
+ # simply specify try parameters.
2035
+ if changeset["files"] not in ([], ["try_task_config.json"])
2036
+ ]
2037
+
2038
+
1918
2039
  def get_commit_patches(repo_dir: str, revs: list[bytes]) -> Iterator[bytes]:
1919
2040
  """Export each revision as its own git-formatted patch (see get_commit_patch).
1920
2041
 
bugbug-0.0.660/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.660
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes