micropython-branch-manager 2.1.1__tar.gz → 3.0.2__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.
- micropython_branch_manager-3.0.2/.cache/pip/http-v2/3/a/9/0/a/3a90a4636ff8a0016bbb5ae63eff66f7ed5689db21aa1584b5f7036f +0 -0
- micropython_branch_manager-2.1.1/.cache/pip/http-v2/c/9/1/f/5/c91f580d88bf83782e78be42725d05696c3911af8667eb629ddc701e.body → micropython_branch_manager-3.0.2/.cache/pip/http-v2/3/a/9/0/a/3a90a4636ff8a0016bbb5ae63eff66f7ed5689db21aa1584b5f7036f.body +9 -9
- micropython_branch_manager-3.0.2/.cache/pip/http-v2/5/f/7/3/c/5f73c55638bab0e38deb49e63e1b83a8d874933898591baf17441634 +0 -0
- micropython_branch_manager-2.1.1/.cache/pip/http-v2/f/9/a/b/3/f9ab31eb3a9dd78406ca10dd83c580077dd9d3c984a8877c762be2f6.body → micropython_branch_manager-3.0.2/.cache/pip/http-v2/5/f/7/3/c/5f73c55638bab0e38deb49e63e1b83a8d874933898591baf17441634.body +0 -0
- micropython_branch_manager-3.0.2/.cache/pip/http-v2/a/1/9/5/3/a19537d3cf37c122db841d6fe4cd322bc10d1a558bb00d146b85cb9a +0 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/.cache/pip/http-v2/a/1/9/5/3/a19537d3cf37c122db841d6fe4cd322bc10d1a558bb00d146b85cb9a.body +0 -0
- micropython_branch_manager-3.0.2/.cache/pip/http-v2/a/d/e/e/f/adeef5b9611702687bbddade5f7c0af65110caf98ba1a0070c9d116e +0 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/.cache/pip/http-v2/a/d/e/e/f/adeef5b9611702687bbddade5f7c0af65110caf98ba1a0070c9d116e.body +0 -0
- micropython_branch_manager-3.0.2/.cache/pip/selfcheck/fe300af6f7d708c14827daac3afc81fbb8306b73de8dd6e3f1f8ea3b +1 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/.pre-commit-config.yaml +2 -2
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/CLAUDE.md +20 -16
- micropython_branch_manager-3.0.2/PKG-INFO +281 -0
- micropython_branch_manager-3.0.2/README.md +265 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/src/micropython_branch_manager/_version.py +2 -2
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/src/micropython_branch_manager/branch_sync.py +4 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/src/micropython_branch_manager/cli.py +34 -16
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/src/micropython_branch_manager/config.py +8 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/src/micropython_branch_manager/git.py +76 -2
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/src/micropython_branch_manager/github.py +1 -3
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/src/micropython_branch_manager/pr.py +13 -7
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/src/micropython_branch_manager/rebase.py +120 -32
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/tests/conftest.py +1 -0
- micropython_branch_manager-3.0.2/tests/test_cli.py +50 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/tests/test_config.py +3 -1
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/tests/test_git.py +26 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/tests/test_github.py +6 -6
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/tests/test_integration.py +55 -1
- micropython_branch_manager-2.1.1/.cache/pip/http-v2/a/1/9/5/3/a19537d3cf37c122db841d6fe4cd322bc10d1a558bb00d146b85cb9a +0 -0
- micropython_branch_manager-2.1.1/.cache/pip/http-v2/a/d/e/e/f/adeef5b9611702687bbddade5f7c0af65110caf98ba1a0070c9d116e +0 -0
- micropython_branch_manager-2.1.1/.cache/pip/http-v2/c/9/1/f/5/c91f580d88bf83782e78be42725d05696c3911af8667eb629ddc701e +0 -0
- micropython_branch_manager-2.1.1/.cache/pip/http-v2/f/9/a/b/3/f9ab31eb3a9dd78406ca10dd83c580077dd9d3c984a8877c762be2f6 +0 -0
- micropython_branch_manager-2.1.1/.cache/pip/selfcheck/fe300af6f7d708c14827daac3afc81fbb8306b73de8dd6e3f1f8ea3b +0 -1
- micropython_branch_manager-2.1.1/PKG-INFO +0 -394
- micropython_branch_manager-2.1.1/README.md +0 -378
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/.gitignore +0 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/.gitlab-ci.yml +0 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/.python-version +0 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/LICENSE +0 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/docs/gitlab_mr_example.png +0 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/pyproject.toml +0 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/src/micropython_branch_manager/__init__.py +0 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/src/micropython_branch_manager/__main__.py +0 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/src/micropython_branch_manager/exceptions.py +0 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/src/micropython_branch_manager/rerere.py +0 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/src/micropython_branch_manager/trailers.py +0 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/src/micropython_branch_manager/update_branch.py +0 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/tests/test_branch_sync.py +0 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/tests/test_exceptions.py +0 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/tests/test_trailers.py +0 -0
- {micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/tests/test_update_branch.py +0 -0
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: uv
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.13.7
|
|
4
4
|
Classifier: Development Status :: 5 - Production/Stable
|
|
5
5
|
Classifier: Environment :: Console
|
|
6
6
|
Classifier: Intended Audience :: Developers
|
|
@@ -51,13 +51,13 @@ An extremely fast Python package and project manager, written in Rust.
|
|
|
51
51
|
- A single tool to replace `pip`, `pip-tools`, `pipx`, `poetry`, `pyenv`, `twine`, `virtualenv`, and
|
|
52
52
|
more.
|
|
53
53
|
- [10-100x faster](https://github.com/astral-sh/uv/blob/main/BENCHMARKS.md) than `pip`.
|
|
54
|
-
- Provides [comprehensive project management](https://github.com/astral-sh/uv/blob/0.
|
|
54
|
+
- Provides [comprehensive project management](https://github.com/astral-sh/uv/blob/0.13.7/README.md#projects), with a
|
|
55
55
|
[universal lockfile](https://docs.astral.sh/uv/concepts/projects/layout#the-lockfile).
|
|
56
|
-
- [Runs scripts](https://github.com/astral-sh/uv/blob/0.
|
|
56
|
+
- [Runs scripts](https://github.com/astral-sh/uv/blob/0.13.7/README.md#scripts), with support for
|
|
57
57
|
[inline dependency metadata](https://docs.astral.sh/uv/guides/scripts#declaring-script-dependencies).
|
|
58
|
-
- [Installs and manages](https://github.com/astral-sh/uv/blob/0.
|
|
59
|
-
- [Runs and installs](https://github.com/astral-sh/uv/blob/0.
|
|
60
|
-
- Includes a [pip-compatible interface](https://github.com/astral-sh/uv/blob/0.
|
|
58
|
+
- [Installs and manages](https://github.com/astral-sh/uv/blob/0.13.7/README.md#python-versions) Python versions.
|
|
59
|
+
- [Runs and installs](https://github.com/astral-sh/uv/blob/0.13.7/README.md#tools) tools published as Python packages.
|
|
60
|
+
- Includes a [pip-compatible interface](https://github.com/astral-sh/uv/blob/0.13.7/README.md#the-pip-interface) for a performance boost with a familiar
|
|
61
61
|
CLI.
|
|
62
62
|
- Supports Cargo-style [workspaces](https://docs.astral.sh/uv/concepts/projects/workspaces) for
|
|
63
63
|
scalable projects.
|
|
@@ -308,7 +308,7 @@ It's pronounced as "you - vee" ([`/juː viː/`](https://en.wikipedia.org/wiki/He
|
|
|
308
308
|
|
|
309
309
|
#### How should I stylize uv?
|
|
310
310
|
|
|
311
|
-
Just "uv", please. See the [style guide](https://github.com/astral-sh/uv/blob/0.
|
|
311
|
+
Just "uv", please. See the [style guide](https://github.com/astral-sh/uv/blob/0.13.7/STYLE.md#styling-uv) for details.
|
|
312
312
|
|
|
313
313
|
#### What platforms does uv support?
|
|
314
314
|
|
|
@@ -337,9 +337,9 @@ for Windows support.
|
|
|
337
337
|
|
|
338
338
|
uv is licensed under either of
|
|
339
339
|
|
|
340
|
-
- Apache License, Version 2.0, ([LICENSE-APACHE](https://github.com/astral-sh/uv/blob/0.
|
|
340
|
+
- Apache License, Version 2.0, ([LICENSE-APACHE](https://github.com/astral-sh/uv/blob/0.13.7/LICENSE-APACHE) or
|
|
341
341
|
<https://www.apache.org/licenses/LICENSE-2.0>)
|
|
342
|
-
- MIT license ([LICENSE-MIT](https://github.com/astral-sh/uv/blob/0.
|
|
342
|
+
- MIT license ([LICENSE-MIT](https://github.com/astral-sh/uv/blob/0.13.7/LICENSE-MIT) or <https://opensource.org/licenses/MIT>)
|
|
343
343
|
|
|
344
344
|
at your option.
|
|
345
345
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"key":"/usr/local","last_check":"2026-11-04T01:19:10.772621+00:00","pypi_version":"26.3"}
|
{micropython_branch_manager-2.1.1 → micropython_branch_manager-3.0.2}/.pre-commit-config.yaml
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
repos:
|
|
2
2
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
3
|
-
rev: v0.
|
|
3
|
+
rev: v0.16.9
|
|
4
4
|
hooks:
|
|
5
5
|
- id: ruff
|
|
6
6
|
args: [--fix]
|
|
7
7
|
- id: ruff-format
|
|
8
8
|
|
|
9
9
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
10
|
-
rev:
|
|
10
|
+
rev: v2.3.1
|
|
11
11
|
hooks:
|
|
12
12
|
- id: mypy
|
|
13
13
|
additional_dependencies: [pydantic>=2.0, cyclopts>=3.0, tomli-w>=1.0]
|
|
@@ -17,7 +17,7 @@ uv sync
|
|
|
17
17
|
```bash
|
|
18
18
|
uv run mbm --help
|
|
19
19
|
uv run mbm init --submodule ./micropython
|
|
20
|
-
uv run mbm rebase upstream/master
|
|
20
|
+
uv run mbm rebase # target: --target, config 'target', upstream/HEAD, upstream/master
|
|
21
21
|
uv run mbm add-pr 12345
|
|
22
22
|
uv run mbm sync <gh-username>
|
|
23
23
|
uv run mbm config
|
|
@@ -71,7 +71,7 @@ uv build
|
|
|
71
71
|
|
|
72
72
|
The tool supports two modes:
|
|
73
73
|
|
|
74
|
-
1. **
|
|
74
|
+
1. **Config mode** - `mbm.toml` (usually in the parent repo root) holds one `[[submodules]]` entry per managed repo, each with a `path` relative to the config. The legacy flat format (top-level `path`/`submodule_path` and `[[branches]]`) still loads. User commits the config file manually.
|
|
75
75
|
2. **Standalone mode** — No config file. Branch metadata is derived from git trailers in merge commit messages.
|
|
76
76
|
|
|
77
77
|
Key concepts:
|
|
@@ -82,9 +82,9 @@ Key concepts:
|
|
|
82
82
|
|
|
83
83
|
### Module Responsibilities
|
|
84
84
|
|
|
85
|
-
- **cli.py**
|
|
86
|
-
- **config.py**
|
|
87
|
-
- **git.py**
|
|
85
|
+
- **cli.py** - CLI using cyclopts. Resolves config path (`--config` flag or `find_config()` walk-up) and the submodule (`--submodule`/`-s` selector or CWD). Resolves the rebase target.
|
|
86
|
+
- **config.py** - Pydantic models (`MBMConfig`, `SubmoduleConfig`, `BranchConfig`). TOML serialization via `tomllib`/`tomli-w`. Config discovery via `find_config()`.
|
|
87
|
+
- **git.py** - Git operations wrapper (`GitRepo` class). Includes conflict detection, rerere support (`configure_rerere`, `is_rerere_enabled`), worktree management, auto-continue rebase, upstream repo/default-branch detection (`upstream_github_repo`, `default_target`) and push remote resolution (`resolve_push_remote`).
|
|
88
88
|
- **trailers.py** — Git trailer support. `format_merge_message()` builds commit messages with MBM trailers. `parse_trailers_from_message()` and `extract_branches_with_metadata()` parse them back.
|
|
89
89
|
- **branch_sync.py** — Branch detection from merge commit subjects. Synchronizes config with detected branches.
|
|
90
90
|
- **rebase.py** — Orchestrates rebase workflow via `RebaseManager`. Trains rerere before rebuilding, uses trailers in merge messages, resolves remotes at runtime.
|
|
@@ -97,15 +97,15 @@ Key concepts:
|
|
|
97
97
|
### Git Operations Flow
|
|
98
98
|
|
|
99
99
|
**Rebase workflow:**
|
|
100
|
-
1. Load config
|
|
100
|
+
1. Load config, resolve target (`--target`, config `target`, `upstream/HEAD`, `upstream/master`)
|
|
101
101
|
2. Fetch from remotes (unless `--local`)
|
|
102
|
-
3.
|
|
103
|
-
4.
|
|
104
|
-
5.
|
|
105
|
-
6.
|
|
106
|
-
7.
|
|
107
|
-
8. Push update branch to GitLab
|
|
108
|
-
9.
|
|
102
|
+
3. Skip branches whose PR is merged (GitHub repo from the `upstream` remote, default `micropython/micropython`); fill missing `author` from the PR
|
|
103
|
+
4. Train rerere from existing integration branch (if rerere enabled)
|
|
104
|
+
5. Create update branch from target
|
|
105
|
+
6. For each branch: fetch PR, rebase onto target (`--onto target <upstream default>` when target is behind upstream's default branch), merge into update branch with trailers
|
|
106
|
+
7. Unless `update_feature_branches` is off: move feature branch refs, set tracking and push them to the head owner's fork
|
|
107
|
+
8. Push update branch to GitLab and print the MR URL
|
|
108
|
+
9. With `--apply`, reset the integration branch to the update branch
|
|
109
109
|
|
|
110
110
|
**PR addition workflow:**
|
|
111
111
|
1. Parse PR identifier (number, URL, or branch name)
|
|
@@ -127,7 +127,7 @@ Git rerere is configured automatically by `mbm init`. Before each rebase:
|
|
|
127
127
|
|
|
128
128
|
### Push Strategy
|
|
129
129
|
|
|
130
|
-
- **Feature branches**
|
|
130
|
+
- **Feature branches** - Pushed to the remote matching the branch `author` (fork owner), or the `pr_url` owner when that URL is a fork. Never `upstream` or a remote for the upstream repo; skipped with a warning when no remote matches.
|
|
131
131
|
- **Integration/update branches** — Pushed to GitLab (remote detected by URL pattern)
|
|
132
132
|
|
|
133
133
|
### Error Handling
|
|
@@ -148,14 +148,18 @@ Conflict detection uses `git status --porcelain` to identify files with conflict
|
|
|
148
148
|
# or: uv tool install micropython-branch-manager
|
|
149
149
|
# Usage: mbm --help
|
|
150
150
|
|
|
151
|
-
|
|
151
|
+
[[submodules]]
|
|
152
|
+
path = "src/micropython"
|
|
152
153
|
integration_branch = "main"
|
|
154
|
+
target = "v1.27.0" # optional
|
|
155
|
+
update_feature_branches = true # optional
|
|
153
156
|
|
|
154
|
-
[[branches]]
|
|
157
|
+
[[submodules.branches]]
|
|
155
158
|
name = "feature-branch-1"
|
|
156
159
|
pr_url = "https://github.com/micropython/micropython/pull/12345"
|
|
157
160
|
pr_number = 12345
|
|
158
161
|
title = "Add feature X"
|
|
162
|
+
author = "andrewleech"
|
|
159
163
|
```
|
|
160
164
|
|
|
161
165
|
## Merge Commit Trailer Format
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: micropython-branch-manager
|
|
3
|
+
Version: 3.0.2
|
|
4
|
+
Summary: Tool for managing MicroPython fork integration branches
|
|
5
|
+
Project-URL: Homepage, https://gitlab.com/alelec/micropython-branch-manager
|
|
6
|
+
Project-URL: Repository, https://gitlab.com/alelec/micropython-branch-manager.git
|
|
7
|
+
Project-URL: Issues, https://gitlab.com/alelec/micropython-branch-manager/-/issues
|
|
8
|
+
Author-email: Andrew Leech <andrew@alelec.net>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Python: >=3.11
|
|
12
|
+
Requires-Dist: cyclopts>=3.0
|
|
13
|
+
Requires-Dist: pydantic>=2.0
|
|
14
|
+
Requires-Dist: tomli-w>=1.0
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# micropython-branch-manager
|
|
18
|
+
|
|
19
|
+
> **Project rename:** This project will be renamed to `marshal-branch-manager` after this final normal release of `micropython-branch-manager`. The new package is not yet available. It will use the `mbm` command and will not provide the `micropython-branch-manager` command alias.
|
|
20
|
+
>
|
|
21
|
+
> Once the new package is available, to migrate a `uv tool` installation, uninstall the old package before installing the new one. Both packages provide `mbm`, so installing them together causes an executable conflict:
|
|
22
|
+
>
|
|
23
|
+
> ```bash
|
|
24
|
+
> uv tool uninstall micropython-branch-manager
|
|
25
|
+
> uv tool install marshal-branch-manager
|
|
26
|
+
> ```
|
|
27
|
+
>
|
|
28
|
+
> For a pip installation, use the same Python environment for both commands:
|
|
29
|
+
>
|
|
30
|
+
> ```bash
|
|
31
|
+
> python -m pip uninstall micropython-branch-manager
|
|
32
|
+
> python -m pip install marshal-branch-manager
|
|
33
|
+
> ```
|
|
34
|
+
|
|
35
|
+
`mbm` keeps a fork of a GitHub project up to date when you're carrying a stack of unmerged PRs and local feature branches on top of upstream. It was written for MicroPython (hence the name) but works with any GitHub-hosted project.
|
|
36
|
+
|
|
37
|
+
The idea is simple. Your fork has an _integration branch_ (say `main` or `mimxrt`) which is basically upstream plus one merge commit per feature branch. When upstream moves, `mbm rebase` throws that branch away and rebuilds it: each feature branch is rebased onto the new upstream on its own, then merged in, in the order listed in `mbm.toml`. You get a clean, readable history where every feature is still an isolated branch you can push back to its PR.
|
|
38
|
+
|
|
39
|
+
On top of that it:
|
|
40
|
+
|
|
41
|
+
- adds new PRs by number, URL or branch name, creating a remote for the PR author's fork if needed
|
|
42
|
+
- skips PRs that GitHub says have already been merged upstream
|
|
43
|
+
- pushes rebased feature branches back to their owner's fork (never to upstream), and checks they haven't changed on the remote first
|
|
44
|
+
- trains `git rerere` from your previous integration branch, so conflicts you've already resolved get resolved again automatically
|
|
45
|
+
- builds the result on a separate `<integration>_update` branch and, if you use GitLab, gives you a pre-filled merge request link to review it
|
|
46
|
+
|
|
47
|
+
## Install
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
uv tool install marshal-branch-manager
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
You'll also want the GitHub CLI (`gh`) installed and logged in (`gh auth login`). It's used for PR lookups; without it `mbm` still works but can't skip merged PRs or fill in PR details.
|
|
54
|
+
|
|
55
|
+
## Quick start
|
|
56
|
+
|
|
57
|
+
`mbm` expects your remotes to look like this:
|
|
58
|
+
|
|
59
|
+
- `upstream`: the GitHub project you're tracking, e.g. `https://github.com/micropython/micropython.git`
|
|
60
|
+
- one remote per fork you push to, e.g. `andrewleech` or `origin` pointing at `git@github.com:andrewleech/micropython.git`
|
|
61
|
+
- optionally a GitLab remote, if you review integration updates as GitLab MRs
|
|
62
|
+
|
|
63
|
+
If MicroPython is a submodule of your project, run `init` from the project root. It writes `mbm.toml` there (commit it with the project) and finds the submodule at `src/micropython` or `micropython`:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
cd my-project
|
|
67
|
+
mbm init --submodule src/micropython --integration-branch main
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
If you're working directly in a fork clone, point it at the repo itself:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
cd my-fork
|
|
74
|
+
mbm init --submodule . --integration-branch main
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Then add some PRs and rebuild whenever upstream moves:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
mbm add-pr 18333 # by PR number
|
|
81
|
+
mbm add-pr https://github.com/micropython/micropython/pull/18229
|
|
82
|
+
mbm rebase # rebuild on the latest upstream
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`add-pr` and `rebase` both leave your integration branch alone and do their work on `<integration>_update`. Check it over (or open the GitLab MR it prints), then either merge that MR or run `mbm rebase --apply` to move the integration branch across once the rebuild is clean.
|
|
86
|
+
|
|
87
|
+
## Commands
|
|
88
|
+
|
|
89
|
+
### `mbm init`
|
|
90
|
+
|
|
91
|
+
Creates `mbm.toml` in the current directory (or the `--config` path) and adds a submodule entry to it. If you don't pass `--integration-branch` it uses whatever branch the repo has checked out. It also turns on `git rerere` in that repo. Running it again with a different `--submodule` adds another entry, so one config can manage several submodules; the other commands pick one with `--submodule`/`-s`, or work it out from your current directory.
|
|
92
|
+
|
|
93
|
+
### `mbm add-pr <pr>`
|
|
94
|
+
|
|
95
|
+
Adds a PR to the integration branch as a merge commit. The PR can be a number, a branch name or a full URL (it has to be a PR against the `upstream` repo).
|
|
96
|
+
|
|
97
|
+
It looks the PR up on GitHub, fetches it, merges it into `<integration>_update` and adds it to `mbm.toml`, including the PR author so later pushes go to the right fork. If a GitLab remote exists the update branch is pushed there and you get an MR link.
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
$ mbm add-pr 18333
|
|
101
|
+
Fetching PR info for: 18333
|
|
102
|
+
Found PR #18333: ports/mimxrt: Update nxp_driver to MCUX_2.16.100.
|
|
103
|
+
Branch: mcux_sdk_2.16
|
|
104
|
+
State: OPEN
|
|
105
|
+
|
|
106
|
+
Creating update branch from mimxrt...
|
|
107
|
+
Fetching PR #18333 from upstream...
|
|
108
|
+
Merging mcux_sdk_2.16 into mimxrt_update...
|
|
109
|
+
Merge completed successfully
|
|
110
|
+
|
|
111
|
+
Pushing mimxrt_update to gitlab...
|
|
112
|
+
|
|
113
|
+
=== PR ADDED SUCCESSFULLY ===
|
|
114
|
+
Create MR: https://gitlab.example.com/.../merge_requests/new?...
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Adding a second PR builds on the same update branch, so you can queue up a few before reviewing.
|
|
118
|
+
|
|
119
|
+
### `mbm rebase`
|
|
120
|
+
|
|
121
|
+
Rebuilds the integration branch on top of a new upstream:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
mbm rebase # onto the default target
|
|
125
|
+
mbm rebase --target v1.27.0 # onto a particular ref, e.g. a release tag
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The target is picked in this order: `--target`, then `target` in `mbm.toml`, then upstream's default branch (`upstream/HEAD`, which `mbm` sets up with `git remote set-head upstream --auto` if it's missing), and finally `upstream/master`.
|
|
129
|
+
|
|
130
|
+
Rebuilding onto a release tag works too. If the target is older than upstream's default branch, each PR branch (which is usually based on the latest upstream) is rebased with `git rebase --onto <target> <upstream default>`, so only the PR's own commits get moved onto the tag, not everything upstream did since.
|
|
131
|
+
|
|
132
|
+
Before touching anything it asks GitHub for the state of each PR and skips any that are merged, printing which ones. They stay in `mbm.toml` until you remove them.
|
|
133
|
+
|
|
134
|
+
Options:
|
|
135
|
+
|
|
136
|
+
- `--local` skips fetching and pushing, handy for a dry run of conflicts
|
|
137
|
+
- `--dry-run` shows what it'd do without changing anything
|
|
138
|
+
- `--apply` moves the integration branch to `<integration>_update` once the run is clean (`git checkout -B`). Use this if you don't review through GitLab.
|
|
139
|
+
- `--no-update-branches` only builds the update branch; your feature branch refs aren't moved, tracked or pushed. Useful if you've got feature branches checked out in other worktrees or just don't want them touched. `--update-branches` forces the opposite, and the default comes from `update_feature_branches` in the config.
|
|
140
|
+
- `--force-push` pushes even if a feature branch on the remote has moved since you last fetched it (careful, you'll lose whatever's there)
|
|
141
|
+
- `--resume` carries on after you've fixed a conflict (see below)
|
|
142
|
+
|
|
143
|
+
Here's what a rebuilt branch looks like, every feature is its own branch off the target, merged in order:
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
* c1c523ebd7 - Merge branch 'mimxrt1176-alt11-pwm' (HEAD -> mimxrt_update)
|
|
147
|
+
|\
|
|
148
|
+
| * e16d226353 - mimxrt: Add ALT11 pin mode support for MIMXRT1176. (mimxrt1176-alt11-pwm)
|
|
149
|
+
* | a288f37e95 - Merge branch 'adc'
|
|
150
|
+
|\ \
|
|
151
|
+
| * | 30aa89db5e - mimxrt/machine_adc: rt117x: Support channel groups. (adc)
|
|
152
|
+
| * | b045f8ae4f - mimxrt/machine_adc: rt117x: Initialize LPADC2.
|
|
153
|
+
* | | 6f84252a13 - Merge branch 'mimx_sdcard_timeouts'
|
|
154
|
+
|\ \ \
|
|
155
|
+
| * | | 623409093a - mimxrt/sdcard: Improve robustness of sdcard driver. (mimx_sdcard_timeouts)
|
|
156
|
+
| * | | 5dd59d4e07 - mimxrt/sdcard: Fix deadlock in sdcard_power_off.
|
|
157
|
+
* | | | 62c3ccf986 - Merge branch 'mimx_Flash_doc'
|
|
158
|
+
|\ \ \ \
|
|
159
|
+
| * | | | cad3bd124a - docs/mimxrt: Add docs for mimxrt.Flash. (mimx_Flash_doc)
|
|
160
|
+
| |/ / /
|
|
161
|
+
* | | | 864c580cfa - Merge branch 'dp83867-phy-driver'
|
|
162
|
+
|\ \ \ \
|
|
163
|
+
| * | | | 76fcf3ce95 - mimxrt/eth: Improve Dual Ethernet configuration. (dp83867-phy-driver)
|
|
164
|
+
| * | | | 7ad3bbaff7 - mimxrt/boards/MIMXRT1170_EVK: Remove obsolete pin defines.
|
|
165
|
+
| * | | | 6a70a07795 - mimxrt/eth: Add DP83867 PHY driver support.
|
|
166
|
+
| |/ / /
|
|
167
|
+
* | | | 03163eaaeb - Merge branch 'phyboard-rt1170'
|
|
168
|
+
|\ \ \ \
|
|
169
|
+
| * | | | 99d763bffb - mimxrt: Add PHYBOARD-RT1170 board support. (phyboard-rt1170)
|
|
170
|
+
| |/ / /
|
|
171
|
+
* | | | 345a5419a3 - Merge branch 'manifest_c_module'
|
|
172
|
+
|\ \ \ \
|
|
173
|
+
| * | | | 12b45387e5 - tools/ci: Add c_module() testing for RP2 and STM32. (manifest_c_module)
|
|
174
|
+
| * | | | ... (more commits)
|
|
175
|
+
* | | | | b61786d615 - Merge branch 'mcux_sdk_2.16'
|
|
176
|
+
|\ \ \ \ \
|
|
177
|
+
| * | | | | 66be1ee6a8 - mimxrt/fsl_lpuart: Use wrapper for IRQ Idle support. (mcux_sdk_2.16)
|
|
178
|
+
| * | | | | 8c34a2df96 - ports/mimxrt: Update nxp_driver to MCUX_2.16.100.
|
|
179
|
+
|/ / / / /
|
|
180
|
+
* / / / / 78ff170de9 - all: Bump version to 1.27.0. (upstream/master, mimxrt)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### `mbm sync <github-user>`
|
|
184
|
+
|
|
185
|
+
Brings `mbm.toml` back in line with what's actually on the integration branch. It reads the merge commits, adds any branches that are missing, and fills in PR number, URL, title and author by looking up PRs from `<github-user>` (plus any branch it can find a PR for). It's the easy way to start using `mbm` on a fork you've been maintaining by hand, or to backfill `author` in an older config.
|
|
186
|
+
|
|
187
|
+
If a PR in the config has been merged upstream, `sync` tells you but leaves the entry alone; take it out yourself when you're ready (sometimes you want to keep it pinned for a while).
|
|
188
|
+
|
|
189
|
+
### `mbm config`
|
|
190
|
+
|
|
191
|
+
Prints the integration branch, configured branches and remotes.
|
|
192
|
+
|
|
193
|
+
## Configuration
|
|
194
|
+
|
|
195
|
+
`mbm.toml` is written by `init`, `add-pr` and `sync`, but it's plain TOML and fine to edit by hand. Branch order matters, it's the merge order.
|
|
196
|
+
|
|
197
|
+
```toml
|
|
198
|
+
[[submodules]]
|
|
199
|
+
path = "src/micropython"
|
|
200
|
+
integration_branch = "main"
|
|
201
|
+
# target = "v1.27.0"
|
|
202
|
+
# update_feature_branches = false
|
|
203
|
+
|
|
204
|
+
[[submodules.branches]]
|
|
205
|
+
name = "mcux_sdk_2.16"
|
|
206
|
+
pr_url = "https://github.com/micropython/micropython/pull/18333"
|
|
207
|
+
pr_number = 18333
|
|
208
|
+
title = "ports/mimxrt: Update nxp_driver to MCUX_2.16.100."
|
|
209
|
+
author = "andrewleech"
|
|
210
|
+
|
|
211
|
+
[[submodules.branches]]
|
|
212
|
+
name = "my-local-hack" # no PR, lives in your fork or just locally
|
|
213
|
+
author = "andrewleech"
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Per submodule:
|
|
217
|
+
|
|
218
|
+
- `path`: the repo, relative to `mbm.toml`
|
|
219
|
+
- `integration_branch`: the branch `mbm` rebuilds
|
|
220
|
+
- `target`: default rebase target, if you don't want upstream's default branch
|
|
221
|
+
- `update_feature_branches`: set to `false` to leave feature branch refs alone during `rebase` (default `true`)
|
|
222
|
+
|
|
223
|
+
Per branch:
|
|
224
|
+
|
|
225
|
+
- `name`: local branch name, the only required field
|
|
226
|
+
- `pr_url`, `pr_number`, `title`: the PR it belongs to, if any
|
|
227
|
+
- `author`: GitHub owner of the fork the branch lives in, used to decide where to push it
|
|
228
|
+
|
|
229
|
+
Branches with a `pr_number` are always fetched fresh from the PR on upstream. Ones without are fetched from the author's fork remote, and `rebase` uses whichever of that and your local branch is newer, so a stale local checkout doesn't matter (and unpushed local commits aren't lost). If the two have diverged it stops and asks you to sort it out first. With no fork remote, or the branch not pushed yet, it just uses the local branch.
|
|
230
|
+
|
|
231
|
+
Older configs with everything at the top level (no `[[submodules]]`) still load fine.
|
|
232
|
+
|
|
233
|
+
The GitHub repo used for PR lookups comes from the `upstream` remote. If there isn't a GitHub `upstream` remote it assumes `micropython/micropython`.
|
|
234
|
+
|
|
235
|
+
## Pushing
|
|
236
|
+
|
|
237
|
+
With a normal (non `--local`) run, `rebase` pushes:
|
|
238
|
+
|
|
239
|
+
- each feature branch to its owner's fork. That's the remote whose URL matches the branch's `author`; if `author` isn't set yet it's taken from the PR on GitHub, or from `pr_url` when that points at a fork. It'll never push to `upstream` or any other remote for the upstream repo. No matching remote means the branch is skipped with a warning.
|
|
240
|
+
- the update branch to your GitLab remote, if you have one, along with an MR link that has the title and description filled in:
|
|
241
|
+
|
|
242
|
+
__omp_shell("[GitLab MR Example](docs/gitlab_mr_example.png)")
|
|
243
|
+
|
|
244
|
+
Before force-pushing a feature branch it checks whether the remote copy has commits you don't have (someone else pushed, or you pushed from another machine). If so that branch is skipped and reported at the end, the rest still go.
|
|
245
|
+
|
|
246
|
+
## Conflicts
|
|
247
|
+
|
|
248
|
+
If a rebase hits a conflict `rerere` can't fix, `mbm` stops, tells you which PR and files, and saves its progress to `.git/mbm-rebase-state.json`:
|
|
249
|
+
|
|
250
|
+
```
|
|
251
|
+
Rebase stopped due to conflicts while integrating PR #12345 (feature-branch).
|
|
252
|
+
Conflicting files:
|
|
253
|
+
ports/stm32/main.c
|
|
254
|
+
py/compile.c
|
|
255
|
+
|
|
256
|
+
Please resolve conflicts manually, then run:
|
|
257
|
+
cd /path/to/micropython
|
|
258
|
+
git rebase --continue
|
|
259
|
+
|
|
260
|
+
Then resume the integration:
|
|
261
|
+
mbm rebase --resume
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Fix it, `git rebase --continue`, then `mbm rebase --resume` and it picks up where it left off. `rerere` remembers your fix, so next time it'll be applied automatically.
|
|
265
|
+
|
|
266
|
+
## Development
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
git clone https://gitlab.com/alelec/micropython-branch-manager.git
|
|
270
|
+
cd micropython-branch-manager
|
|
271
|
+
uv sync
|
|
272
|
+
uv run pytest
|
|
273
|
+
uv run pre-commit install # ruff + mypy on commit
|
|
274
|
+
uv run pre-commit run --all-files
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Versions come from git tags via `hatch-vcs`. Pushing a tag like `v2.2.0` gets CI to publish it to PyPI; in between you'll see dev versions like `2.1.2.dev3+g1b5fe36`.
|
|
278
|
+
|
|
279
|
+
## License
|
|
280
|
+
|
|
281
|
+
MIT
|