【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
相关推荐
子兮曰4 天前
Jev 爆发一周:7 秒 Agent 背后的 System One 生态与三场争议
前端·后端·ai编程
1点东西4 天前
做了近两年的Agent开发,其实真正要学的就是这五件事
llm·agent·ai编程
七牛云行业应用4 天前
Qwen-Image-2.1 开源部署完整指南:Diffusers、ComfyUI 与推理服务
ai编程
福如意如我心意4 天前
TencentDB Agent Memory和其他开源memory
ai编程
小虎AI生活4 天前
腾讯开源了一个项目,让 AI 直接用你已经登录好的浏览器
aigc·ai编程
瑶山4 天前
开源编程Agent-OpenCode完整使用教程
开源·agent·ai编程·opencode
技术民工之路4 天前
文生视频 vs 传统视频制作:核心优势
ai编程
plainGeekDev4 天前
Harness 实战:用 Android 登录模块搭一套可靠的 Agent 开发环境
aigc·ai编程·claude
黄昏回响4 天前
从标准化到智能化:信息化的一场“地基革命”——兼论AI如何重新定义“标准化”
ai编程