https://github.com/jingfelix/patche
Modern patch, written in Python. 现代化的 Patch 工具。
https://github.com/jingfelix/patche
apply diff patch python
Last synced: 9 months ago
JSON representation
Modern patch, written in Python. 现代化的 Patch 工具。
- Host: GitHub
- URL: https://github.com/jingfelix/patche
- Owner: jingfelix
- License: mit
- Created: 2024-08-24T10:44:54.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-30T15:17:55.000Z (10 months ago)
- Last Synced: 2025-03-31T12:06:39.091Z (10 months ago)
- Topics: apply, diff, patch, python
- Language: Python
- Homepage:
- Size: 323 KB
- Stars: 87
- Watchers: 3
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## 🔨 Usage
The following commands are supported:
### ➡️ patche apply
Apply a patch to target files.
```shell
patche apply
```
Options:
- `-R, --reverse`: Assume patches were created with old and new files swapped
- `-F, --fuzz LINES`: Set the fuzz factor to LINES for inexact matching
### ↕️ patche show
Show details of a patch file.
```shell
patche show
```
### ⚙️ patche settings
Display current configuration.
```shell
patche settings
```
## 📚 Examples
Here are some examples of how to use `patche` in different scenarios:
| Usage | Introduction |
| --- | --- |
| [MCP Server](docs/mcp.md) | A simple MCP server that offers patch utility for LLMs |
## 🧰 Config
`patche` loads the configuration from a file named `.patche.env` in `$HOME`.
```shell
max_diff_lines = 3
```
## 💻 Development
`patche` uses `pdm` as package manager. To install the dependencies in your workspace, run:
```bash
pdm install --prod
# If you want to trace patche execution
pdm install
# If you want to run tests
pdm run python3 -m unittest tests/test_parse.py
pdm run python3 -m unittest tests/test_apply.py
```
ref: [PDM Documentation](https://pdm-project.org/en/latest/usage/dependency/)