bitp 1.6.2__tar.gz → 1.6.4__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 (291) hide show
  1. {bitp-1.6.2 → bitp-1.6.4}/PKG-INFO +16 -3
  2. {bitp-1.6.2 → bitp-1.6.4}/README.md +15 -2
  3. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/cli.py +16 -4
  4. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/ai.py +12 -4
  5. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/b4.py +40 -15
  6. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/common.py +42 -10
  7. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/export.py +149 -56
  8. bitp-1.6.4/bitbake_project/commands/guidance.py +328 -0
  9. bitp-1.6.4/bitbake_project/commands/mail_provider.py +69 -0
  10. bitp-1.6.4/bitbake_project/commands/mail_source.py +384 -0
  11. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/notify.py +7 -8
  12. bitp-1.6.4/bitbake_project/commands/patch_mail.py +155 -0
  13. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/pending.py +11 -0
  14. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/projects.py +2 -2
  15. bitp-1.6.4/bitbake_project/commands/push.py +157 -0
  16. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/query.py +635 -71
  17. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/review.py +138 -10
  18. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/review_cmd.py +78 -4
  19. bitp-1.6.4/bitbake_project/commands/send.py +260 -0
  20. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/ssh_remote.py +25 -7
  21. bitp-1.6.4/bitbake_project/commands/summary.py +148 -0
  22. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/core.py +2 -1
  23. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/daemon.py +1 -2
  24. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/notify.py +19 -23
  25. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/serverlink.py +18 -0
  26. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/ai.py +17 -8
  27. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/app.py +107 -19
  28. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/client.py +143 -5
  29. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/dashboard.py +132 -4
  30. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/drawer.py +1 -1
  31. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/files.py +51 -0
  32. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/help.py +158 -9
  33. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/live.py +1 -0
  34. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/lore.py +252 -20
  35. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/panels.py +134 -5
  36. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/pending.py +113 -27
  37. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/project_settings.py +136 -8
  38. bitp-1.6.4/bitbake_project/tui_app/pullrequest.py +1252 -0
  39. bitp-1.6.4/bitbake_project/tui_app/push.py +253 -0
  40. bitp-1.6.4/bitbake_project/tui_app/reorder.py +161 -0
  41. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/repo_panels.py +64 -6
  42. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/repos.py +8 -3
  43. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/review.py +692 -21
  44. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/settings.py +408 -79
  45. bitp-1.6.4/bitbake_project/tui_app/summary.py +318 -0
  46. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/views.py +43 -4
  47. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/api.py +220 -8
  48. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/api_commands.py +330 -5
  49. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/api_review.py +501 -10
  50. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/server.py +23 -3
  51. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/preview.html +2756 -253
  52. {bitp-1.6.2 → bitp-1.6.4}/bitp.egg-info/PKG-INFO +16 -3
  53. {bitp-1.6.2 → bitp-1.6.4}/bitp.egg-info/SOURCES.txt +25 -0
  54. {bitp-1.6.2 → bitp-1.6.4}/bitp.egg-info/scm_file_list.json +25 -0
  55. {bitp-1.6.2 → bitp-1.6.4}/tests/conftest.py +8 -0
  56. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_change_events.py +10 -3
  57. bitp-1.6.4/tests/unit/test_deploy_bit.py +50 -0
  58. bitp-1.6.4/tests/unit/test_export_patches.py +221 -0
  59. bitp-1.6.4/tests/unit/test_export_prepare.py +141 -0
  60. bitp-1.6.4/tests/unit/test_export_send.py +256 -0
  61. bitp-1.6.4/tests/unit/test_guidance.py +221 -0
  62. bitp-1.6.4/tests/unit/test_keepalive_body.py +50 -0
  63. bitp-1.6.4/tests/unit/test_mail_routes.py +250 -0
  64. bitp-1.6.4/tests/unit/test_mail_source.py +298 -0
  65. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_notify.py +41 -57
  66. bitp-1.6.4/tests/unit/test_own_config.py +70 -0
  67. bitp-1.6.4/tests/unit/test_patch_mail.py +308 -0
  68. bitp-1.6.4/tests/unit/test_push.py +183 -0
  69. bitp-1.6.4/tests/unit/test_reorder.py +106 -0
  70. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_review.py +107 -2
  71. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_review_cli.py +38 -0
  72. bitp-1.6.4/tests/unit/test_serve_command.py +21 -0
  73. bitp-1.6.4/tests/unit/test_summary.py +175 -0
  74. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_tui_app.py +1671 -65
  75. {bitp-1.6.2 → bitp-1.6.4}/.gitignore +0 -0
  76. {bitp-1.6.2 → bitp-1.6.4}/.gitlab-ci.yml +0 -0
  77. {bitp-1.6.2 → bitp-1.6.4}/COPYING +0 -0
  78. {bitp-1.6.2 → bitp-1.6.4}/INSTALL.md +0 -0
  79. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/__init__.py +0 -0
  80. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/__main__.py +0 -0
  81. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/__init__.py +0 -0
  82. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/branch.py +0 -0
  83. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/changes.py +0 -0
  84. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/config.py +0 -0
  85. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/confjson.py +0 -0
  86. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/daemon_cmd.py +0 -0
  87. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/deps.py +0 -0
  88. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/explore.py +0 -0
  89. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/fragment.py +0 -0
  90. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/github_provider.py +0 -0
  91. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/hosts.py +0 -0
  92. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/info.py +0 -0
  93. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/lore_provider.py +0 -0
  94. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/maillist_provider.py +0 -0
  95. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/patches.py +0 -0
  96. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/recipe.py +0 -0
  97. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/repos.py +0 -0
  98. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/search.py +0 -0
  99. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/setup.py +0 -0
  100. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/terminals.py +0 -0
  101. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/tinfoil.py +0 -0
  102. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/update.py +0 -0
  103. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/commands/watch.py +0 -0
  104. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/fzf_bindings.py +0 -0
  105. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/persona.py +0 -0
  106. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/personas/__init__.py +0 -0
  107. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/personas/generic/__init__.py +0 -0
  108. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/personas/yocto/__init__.py +0 -0
  109. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/personas/yocto/bblayers.py +0 -0
  110. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/personas/yocto/commands/__init__.py +0 -0
  111. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/personas/yocto/layers.py +0 -0
  112. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/projects_store.py +0 -0
  113. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tags.py +0 -0
  114. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tmux.py +0 -0
  115. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui/__init__.py +0 -0
  116. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui/base.py +0 -0
  117. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui/demo_dialogs.py +0 -0
  118. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui/demo_inline_prompt.py +0 -0
  119. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui/dialogs.py +0 -0
  120. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui/explore_dialogs.py +0 -0
  121. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui/factory.py +0 -0
  122. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui/fzf_backend.py +0 -0
  123. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui/fzf_inline_prompt.py +0 -0
  124. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui/inline_options.py +0 -0
  125. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui/textual_backend.py +0 -0
  126. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/__init__.py +0 -0
  127. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/catalog.py +0 -0
  128. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/changes.py +0 -0
  129. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/deps.py +0 -0
  130. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/editor.py +0 -0
  131. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/fragments.py +0 -0
  132. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/history.py +0 -0
  133. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/hosts.py +0 -0
  134. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/library.py +0 -0
  135. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/menus.py +0 -0
  136. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/newproject.py +0 -0
  137. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/patches.py +0 -0
  138. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/prefs.py +0 -0
  139. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/properties.py +0 -0
  140. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/pull.py +0 -0
  141. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/recipes.py +0 -0
  142. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/rows.py +0 -0
  143. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/server.py +0 -0
  144. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/terminal.py +0 -0
  145. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/update.py +0 -0
  146. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/tui_app/watches.py +0 -0
  147. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/__init__.py +0 -0
  148. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/auth.py +0 -0
  149. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/sse.py +0 -0
  150. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/favicon.svg +0 -0
  151. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/index.html +0 -0
  152. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/api.js +0 -0
  153. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/app.js +0 -0
  154. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/column-resizer.js +0 -0
  155. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/markdown.js +0 -0
  156. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/sortable.js +0 -0
  157. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/terminal-ws.js +0 -0
  158. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/utils.js +0 -0
  159. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/b4.js +0 -0
  160. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/branch.js +0 -0
  161. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/commits.js +0 -0
  162. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/config.js +0 -0
  163. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/dashboard.js +0 -0
  164. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/deps.js +0 -0
  165. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/explore.js +0 -0
  166. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/export.js +0 -0
  167. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/fragments.js +0 -0
  168. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/hosts.js +0 -0
  169. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/https.js +0 -0
  170. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/info.js +0 -0
  171. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/layer-index.js +0 -0
  172. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/messages.js +0 -0
  173. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/notifications.js +0 -0
  174. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/patches.js +0 -0
  175. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/pending.js +0 -0
  176. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/recipes.js +0 -0
  177. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/setup.js +0 -0
  178. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/terminal.js +0 -0
  179. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/js/views/update.js +0 -0
  180. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/style.css +0 -0
  181. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/terminal.html +0 -0
  182. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/vendor/Sortable.min.js +0 -0
  183. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/vendor/diff2html-ui.min.js +0 -0
  184. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/vendor/diff2html.min.css +0 -0
  185. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/vendor/github-dark.min.css +0 -0
  186. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/vendor/highlight.min.js +0 -0
  187. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/vendor/xterm-addon-fit.min.js +0 -0
  188. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/vendor/xterm.css +0 -0
  189. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/vendor/xterm.min.js +0 -0
  190. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/static/ws-test.html +0 -0
  191. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/terminal.py +0 -0
  192. {bitp-1.6.2 → bitp-1.6.4}/bitbake_project/web/websocket.py +0 -0
  193. {bitp-1.6.2 → bitp-1.6.4}/bitp.egg-info/dependency_links.txt +0 -0
  194. {bitp-1.6.2 → bitp-1.6.4}/bitp.egg-info/entry_points.txt +0 -0
  195. {bitp-1.6.2 → bitp-1.6.4}/bitp.egg-info/requires.txt +0 -0
  196. {bitp-1.6.2 → bitp-1.6.4}/bitp.egg-info/top_level.txt +0 -0
  197. {bitp-1.6.2 → bitp-1.6.4}/docs/ansi_screenshot.py +0 -0
  198. {bitp-1.6.2 → bitp-1.6.4}/docs/capture-screenshots.py +0 -0
  199. {bitp-1.6.2 → bitp-1.6.4}/docs/capture-tui.sh +0 -0
  200. {bitp-1.6.2 → bitp-1.6.4}/docs/images/commits.png +0 -0
  201. {bitp-1.6.2 → bitp-1.6.4}/docs/images/dashboard.png +0 -0
  202. {bitp-1.6.2 → bitp-1.6.4}/docs/images/explore-expanded.png +0 -0
  203. {bitp-1.6.2 → bitp-1.6.4}/docs/images/explore.png +0 -0
  204. {bitp-1.6.2 → bitp-1.6.4}/docs/images/recipes-deps.png +0 -0
  205. {bitp-1.6.2 → bitp-1.6.4}/docs/images/recipes.png +0 -0
  206. {bitp-1.6.2 → bitp-1.6.4}/docs/images/web-changes.png +0 -0
  207. {bitp-1.6.2 → bitp-1.6.4}/docs/images/web-commits.png +0 -0
  208. {bitp-1.6.2 → bitp-1.6.4}/docs/images/web-dashboard.png +0 -0
  209. {bitp-1.6.2 → bitp-1.6.4}/docs/images/web-hosts.png +0 -0
  210. {bitp-1.6.2 → bitp-1.6.4}/docs/images/web-patches.png +0 -0
  211. {bitp-1.6.2 → bitp-1.6.4}/docs/images/web-recipes.png +0 -0
  212. {bitp-1.6.2 → bitp-1.6.4}/docs/images/web-repos.png +0 -0
  213. {bitp-1.6.2 → bitp-1.6.4}/docs/images/web-settings.png +0 -0
  214. {bitp-1.6.2 → bitp-1.6.4}/docs/make-demo-projects.py +0 -0
  215. {bitp-1.6.2 → bitp-1.6.4}/docs/render_screenshot.py +0 -0
  216. {bitp-1.6.2 → bitp-1.6.4}/pyproject.toml +0 -0
  217. {bitp-1.6.2 → bitp-1.6.4}/scripts/build-standalone.py +0 -0
  218. {bitp-1.6.2 → bitp-1.6.4}/scripts/tui-wheels.txt +0 -0
  219. {bitp-1.6.2 → bitp-1.6.4}/setup.cfg +0 -0
  220. {bitp-1.6.2 → bitp-1.6.4}/tests/README.md +0 -0
  221. {bitp-1.6.2 → bitp-1.6.4}/tests/__init__.py +0 -0
  222. {bitp-1.6.2 → bitp-1.6.4}/tests/data/bblayers/simple.conf +0 -0
  223. {bitp-1.6.2 → bitp-1.6.4}/tests/data/bblayers/with_variables.conf +0 -0
  224. {bitp-1.6.2 → bitp-1.6.4}/tests/integration/__init__.py +0 -0
  225. {bitp-1.6.2 → bitp-1.6.4}/tests/integration/test_cli_dispatch.py +0 -0
  226. {bitp-1.6.2 → bitp-1.6.4}/tests/integration/test_projects_command.py +0 -0
  227. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/__init__.py +0 -0
  228. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_ai_settings.py +0 -0
  229. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_b4_diff.py +0 -0
  230. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_b4_missing.py +0 -0
  231. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_b4_threading.py +0 -0
  232. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_b4_trailers.py +0 -0
  233. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_bare_repo.py +0 -0
  234. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_bblayers_parser.py +0 -0
  235. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_changes.py +0 -0
  236. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_cli_branch.py +0 -0
  237. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_cli_changed.py +0 -0
  238. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_cli_commands_exports.py +0 -0
  239. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_cli_parser.py +0 -0
  240. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_colors.py +0 -0
  241. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_command_output_ids.py +0 -0
  242. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_commits_remote_params.py +0 -0
  243. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_config_set_var.py +0 -0
  244. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_confjson.py +0 -0
  245. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_confjson_schema.py +0 -0
  246. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_copy_layout.py +0 -0
  247. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_custom_update.py +0 -0
  248. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_cwd_anchoring.py +0 -0
  249. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_daemon.py +0 -0
  250. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_delete_project.py +0 -0
  251. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_deps_browser.py +0 -0
  252. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_deps_parser.py +0 -0
  253. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_drop_files.py +0 -0
  254. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_explore.py +0 -0
  255. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_fragments_create.py +0 -0
  256. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_fzf_bindings.py +0 -0
  257. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_fzf_menu.py +0 -0
  258. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_github_provider.py +0 -0
  259. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_gitrepo.py +0 -0
  260. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_global_settings.py +0 -0
  261. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_helpers.py +0 -0
  262. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_hosts.py +0 -0
  263. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_info.py +0 -0
  264. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_isdir_probe.py +0 -0
  265. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_layer_add_deps.py +0 -0
  266. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_layer_from_index.py +0 -0
  267. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_layer_resolution.py +0 -0
  268. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_pending.py +0 -0
  269. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_pending_detect.py +0 -0
  270. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_project_override.py +0 -0
  271. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_projects_store.py +0 -0
  272. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_query_recipes.py +0 -0
  273. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_query_repos_origin.py +0 -0
  274. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_recipe_resolve_cache.py +0 -0
  275. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_repo_config.py +0 -0
  276. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_server_ca.py +0 -0
  277. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_server_usage.py +0 -0
  278. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_setup.py +0 -0
  279. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_ssh_remote.py +0 -0
  280. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_state.py +0 -0
  281. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_static_sweep.py +0 -0
  282. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_tags.py +0 -0
  283. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_terminals_cli.py +0 -0
  284. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_tinfoil.py +0 -0
  285. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_tmux.py +0 -0
  286. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_tui_launch.py +0 -0
  287. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_tui_packaging.py +0 -0
  288. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_update.py +0 -0
  289. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_watch.py +0 -0
  290. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_web_auth.py +0 -0
  291. {bitp-1.6.2 → bitp-1.6.4}/tests/unit/test_web_server.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bitp
3
- Version: 1.6.2
3
+ Version: 1.6.4
4
4
  Summary: Manage projects made of git repositories, with BitBake/Yocto support
5
5
  Author-email: Bruce Ashfield <bruce.ashfield@gmail.com>
6
6
  License: GPL-2.0-only
@@ -483,7 +483,10 @@ by dragging one project's row onto another.
483
483
 
484
484
  A review session is a set of commits read one after another, each in
485
485
  full, with notes on each, the ones done ticked, and an AI conversation
486
- about each commit (plus one about the series as a whole). The bit
486
+ about each commit (plus one about the series as a whole: ⇪ Send this
487
+ patch gives the AI the commit's whole patch, and in the series'
488
+ conversation ⇪ Send the whole series gives it every commit's, in order;
489
+ `p` in bit tui). The bit
487
490
  server keeps them per project, so the web page (Reviews), bit tui
488
491
  (Reviews) and the command line see the same ones.
489
492
  Start one from commits marked in a repo's Commits view (📝 Review
@@ -534,7 +537,8 @@ notes <review>`; the first time, it asks for the token `bit serve token`
534
537
  shows). When the agent amends or rebases the commits, the review finds
535
538
  them again when it reads the notes, marks one done, or the review is
536
539
  opened, once they're back in the checkout the review was made from. Edit commit changes the commit itself
537
- (its message, or files as they are at it): the commits after it are
540
+ (its message, or files as they are at it, including ones it doesn't
541
+ change yet, or new ones, to add to it): the commits after it are
538
542
  carried along, and a backup branch keeps the branch as it was.
539
543
 
540
544
  When you're done with a review, ✓ Finish (`F`; `bit review finish`)
@@ -547,6 +551,15 @@ them; when it's checked out, the branch it was made from is checked out
547
551
  first). `bit review finish --delete-branches` deletes both. A finished
548
552
  review isn't looked at for rewritten commits any more.
549
553
 
554
+ Reviews are kept by the bit server, by each project's path there. To
555
+ back them up, or move them with a server, ⇩ Export in the Reviews list
556
+ (`X` in bit tui; `bit review export`, `--all` for every project's)
557
+ saves them to a file, and ⇧ Import… (`I`; `bit review import FILE`)
558
+ puts an export's reviews on a server: each of its projects goes to the
559
+ server's project of the same path, else of the same name, else one you
560
+ pick (`--to`). A review the server has already is kept as whichever
561
+ copy was changed last.
562
+
550
563
  ### Searching for Layers
551
564
 
552
565
  ```bash
@@ -443,7 +443,10 @@ by dragging one project's row onto another.
443
443
 
444
444
  A review session is a set of commits read one after another, each in
445
445
  full, with notes on each, the ones done ticked, and an AI conversation
446
- about each commit (plus one about the series as a whole). The bit
446
+ about each commit (plus one about the series as a whole: ⇪ Send this
447
+ patch gives the AI the commit's whole patch, and in the series'
448
+ conversation ⇪ Send the whole series gives it every commit's, in order;
449
+ `p` in bit tui). The bit
447
450
  server keeps them per project, so the web page (Reviews), bit tui
448
451
  (Reviews) and the command line see the same ones.
449
452
  Start one from commits marked in a repo's Commits view (📝 Review
@@ -494,7 +497,8 @@ notes <review>`; the first time, it asks for the token `bit serve token`
494
497
  shows). When the agent amends or rebases the commits, the review finds
495
498
  them again when it reads the notes, marks one done, or the review is
496
499
  opened, once they're back in the checkout the review was made from. Edit commit changes the commit itself
497
- (its message, or files as they are at it): the commits after it are
500
+ (its message, or files as they are at it, including ones it doesn't
501
+ change yet, or new ones, to add to it): the commits after it are
498
502
  carried along, and a backup branch keeps the branch as it was.
499
503
 
500
504
  When you're done with a review, ✓ Finish (`F`; `bit review finish`)
@@ -507,6 +511,15 @@ them; when it's checked out, the branch it was made from is checked out
507
511
  first). `bit review finish --delete-branches` deletes both. A finished
508
512
  review isn't looked at for rewritten commits any more.
509
513
 
514
+ Reviews are kept by the bit server, by each project's path there. To
515
+ back them up, or move them with a server, ⇩ Export in the Reviews list
516
+ (`X` in bit tui; `bit review export`, `--all` for every project's)
517
+ saves them to a file, and ⇧ Import… (`I`; `bit review import FILE`)
518
+ puts an export's reviews on a server: each of its projects goes to the
519
+ server's project of the same path, else of the same name, else one you
520
+ pick (`--to`). A review the server has already is kept as whichever
521
+ copy was changed last.
522
+
510
523
  ### Searching for Layers
511
524
 
512
525
  ```bash
@@ -133,7 +133,7 @@ except ImportError:
133
133
  GENERIC_COMMANDS = [
134
134
  ("b4", "Mail-based patch management (apply, send, trailers, mbox, pr, ty)", [
135
135
  ("b4 apply", "Apply patch series from lore message-id"),
136
- ("b4 send", "Send patches via b4"),
136
+ ("b4 send", "Send a folder of patches (with git send-email)"),
137
137
  ("b4 trailers", "Show the trailers reviewers gave a series"),
138
138
  ("b4 diff", "Compare versions of a patch series"),
139
139
  ("b4 mbox", "Download a thread as mbox file"),
@@ -1012,12 +1012,12 @@ Options explained:
1012
1012
  export.add_argument(
1013
1013
  "--send",
1014
1014
  action="store_true",
1015
- help="After exporting, send patches via b4 send",
1015
+ help="After exporting, send the patches with git send-email (shown first, then asked)",
1016
1016
  )
1017
1017
  export.add_argument(
1018
1018
  "--send-to",
1019
1019
  metavar="LIST",
1020
- help="Override mailing list for b4 send (default from config)",
1020
+ help="Who to send them to (default: the project's b4 list)",
1021
1021
  )
1022
1022
 
1023
1023
  export_prep = _sub_add(changes_sub,
@@ -1959,6 +1959,8 @@ Examples:
1959
1959
  bit review reply rf934defd 81cb28a -m "Which task do you mean?" # ask about a note
1960
1960
  bit review history # each note: when it was made, changed and done
1961
1961
  bit review finish --delete-branches # done with it: kept for reference, its branches deleted
1962
+ bit review export --all # every project's reviews to a file: a backup
1963
+ bit review --server https://new:8123 import bit-reviews-all-….json # onto a server that moved
1962
1964
  """,
1963
1965
  )
1964
1966
  rv.add_argument("--server", default="", help="A bit server on another computer, at http(s)://host:port")
@@ -2007,6 +2009,16 @@ Examples:
2007
2009
  rdone.add_argument("--undo", action="store_true", help="Not done after all")
2008
2010
  rdone.add_argument("-m", "--message", default="",
2009
2011
  help="What was done about them, kept in the review's history")
2012
+ rexp = rv_sub.add_parser("export", parents=[rv_srv],
2013
+ help="The project's reviews to a file: a backup, or to import on another server")
2014
+ rexp.add_argument("--all", action="store_true", help="Every project's reviews")
2015
+ rexp.add_argument("-o", "--output", default="", metavar="FILE",
2016
+ help="Where (default: bit-reviews-<project>-<date>.json here; - for stdout)")
2017
+ rimp = rv_sub.add_parser("import", parents=[rv_srv],
2018
+ help="An export's reviews, onto this server (each project to its own by path or name)")
2019
+ rimp.add_argument("file", help="The export")
2020
+ rimp.add_argument("--to", default="", metavar="PROJECT",
2021
+ help="Put them all in this project of the server's (its name or path)")
2010
2022
  rfin = rv_sub.add_parser("finish", parents=[rv_srv],
2011
2023
  help="Finish it: kept for reference, out of the way of those going on")
2012
2024
  rfin.add_argument("session", nargs="?", default="", help="Its number in list, id or name (default: the last changed)")
@@ -2347,7 +2359,7 @@ Search options (toggle with Space):
2347
2359
 
2348
2360
  b4_send_parser = b4_sub.add_parser(
2349
2361
  "send",
2350
- help="Send patches via b4 send",
2362
+ help="Send a folder of patches with git send-email (b4 send only sends b4 prep branches)",
2351
2363
  )
2352
2364
  b4_send_parser.add_argument(
2353
2365
  "patch_dir",
@@ -676,8 +676,10 @@ def summarize_commits(
676
676
  preset: str = "changelog",
677
677
  custom_prompt: str = "",
678
678
  include_diffs: bool = False,
679
+ guidance: str = "",
679
680
  ) -> Iterator[str]:
680
- """Yield summary text chunks for the given commits.
681
+ """Yield summary text chunks for the given commits. *guidance*: your
682
+ review rules (guidance.text_for), after the preset's prompt.
681
683
 
682
684
  *repo* is a local path; for remote projects use
683
685
  :func:`summarize_commit_data` with pre-fetched commit text instead.
@@ -689,7 +691,7 @@ def summarize_commits(
689
691
  commit_data = collect_commit_data(repo, hashes, include_diffs=include_diffs)
690
692
  yield from summarize_commit_data(
691
693
  commit_data, len(hashes), settings,
692
- preset=preset, custom_prompt=custom_prompt,
694
+ preset=preset, custom_prompt=custom_prompt, guidance=guidance,
693
695
  )
694
696
 
695
697
 
@@ -699,6 +701,7 @@ def summarize_commit_data(
699
701
  settings: dict,
700
702
  preset: str = "changelog",
701
703
  custom_prompt: str = "",
704
+ guidance: str = "",
702
705
  ) -> Iterator[str]:
703
706
  """Stream the AI summary over already-formatted commit text.
704
707
 
@@ -723,8 +726,9 @@ def summarize_commit_data(
723
726
  user_prompt = (
724
727
  f"Here are {n_commits} commit(s) to analyze:\n\n{commit_data}"
725
728
  )
729
+ from .guidance import with_guidance
726
730
  provider = get_provider(settings)
727
- yield from provider.stream(system_prompt, user_prompt)
731
+ yield from provider.stream(with_guidance(system_prompt, guidance), user_prompt)
728
732
 
729
733
 
730
734
  def continue_review_chat(
@@ -733,8 +737,10 @@ def continue_review_chat(
733
737
  settings: dict,
734
738
  preset: str = "changelog",
735
739
  custom_prompt: str = "",
740
+ guidance: str = "",
736
741
  ) -> Iterator[str]:
737
- """Follow-up turn for an AI review conversation.
742
+ """Follow-up turn for an AI review conversation. *guidance*: your
743
+ review rules (guidance.text_for), given on every turn.
738
744
 
739
745
  The initial review already saw the full diff; a follow-up only needs
740
746
  the subjects for grounding plus the prior exchange, so the model can
@@ -761,6 +767,8 @@ def continue_review_chat(
761
767
  f"{subject_block}\n\n"
762
768
  f"Answer the user's follow-up question about these commits."
763
769
  )
770
+ from .guidance import with_guidance
771
+ system_prompt = with_guidance(system_prompt, guidance)
764
772
  provider = get_provider(settings)
765
773
  yield from provider.chat(system_prompt, history)
766
774
 
@@ -3068,35 +3068,60 @@ def b4_apply(repo: str, msgid: str, method: str = "am") -> int:
3068
3068
  # =============================================================================
3069
3069
 
3070
3070
  def b4_send(patch_dir: str, send_to: Optional[str] = None) -> int:
3071
- """Send patches via b4 send."""
3072
- if not _require_b4():
3073
- return 1
3074
-
3075
- cmd = ["b4", "send", "--no-sign"]
3076
- if send_to:
3077
- cmd.extend(["--to", send_to])
3071
+ """Send a folder of patches (bit changes export's) with git send-email:
3072
+ b4 send only sends a branch b4 prep tracks, not files. The mails are
3073
+ shown as they'd go (a dry run), and sent once that's confirmed."""
3074
+ from .export import patch_text
3075
+ from .send import git_send, placeholders, ways
3078
3076
 
3077
+ if not os.path.isdir(patch_dir):
3078
+ print(f"No folder {patch_dir}")
3079
+ return 1
3079
3080
  patches = sorted(f for f in os.listdir(patch_dir) if f.endswith(".patch"))
3080
3081
  if not patches:
3081
3082
  print("No .patch files found in directory")
3082
3083
  return 1
3083
-
3084
- print(f"\nSending {len(patches)} patch(es) via b4...")
3084
+ how = ways(patch_dir)["git"]
3085
+ if not how["ok"]:
3086
+ print(Colors.yellow("Can't send from here:"), how["why"])
3087
+ return 1
3088
+ if not send_to:
3089
+ print("Who to send it to? Give --to (or set the project's b4 list)")
3090
+ return 1
3091
+ files = []
3085
3092
  for p in patches:
3086
- print(f" {p}")
3093
+ with open(os.path.join(patch_dir, p), "rb") as f:
3094
+ files.append((p, patch_text(f.read())))
3095
+ left = placeholders([text for name, text in files if name == "0000-cover-letter.patch"])
3096
+ if left:
3097
+ print(f"{Colors.yellow('The cover letter still has')} {' and '.join(left)}: edit "
3098
+ f"{os.path.join(patch_dir, '0000-cover-letter.patch')} first")
3099
+ return 1
3100
+
3101
+ d = git_send(patch_dir, [files], [send_to], [], dry_run=True)
3102
+ if not d["ok"]:
3103
+ print(f"{Colors.red(d['failed'])}")
3104
+ return 1
3105
+ print(f"\nSending {len(d['mails'])} mail(s) with git send-email ({how['why']}):")
3106
+ for m in d["mails"]:
3107
+ print(f" {m['subject']}")
3108
+ print(f" To: {m['to']}" + (f"\n Cc: {m['cc']}" if m["cc"] else ""))
3087
3109
 
3088
3110
  try:
3089
- confirm = input("\nProceed? [y/N] ").strip().lower()
3111
+ confirm = input("\nSend them? [y/N] ").strip().lower()
3090
3112
  except (EOFError, KeyboardInterrupt):
3091
3113
  print("\nCancelled.")
3092
3114
  return 0
3093
3115
  if confirm not in ("y", "yes"):
3094
3116
  return 0
3095
3117
 
3096
- result = subprocess.run(
3097
- cmd + [os.path.join(patch_dir, p) for p in patches],
3098
- )
3099
- return result.returncode
3118
+ d = git_send(patch_dir, [files], [send_to], [], dry_run=False)
3119
+ if not d["ok"]:
3120
+ print(f"{Colors.red(d['failed'])}")
3121
+ print(f"Sent {d['sent']} of {len(files)} before it stopped" if d["sent"] else "Nothing was sent")
3122
+ return 1
3123
+ print(f"{Colors.green('Sent')} {d['sent']} mail(s)")
3124
+ return 0
3100
3125
 
3101
3126
 
3102
3127
  # =============================================================================
@@ -1370,20 +1370,52 @@ def author_ident(repo: str) -> Tuple[str, str]:
1370
1370
  return fallback
1371
1371
 
1372
1372
 
1373
+ def subject_header(lines: List[str]) -> Tuple[str, int, int]:
1374
+ """A patch's Subject header in *lines* (its header's, before the body):
1375
+ (its text unfolded, as it's written: a long one goes on over lines
1376
+ that start with a space, and one that isn't ASCII stays encoded;
1377
+ the index of its first line; how many lines it takes), or
1378
+ ("", -1, 0)."""
1379
+ for i, line in enumerate(lines):
1380
+ if not line.strip():
1381
+ break # the header's end
1382
+ if line.lower().startswith("subject:"):
1383
+ n = 1
1384
+ while i + n < len(lines) and lines[i + n][:1] in (" ", "\t"):
1385
+ n += 1
1386
+ text = line.split(":", 1)[1].strip()
1387
+ for more in lines[i + 1:i + n]:
1388
+ text += " " + more.strip()
1389
+ return text, i, n
1390
+ return "", -1, 0
1391
+
1392
+
1393
+ def readable_subject(text: str) -> str:
1394
+ """A Subject header's text as it reads: what's encoded (=?UTF-8?q?…?=,
1395
+ git's way with one that isn't ASCII) decoded."""
1396
+ if "=?" not in text:
1397
+ return text
1398
+ from email.header import decode_header, make_header
1399
+ try:
1400
+ return str(make_header(decode_header(text)))
1401
+ except (ValueError, LookupError, UnicodeDecodeError):
1402
+ return text
1403
+
1404
+
1373
1405
  def patch_subject(patch_path: str) -> str:
1406
+ """The patch's subject, unfolded, with a leading [PATCH ...] taken off."""
1374
1407
  try:
1375
1408
  with open(patch_path, encoding="utf-8") as f:
1376
- for line in f:
1377
- if line.lower().startswith("subject:"):
1378
- subj = line.split(":", 1)[1].strip()
1379
- if subj.startswith("[PATCH"):
1380
- end = subj.find("]")
1381
- if end != -1:
1382
- subj = subj[end + 1 :].strip()
1383
- return subj
1409
+ subj = subject_header(f.read().split("\n"))[0]
1384
1410
  except Exception:
1385
- pass
1386
- return os.path.basename(patch_path)
1411
+ subj = ""
1412
+ if not subj:
1413
+ return os.path.basename(patch_path)
1414
+ if subj.startswith("[PATCH"):
1415
+ end = subj.find("]")
1416
+ if end != -1:
1417
+ subj = subj[end + 1 :].strip()
1418
+ return subj
1387
1419
 
1388
1420
 
1389
1421
  def git_version() -> str:
@@ -45,6 +45,8 @@ from .common import (
45
45
  author_ident,
46
46
  patch_subject,
47
47
  clean_title,
48
+ readable_subject,
49
+ subject_header,
48
50
  git_version,
49
51
  git_request_pull,
50
52
  push_branch_to_target,
@@ -156,6 +158,130 @@ def create_branch_at_cut_point(repo, branch_name, cut_point, force_replace):
156
158
  return False, f"failed to create branch '{branch_name}'"
157
159
 
158
160
 
161
+ def cover_letter_text(author_name: str, author_email: str, date_str: str, prefix_tag: str, version_str: str,
162
+ total: int, groups: list, pull_urls: list = (), request_pulls: list = (),
163
+ diffstats: list = (), git_ver: str = "", subject: str = "", blurb: str = "") -> str:
164
+ """A series' cover letter, as both bit changes export and the Pull
165
+ Request builder write it: the shortlog by repo (*groups*: [(repo, count,
166
+ [subjects])]), the pull branches (*pull_urls*: [(repo, url, branch)]),
167
+ each repo's request-pull text (*request_pulls*: [(repo, text)]), the
168
+ diffstats (["repo:\n<stat>"]), and git's version as the signature.
169
+ *subject* and *blurb* replace the *** SUBJECT HERE *** and *** BLURB
170
+ HERE *** placeholders, which stay when they're empty."""
171
+ out = ["From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001",
172
+ f"From: {author_name} <{author_email}>",
173
+ f"Date: {date_str}",
174
+ f"Subject: {prefix_tag}[PATCH {version_str}0/{total}] {' '.join(subject.split()) or '*** SUBJECT HERE ***'}",
175
+ "",
176
+ blurb.strip("\n").rstrip() or "*** BLURB HERE ***",
177
+ ""]
178
+ for repo_name, count, subjects in groups:
179
+ out.append(f"{repo_name} ({count}):")
180
+ out += [f" {s}" for s in subjects]
181
+ out.append("")
182
+ if pull_urls:
183
+ out.append("Pull requests:")
184
+ out += [f" {repo_name}: git pull {url} {branch_name}" for repo_name, url, branch_name in pull_urls]
185
+ out.append("")
186
+ for repo_name, text in request_pulls:
187
+ out.append(f"{repo_name}:")
188
+ out += [f" {line}" for line in text.splitlines()]
189
+ out.append("")
190
+ for stat in diffstats:
191
+ out += [f" {line.lstrip()}" for line in stat.splitlines()]
192
+ out.append("")
193
+ out += ["-- ", git_ver or git_version()]
194
+ return "\n".join(out) + "\n"
195
+
196
+
197
+ def patch_text(data: bytes) -> str:
198
+ """A patch as text, with its bytes kept: what isn't UTF-8 (a Latin-1
199
+ file in it, say) is carried as surrogates, and patch_bytes gives the
200
+ same bytes back, to save or send exactly what git format-patch wrote."""
201
+ return data.decode("utf-8", "surrogateescape")
202
+
203
+
204
+ def patch_bytes(text: str) -> bytes:
205
+ """patch_text's bytes again."""
206
+ return text.encode("utf-8", "surrogateescape")
207
+
208
+
209
+ def series_folder(name: str) -> str:
210
+ """*name* as a tarball's folder (and file) name."""
211
+ return re.sub(r"[^A-Za-z0-9._+-]+", "-", name).strip("-.") or "patches"
212
+
213
+
214
+ def series_tarball(folder: str, files: list) -> bytes:
215
+ """A .tar.gz of an exported series, to send from another machine:
216
+ *files* ([(path, text)], the path as the export laid it out, a repo's
217
+ folder in it for the per-repo layout) under *folder*. A path that
218
+ would land outside *folder* raises ValueError."""
219
+ import io
220
+ import tarfile
221
+ import time
222
+ folder = series_folder(folder)
223
+ buf = io.BytesIO()
224
+ with tarfile.open(fileobj=buf, mode="w:gz") as tar:
225
+ made = set()
226
+ for path, text in files:
227
+ parts = path.split("/")
228
+ if not path or path.startswith("/") or any(x in ("", ".", "..") for x in parts):
229
+ raise ValueError(f"not a path in the series: {path!r}")
230
+ for i in range(1, len(parts)): # the folders, so it unpacks as git send-email wants it
231
+ d = "/".join([folder] + parts[:i])
232
+ if d not in made:
233
+ made.add(d)
234
+ info = tarfile.TarInfo(d)
235
+ info.type, info.mode, info.mtime = tarfile.DIRTYPE, 0o755, int(time.time())
236
+ tar.addfile(info)
237
+ data = patch_bytes(text)
238
+ info = tarfile.TarInfo(f"{folder}/{path}")
239
+ info.size, info.mode, info.mtime = len(data), 0o644, int(time.time())
240
+ tar.addfile(info, io.BytesIO(data))
241
+ return buf.getvalue()
242
+
243
+
244
+ def diffstat_of(repo: str, commits: list) -> str:
245
+ """The diffstat of *commits* (oldest first) together: git's own when
246
+ they follow one another (as bit changes export's range does), else
247
+ each file's lines added up across them, laid out as git does."""
248
+ if not commits:
249
+ return ""
250
+ try:
251
+ chain = subprocess.check_output(["git", "-C", repo, "rev-list", "--reverse", f"{commits[0]}^..{commits[-1]}"],
252
+ text=True, stderr=subprocess.DEVNULL).split()
253
+ except subprocess.CalledProcessError:
254
+ chain = []
255
+ if chain == list(commits):
256
+ return diffstat_for_range(repo, f"{commits[0]}^..{commits[-1]}")
257
+ files: Dict[str, List[int]] = {}
258
+ for sha in commits:
259
+ try:
260
+ out = subprocess.check_output(["git", "-C", repo, "show", "--numstat", "--format=", sha],
261
+ text=True, stderr=subprocess.DEVNULL)
262
+ except subprocess.CalledProcessError:
263
+ continue
264
+ for line in out.splitlines():
265
+ parts = line.split("\t")
266
+ if len(parts) == 3:
267
+ add, rem = (int(x) if x.isdigit() else 0 for x in parts[:2])
268
+ tot = files.setdefault(parts[2], [0, 0])
269
+ tot[0] += add
270
+ tot[1] += rem
271
+ if not files:
272
+ return ""
273
+ width = max(len(f) for f in files)
274
+ digits = len(str(max(a + r for a, r in files.values())))
275
+ lines = [f" {f.ljust(width)} | {str(a + r).rjust(digits)} {'+' * a}{'-' * r}" for f, (a, r) in sorted(files.items())]
276
+ adds, rems = sum(a for a, _r in files.values()), sum(r for _a, r in files.values())
277
+ summary = f" {len(files)} file{'s' if len(files) != 1 else ''} changed"
278
+ if adds:
279
+ summary += f", {adds} insertion{'s' if adds != 1 else ''}(+)"
280
+ if rems:
281
+ summary += f", {rems} deletion{'s' if rems != 1 else ''}(-)"
282
+ return "\n".join(lines + [summary])
283
+
284
+
159
285
  def diffstat_for_range(repo: str, range_spec: str) -> str:
160
286
  try:
161
287
  if range_spec == "--root":
@@ -596,15 +722,14 @@ def run_export(args) -> int:
596
722
  lines = f.readlines()
597
723
  except Exception:
598
724
  return
599
- new_lines = []
600
- changed = False
601
725
  version_str = f"v{args.series_version} " if args.series_version else ""
602
- for line in lines:
603
- if not changed and line.lower().startswith("subject:"):
604
- new_lines.append(f"Subject: [{display_name}]{prefix_tag}[PATCH {version_str}{idx:02d}/{total:02d}] {title}\n")
605
- changed = True
606
- continue
607
- new_lines.append(line)
726
+ _text, at, n = subject_header([ln.rstrip("\n") for ln in lines])
727
+ changed = at >= 0
728
+ new_lines = lines
729
+ if changed: # the whole header, a folded one's other lines too
730
+ new_lines = lines[:at] + [
731
+ f"Subject: [{display_name}]{prefix_tag}[PATCH {version_str}{idx:02d}/{total:02d}] {title}\n"
732
+ ] + lines[at + n:]
608
733
  if changed:
609
734
  try:
610
735
  with open(patch_path, "w", encoding="utf-8") as f:
@@ -720,45 +845,16 @@ def run_export(args) -> int:
720
845
  author_name, author_email = author_ident(selections[0][1] if selections else ".")
721
846
  date_str = datetime.now().astimezone().strftime("%a, %d %b %Y %H:%M:%S %z")
722
847
  version_str = f"v{args.series_version} " if args.series_version else ""
848
+ groups = [(repo_name, count, [readable_subject(clean_title(patch_subject(patch_path)))
849
+ for _d, patch_path, patch_repo_path in all_patches
850
+ if patch_repo_path == repo_path])
851
+ for repo_name, _layers, _branch, _desc, count, _out_dir, repo_path in summary_entries]
852
+ request_pulls = [(repo_name, request_pull_msgs[repo_path])
853
+ for repo_name, _l, _b, _d, _c, _o, repo_path in summary_entries
854
+ if repo_path in request_pull_msgs]
723
855
  with open(cover_path, "w", encoding="utf-8") as f:
724
- f.write("From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001\n")
725
- f.write(f"From: {author_name} <{author_email}>\n")
726
- f.write(f"Date: {date_str}\n")
727
- f.write(f"Subject: {prefix_tag}[PATCH {version_str}0/{len(all_patches)}] *** SUBJECT HERE ***\n")
728
- f.write("\n")
729
- f.write("*** BLURB HERE ***\n")
730
- f.write("\n")
731
- # Shortlog by repo/layer
732
- for repo_name, layers, branch, desc, count, _out_dir, repo_path in summary_entries:
733
- f.write(f"{repo_name} ({count}):\n")
734
- for display_name, patch_path, patch_repo_path in all_patches:
735
- if patch_repo_path == repo_path:
736
- subj = patch_subject(patch_path)
737
- # Clean up the subject
738
- clean = clean_title(subj)
739
- f.write(f" {clean}\n")
740
- f.write("\n")
741
- if pull_urls:
742
- f.write("Pull requests:\n")
743
- for repo_name, url, branch_name in pull_urls:
744
- f.write(f" {repo_name}: git pull {url} {branch_name}\n")
745
- f.write("\n")
746
- if request_pull_msgs:
747
- for repo_name, layers, branch, desc, count, _out_dir, repo_path in summary_entries:
748
- if repo_path in request_pull_msgs:
749
- f.write(f"{repo_name}:\n")
750
- for line in request_pull_msgs[repo_path].splitlines():
751
- f.write(f" {line}\n")
752
- f.write("\n")
753
- if diffstats:
754
- for stat in diffstats:
755
- lines = stat.splitlines()
756
- for i, line in enumerate(lines):
757
- clean = line.lstrip()
758
- f.write(f" {clean}\n")
759
- f.write("\n")
760
- f.write("-- \n")
761
- f.write(f"{git_version()}\n")
856
+ f.write(cover_letter_text(author_name, author_email, date_str, prefix_tag, version_str,
857
+ len(all_patches), groups, pull_urls, request_pulls, diffstats))
762
858
  print(f"Wrote cover letter: {cover_path}")
763
859
  else:
764
860
  # For per-repo layout, update cover letters with request-pull info if available
@@ -788,17 +884,14 @@ def run_export(args) -> int:
788
884
  print(f"Export complete. Patches written under {args.target_dir}")
789
885
  save_export_state(args.export_state_file, export_state)
790
886
 
791
- # Post-export b4 send
887
+ # Post-export send (git send-email, as b4_send does a folder)
792
888
  if getattr(args, 'send', False):
793
- from .b4 import b4_available, b4_send
794
- if not b4_available():
795
- print(f"\n{Colors.yellow('b4 is not installed.')} Install with: pip install b4 (or your distribution's b4 package)")
796
- else:
797
- send_to = getattr(args, 'send_to', None)
798
- if not send_to:
799
- send_defaults = load_defaults(getattr(args, 'defaults_file', '.bit.defaults'))
800
- send_to = send_defaults.get("b4_default_list")
801
- b4_send(args.target_dir, send_to=send_to)
889
+ from .b4 import b4_send, get_b4_setting
890
+ send_to = getattr(args, 'send_to', None)
891
+ if not send_to:
892
+ send_defaults = load_defaults(getattr(args, 'defaults_file', '.bit.defaults'))
893
+ send_to = get_b4_setting(send_defaults, "b4_default_list")
894
+ b4_send(args.target_dir, send_to=send_to)
802
895
 
803
896
  # Prompt to delete prep state if we used it
804
897
  if used_prep_state and os.path.exists(PREP_STATE_FILE):