npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

svn-merge-tool

v1.0.6

Published

SVN branch merge CLI tool - merge specific revisions one by one

Downloads

659

Readme

svn-merge-tool

English

逐条合并指定 SVN 修订版本的 CLI 工具,支持自动冲突解决、忽略规则和合并提交信息生成。

功能特性

  • 逐条执行 svn merge -c,自动解决冲突
  • 文本 / 属性冲突 → 接受对方修改(theirs-full
  • 树冲突 → 保留本地版本(working
  • 忽略规则 — 匹配 ignore-merge 的路径始终丢弃(revert),即使没有产生冲突
  • --dry-run 模式 — 预览待合并的修订版本及其日志,不执行任何实际修改
  • --commit — 合并成功后自动执行 svn commit,以生成的 message.txt 内容作为提交日志
  • 控制台仅显示精简进度(带颜色),完整日志实时写入 svnmerge-<时间戳>.log
  • 提交信息(修订版本范围 + svn log 正文)追加到日志文件末尾
  • 合并前自动执行 svn update,检测工作副本脏状态并提示 [y/N]
  • 支持 YAML 配置文件,从当前目录向上自动查找

安装

npm install -g svn-merge-tool

需要 Node.js ≥ 18 且 svn 在 PATH 中可用。

从源码安装(开发模式)

git clone https://github.com/<you>/svn-merge-tool.git
cd svn-merge-tool
npm install
npm link

用法

svn-merge-tool [选项]

选项:
  -c, --config <path>       YAML 配置文件路径
  -w, --workspace <path>    SVN 工作副本目录
  -f, --from <url>         合并来源分支 URL
  -r, --revisions <list>    修订版本或范围,例如 1001,1002-1005,1008
  -o, --output <path>       输出文件目录(覆盖配置中的 output)
  -i, --ignore <paths>      逗号分隔的忽略路径(追加到配置的 ignore 列表)
  -V, --verbose             在控制台显示 ignored/reverted 文件详情
  -d, --dry-run             列出待合并修订版本及日志,不执行合并
  -C, --commit              合并成功后自动执行 svn commit(使用生成的 message.txt)
  -v, --version             显示版本号
  -h, --help                显示帮助

示例

# 自动向上查找 svnmerge.yaml
svn-merge-tool -r 84597-84608,84610

# 预览待合并修订版本,不执行合并
svn-merge-tool -d
svn-merge-tool -d -r 84597-84610

# 合并后自动提交,使用生成的 message 文件作为日志
svn-merge-tool -r 1001 -C

# 命令行传入忽略路径(追加到配置文件的 ignore 列表)
svn-merge-tool -r 1001 -i src/thirdparty/generated,assets/auto

# 指定配置文件
svn-merge-tool -c ./svn.yaml -r 84597-84608,84610

# 全部通过命令行参数指定
svn-merge-tool -w /path/to/copy -f http://svn.example.com/branches/feature -r 1001,1002

# 覆盖配置文件中的 workspace
svn-merge-tool -c ./svn.yaml -w /path/to/override -r 1001,1002,1003

# 显示忽略/还原文件详情
svn-merge-tool -V -r 1001,1002

配置文件

工具从当前目录开始向上查找 svnmerge.yaml(或 .yml)。

workspace: /path/to/working-copy
from: http://svn.example.com/branches/feature
output: /logs/svn             # 可选
commit: true                  # 可选:合并成功后自动 svn commit
verbose: false                # 可选:显示 ignored/reverted 详情(等同于 -V)
ignore:
  - src/thirdparty/generated
  - assets/auto-generated/catalog.json

| 字段 | 说明 | | ----------- | ------------------------------------------------------------------------------------------ | | workspace | SVN 工作副本路径 | | from | 合并来源分支 URL(等同于 -f) | | output | 输出文件目录。绝对路径或相对于 workspace 的路径,默认为 workspace 下的 .svnmerge/ 目录。 | | commit | 设为 true 则合并成功后自动执行 svn commit(等同于 -C) | | verbose | 设为 true 则在控制台显示 ignored/reverted 文件详情(等同于 -V) | | ignore | 需要始终丢弃的工作副本相对路径(文件或目录)。-i 传入的路径会追加到此列表。 |

命令行选项 -w-f-o-V-C 会覆盖配置文件中的对应值。

输出说明

控制台(每条修订)

[1/13] r84597  8%  (2 conflict(s))
  [TREE    ][F]  src/gameplay/module/FooSystem.lua  (working)
  [TREE    ][F]  src/gameplay/module/BarSystem.lua  (working)
[2/13] r84598  15%  ✓

加上 -v 后还会显示忽略/还原条目(灰色):

[1/13] r84597  8%  (2 conflict(s), 2 ignored)
  [TREE    ][F]  src/gameplay/module/FooSystem.lua  (working)
  [TEXT    ][F]  src/thirdparty/generated/hero/buff.xlsx  (ignored)
  [NONE    ][F]  src/thirdparty/generated/hero/skill.xlsx  (reverted)

合并摘要(所有修订完成后)

Merge Summary:
  Tree Conflicts (2):
    [F]  src/gameplay/module/FooSystem.lua  (working)
    [F]  src/gameplay/module/BarSystem.lua  (working)

加上 -v 后还会显示 ignored / Reverted 分组。

输出文件

日志文件写入 output 目录(默认为 workspace 下的 .svnmerge/ 目录)。

| 文件 | 说明 | | ----------------------------- | ------------------------------------------ | | svnmerge-yyyymmddhhmmss.log | 完整合并日志实时写入,提交信息块追加在最后 |

冲突解决规则

| 冲突类型 | 处理方式 | | -------------------------- | ---------------------------------------------- | | 树冲突 | svn resolve --accept working(保留本地) | | 文本冲突 | svn resolve --accept theirs-full(接受对方) | | 属性冲突 | svn resolve --accept theirs-full(接受对方) | | 忽略路径(有冲突) | 强制改为 working,灰色显示 | | 忽略路径(无冲突但有修改) | svn revert,灰色显示为 (reverted) |

技术栈

  • TypeScript 5.5 + ts-node 10.9(直接运行,无需预编译)
  • commander — CLI 参数解析
  • js-yaml — YAML 配置解析

更新日志

1.0.6

  • 不管是否传 -r 参数,合并前均显示日志预览并弹出 [y/N] 确认提示
  • 控制台及日志文件中的 "Conflict Summary" 统一改名为 "Merge Summary"
  • 合并完成后自动将 Merge Message 复制到系统剪贴板(Windows/macOS/Linux)
  • ~/.svnmergerc 新增 copyToClipboard 配置项(默认 true),设为 false 可关闭
  • 复制剪贴板操作同步写入日志文件

1.0.5

  • 自动提交逻辑调整:若有冲突路径不在 ignore 列表中,无论冲突以何种方式处理,均阻止自动 commit
  • Verbose 模式(-V)下,即使所有冲突均为 ignored,也会打印 Merge Summary
  • package.json 补充 licenserepositoryhomepagebugs 字段

1.0.4

  • -d, --dry-run:预览待合并修订版本及日志,不执行合并
  • -i, --ignore <paths>:命令行传入忽略路径(逗号分隔),追加到配置的 ignore 列表
  • -C, --commit / commit: true:合并成功后自动 svn commit,使用生成的提交信息
  • 短标志调整:-V 改为 --verbose-v 改为 --version
  • -f, --from 替代 --from-url;YAML 键重命名:fromUrlfromoutputDiroutputignoreMergeignore
  • 配置文件名从 svn-merge-tool.yaml 改为 svnmerge.yaml
  • 日志文件改名为 svnmerge-yyyymmddhhmmss.log;提交信息追加到日志末尾,不再单独生成 message.txt
  • 配置加载后打印最终参数(workspace、from、output、ignore、verbose、dry-run、commit、revisions)
  • 修复:所有冲突均已解决或 ignored 时,之前错误地跳过自动提交;现在只有 svn resolve 真正失败才阻止提交
  • 修复:自动提交跳过消息现在会列出具体的失败/未解决冲突的修订号

1.0.3

  • YAML 配置字段重命名为小驼峰格式:fromUrloutputDirignoreMerge
  • 新增 outputDir 配置字段:自定义 svn-merge-tool.logsvn-merge-message.txt 的输出目录
  • -r 参数改为可选:不传时自动查询所有 eligible 修订版本(svn mergeinfo --show-revs eligible)并提示确认后合并
  • 文档和帮助文本中的路径示例改为 Unix 风格

1.0.2

  • 新增 -v / --verbose 参数:ignored 和 reverted 文件详情默认不显示,加 -v 才输出到控制台
  • 树冲突以红色显示,文本/属性冲突以黄色显示
  • 冲突汇总现在同步写入 svn-merge-tool.log
  • svn-merge-tool.logsvn-merge-message.txt 生成在 workspace 目录下(而非 cwd)

1.0.1

  • 修复:package.jsonbin 路径多余的 ./ 前缀

1.0.0

  • 初始版本
  • 逐条修订合并并自动解决冲突
  • YAML 配置文件支持 ignore-merge 列表
  • 实时日志流写入
  • 合并信息文件生成
  • 合并前 svn update 和脏状态检查

License

MIT