【AI-提效】svn diff 配置 bcompare

问题 svn diff 配置 bcompare(20251218)

原生svn diff 没有图形化界面不好用,直接配置diff-cmd = /.../bcompare不能使用

解决方案

不废话,直接上代码

bash 复制代码
#!/bin/bash
# SVN参数转BCompare可接受格式的包装脚本(精简版,无冗余echo)

# 初始化文件路径数组
file_paths=()

# 遍历处理参数(从索引1开始,跳过脚本自身)
i=1
while [ $i -le $# ]; do
    current_arg="${!i}"

    # 过滤SVN的-u参数
    if [ "$current_arg" = "-u" ]; then
        i=$((i + 1))
        continue
    fi

    # 过滤SVN的-L参数及对应的标签
    if [ "$current_arg" = "-L" ] && [ $((i+1)) -le $# ]; then
        i=$((i + 2))
        continue
    fi

    # 收集有效文件路径
    if [ -f "$current_arg" ]; then
        file_paths+=("$current_arg")
    fi

    i=$((i + 1))
done

# 调用BCompare(仅保留错误提示)
if [ ${#file_paths[@]} -ge 2 ]; then
    /your_bcompare_path "${file_paths[0]}" "${file_paths[1]}"
else
    echo "❌ 错误:未提取到足够的文件路径(需2个,实际${#file_paths[@]}个),无法执行BCompare"
    exit 1
fi

代码链接:https://github.com/a200638012/myscripts/tree/main/bash/svn_bcompare_wapper

使用方法

  1. modify your svn config in your home dir like ~/.subversion/config
  1. uncomment diff-cmd
  2. diff-cmd = /yourpath_to_svn_bcompare_wrapper.sh
  1. chomd +x /yourpath_to_svn_bcompare_wrapper.sh
  2. now you can use svn diff xxx.file by bcompare
相关推荐
tanis_319 分钟前
MCP 服务器配置:让 AI 助手直接解析 PDF 文档
ai编程·mcp
程序员鱼皮1 小时前
太秀了,我把自己蒸馏成了 Skill!已开源
ai·程序员·开源·编程·ai编程
Duran.L1 小时前
从限购到畅通:GLM-5.1 Coding Plan接入攻略
人工智能·ai·软件工程·个人开发·ai编程
小程故事多_802 小时前
AI Coding 工程化革命,Superpowers 管流程,ui-ux-pro-max 管质感
人工智能·ui·架构·aigc·ai编程·ux·claude code
陈佬昔没带相机2 小时前
AI 编程更可控,GitHub 亲生子 Spec-kit 带给你优秀的 SDD 体验
ai编程
路飞说AI2 小时前
Error: socksio package not installed 完美解决方案
ai编程·claudecode
踩着两条虫2 小时前
VTJ.PRO AI + 低代码实战:接入高德地图
前端·vue.js·ai编程
摆烂工程师2 小时前
教你如何查询 Codex 最新额度是多少,以及 ChatGPT Pro、Plus、Business 最新额度变化
前端·后端·ai编程
路飞说AI3 小时前
Claude Code WebFetch:Unable to verify domain 快速解决
ai编程·claudecode·webfetch