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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,22 @@ just like a GitHub PR, split into one mail-formatted patch per commit. With
verbatim patch to `<hash>.patch`. The same `--out`, `--force`, and `--squash`
rules apply, and `--commit` cannot be combined with `--squash`.

### Download from a custom host

By default `patchsplit` talks to `github.com`, or `gitlab.com` with `--gitlab`.
Pass `--host <host>` to point it at another host that serves the same patch
endpoints, such as a GitHub Enterprise Server or a self-hosted GitLab instance:

```sh
patchsplit --host git.corp.example.com owner/repo 42
patchsplit --gitlab --host gitlab.internal group/project 7 --squash
```

The host is a bare hostname with an optional port (for example
`gitlab.internal:8443`); requests always use `https`. Do not include a scheme
or a path. Combining `--host` with `--gitlab` selects the GitLab URL layout on
the custom host, while omitting it selects the GitHub layout.

### Download through Tor

Pass `--tor` to route the download through the Tor network instead of
Expand Down Expand Up @@ -288,6 +304,7 @@ error: could not reach the Tor SOCKS5 proxy at 127.0.0.1:9050 (curl exit 7): ...
| `-f, --force` | Overwrite existing patch files. |
| `-s, --squash` | Write the request's net diff as one patch. |
| `--gitlab` | Download a merge request or commit from gitlab.com. |
| `--host <host>` | Use a custom host instead of the platform default. |
| `--commit <hash>` | Download one commit's `.patch`; accepts a short or full hash. |
| `--tor[=<host:port>]` | Download through the Tor network via a SOCKS5 proxy (default: `127.0.0.1:9050`). |
| `-h, --help` | Show help. |
Expand Down
16 changes: 16 additions & 0 deletions README_zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,21 @@ patchsplit --gitlab group/subgroup/project 1 --squash -o mr-1-patches
写入 `<hash>.patch`。`--out`、`--force`、`--squash` 的规则与 GitHub 模式相同,
`--commit` 不能与 `--squash` 同时使用。

### 从自定义主机下载

默认情况下 `patchsplit` 访问 `github.com`,加 `--gitlab` 时访问 `gitlab.com`。
传入 `--host <host>` 可改为访问提供相同补丁接口的其他主机,例如 GitHub
Enterprise Server 或自建的 GitLab 实例:

```sh
patchsplit --host git.corp.example.com owner/repo 42
patchsplit --gitlab --host gitlab.internal group/project 7 --squash
```

host 为纯主机名,可带端口(例如 `gitlab.internal:8443`),请求始终使用
`https`,不要包含协议头或路径。`--host` 与 `--gitlab` 同时使用时按 GitLab 的
URL 结构拼接,不加 `--gitlab` 时按 GitHub 结构拼接。

### 通过 Tor 下载

传入 `--tor` 即可让下载经由 Tor 网络,而不是直接连接 GitHub 或 GitLab:
Expand Down Expand Up @@ -118,6 +133,7 @@ patchsplit zitzhen/patchsplit 16 --tor=[::1]:9050
- `-f, --force`:允许覆盖已存在的 patch 文件。
- `-s, --squash`:将 PR/MR 的最终净变化输出为一个补丁。
- `--gitlab`:改为从 gitlab.com 下载合并请求或单个 commit(项目路径支持子组)。
- `--host <host>`:使用自定义主机名,而非平台默认主机。
- `--commit <hash>`:下载单个 commit 的 `.patch`,接受短哈希或完整哈希。
- `--tor[=<host:port>]`:通过 SOCKS5 代理经 Tor 网络下载(默认 `127.0.0.1:9050`)。
- `-h, --help`:显示帮助。
Expand Down
17 changes: 17 additions & 0 deletions debian/patchsplit.1
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,18 @@ The project argument uses
.I namespace/project
form and may contain subgroups.
.TP
.BR \-\-host " " \fIhost\fR
Download from
.I host
instead of the platform default
.RB ( github.com ", or " gitlab.com " when " \-\-gitlab " is given)."
Use this for a GitHub Enterprise Server or a self-hosted GitLab instance that
serves the same patch endpoints.
.I host
is a bare hostname with an optional port, for example
.IR gitlab.internal:8443 ;
requests always use https. Do not include a scheme or a path.
.TP
.BR \-\-commit " " \fIhash\fR
Download the .patch of a single commit instead of a pull request.
.I hash
Expand Down Expand Up @@ -211,6 +223,11 @@ Download and split merge request 1 from the GitLab project
Download the patch for commit de9ea1a from GitLab and write it to
.BR de9ea1a.patch .
.TP
.B patchsplit \-\-host git.corp.example.com owner/repo 42
Download and split pull request 42 from
.B owner/repo
on a GitHub Enterprise host instead of github.com.
.TP
.B patchsplit zitzhen/patchsplit 16 \-\-tor
Download and split pull request 16 through the default local Tor SOCKS5 proxy.
.TP
Expand Down
17 changes: 17 additions & 0 deletions packaging/patchsplit.1
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,18 @@ The project argument uses
.I namespace/project
form and may contain subgroups.
.TP
.BR \-\-host " " \fIhost\fR
Download from
.I host
instead of the platform default
.RB ( github.com ", or " gitlab.com " when " \-\-gitlab " is given)."
Use this for a GitHub Enterprise Server or a self-hosted GitLab instance that
serves the same patch endpoints.
.I host
is a bare hostname with an optional port, for example
.IR gitlab.internal:8443 ;
requests always use https. Do not include a scheme or a path.
.TP
.BR \-\-commit " " \fIhash\fR
Download the .patch of a single commit instead of a pull request.
.I hash
Expand Down Expand Up @@ -211,6 +223,11 @@ Download and split merge request 1 from the GitLab project
Download the patch for commit de9ea1a from GitLab and write it to
.BR de9ea1a.patch .
.TP
.B patchsplit \-\-host git.corp.example.com owner/repo 42
Download and split pull request 42 from
.B owner/repo
on a GitHub Enterprise host instead of github.com.
.TP
.B patchsplit zitzhen/patchsplit 16 \-\-tor
Download and split pull request 16 through the default local Tor SOCKS5 proxy.
.TP
Expand Down
15 changes: 11 additions & 4 deletions po/patchsplit.pot
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: patchsplit 1.3.1\n"
"Project-Id-Version: patchsplit 1.4.0\n"
"Report-Msgid-Bugs-To: https://github.com/zitzhen/patchsplit/issues\n"
"POT-Creation-Date: 2026-10-07 14:32+0800\n"
"POT-Creation-Date: 2026-11-06 20:21+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -79,6 +79,10 @@ msgstr ""
msgid "commit hash must consist of 4 to 40 hexadecimal characters, got {value}"
msgstr ""

#: src/main.rs
msgid "host must be a bare hostname with an optional port, got {value}"
msgstr ""

#: src/main.rs
msgid "Tor proxy must use host:port form, got {value}"
msgstr ""
Expand Down Expand Up @@ -182,6 +186,8 @@ msgid ""
" -s, --squash Write the net diff as one patch instead of splitting by "
"commit\n"
" --gitlab Download from gitlab.com (merge requests and commits)\n"
" --host <host> Use a custom host, e.g. GitHub Enterprise or self-hosted "
"GitLab\n"
" --commit <hash> Download one commit's .patch (short or full hash)\n"
" --tor[=<host:port>] Download through the Tor network over SOCKS5\n"
" [default: 127.0.0.1:9050]\n"
Expand All @@ -193,6 +199,7 @@ msgid ""
" patchsplit openai codex 42 -o pr-42-patches\n"
" patchsplit openai/codex 42 --squash\n"
" patchsplit zitzhen patchsplit -commit b430113\n"
" patchsplit zitzhen/patchsplit 1 --tor\n"
" patchsplit --gitlab zitzhen/patchsplit 1"
" patchsplit --gitlab zitzhen/patchsplit 1\n"
" patchsplit --host git.corp.example.com owner/repo 42\n"
" patchsplit zitzhen/patchsplit 1 --tor"
msgstr ""
21 changes: 16 additions & 5 deletions po/zh_CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ msgstr "需要提供 GitLab 项目,并通过 --commit <hash> 指定提交"
msgid ""
"GitLab project must use namespace/project form (subgroups allowed), got "
"{value}"
msgstr "GitLab 项目必须使用 namespace/project 格式(允许子组 subgroup),实际为 {value}"
msgstr ""
"GitLab 项目必须使用 namespace/project 格式(允许子组 subgroup),实际为 "
"{value}"

#: src/main.rs
msgid "merge request number must be a positive integer, got {value}"
Expand All @@ -78,6 +80,10 @@ msgstr "合并请求编号必须是正整数,实际为 {value}"
msgid "commit hash must consist of 4 to 40 hexadecimal characters, got {value}"
msgstr "commit 哈希必须为 4 到 40 位十六进制字符,实际为 {value}"

#: src/main.rs
msgid "host must be a bare hostname with an optional port, got {value}"
msgstr "host 必须是纯主机名(可带端口),实际为 {value}"

#: src/main.rs
msgid "Tor proxy must use host:port form, got {value}"
msgstr "Tor 代理必须使用 host:port 格式,实际为 {value}"
Expand Down Expand Up @@ -185,6 +191,8 @@ msgid ""
" -s, --squash Write the net diff as one patch instead of splitting by "
"commit\n"
" --gitlab Download from gitlab.com (merge requests and commits)\n"
" --host <host> Use a custom host, e.g. GitHub Enterprise or self-hosted "
"GitLab\n"
" --commit <hash> Download one commit's .patch (short or full hash)\n"
" --tor[=<host:port>] Download through the Tor network over SOCKS5\n"
" [default: 127.0.0.1:9050]\n"
Expand All @@ -196,8 +204,9 @@ msgid ""
" patchsplit openai codex 42 -o pr-42-patches\n"
" patchsplit openai/codex 42 --squash\n"
" patchsplit zitzhen patchsplit -commit b430113\n"
" patchsplit zitzhen/patchsplit 1 --tor\n"
" patchsplit --gitlab zitzhen/patchsplit 1"
" patchsplit --gitlab zitzhen/patchsplit 1\n"
" patchsplit --host git.corp.example.com owner/repo 42\n"
" patchsplit zitzhen/patchsplit 1 --tor"
msgstr ""
"用法:\n"
" patchsplit <owner/repo> <pr-number> [--out <dir>] [--force] [--squash]\n"
Expand All @@ -214,6 +223,7 @@ msgstr ""
" -f, --force 覆盖已有 patch 文件\n"
" -s, --squash 将净变化输出为一个补丁,而不是按 commit 拆分\n"
" --gitlab 从 gitlab.com 下载(合并请求和 commit)\n"
" --host <host> 使用自定义主机名,例如 GitHub Enterprise 或自建 GitLab\n"
" --commit <hash> 下载单个提交的 .patch(短哈希或完整哈希)\n"
" --tor[=<host:port>] 通过 SOCKS5 经 Tor 网络下载\n"
" [默认:127.0.0.1:9050]\n"
Expand All @@ -225,5 +235,6 @@ msgstr ""
" patchsplit openai codex 42 -o pr-42-patches\n"
" patchsplit openai/codex 42 --squash\n"
" patchsplit zitzhen patchsplit -commit b430113\n"
" patchsplit zitzhen/patchsplit 1 --tor\n"
" patchsplit --gitlab zitzhen/patchsplit 1"
" patchsplit --gitlab zitzhen/patchsplit 1\n"
" patchsplit --host git.corp.example.com owner/repo 42\n"
" patchsplit zitzhen/patchsplit 1 --tor"
Loading
Loading