问题 svn diff 配置 bcompare(20251218)
原生svn diff 没有图形化界面不好用,直接配置diff-cmd = /…/bcompare不能使用
解决方案
不废话,直接上代码
#!/bin/bash# SVN参数转BCompare可接受格式的包装脚本(精简版,无冗余echo)# 初始化文件路径数组file_paths=()# 遍历处理参数(从索引1开始,跳过脚本自身)i=1while[$i-le$#];docurrent_arg="${!i}"# 过滤SVN的-u参数if["$current_arg"="-u"];theni=$((i+1))continuefi# 过滤SVN的-L参数及对应的标签if["$current_arg"="-L"]&&[$((i+1))-le$#];theni=$((i+2))continuefi# 收集有效文件路径if[-f"$current_arg"];thenfile_paths+=("$current_arg")fii=$((i+1))done# 调用BCompare(仅保留错误提示)if[${#file_paths[@]}-ge2];then/your_bcompare_path"${file_paths[0]}""${file_paths[1]}"elseecho"❌ 错误:未提取到足够的文件路径(需2个,实际${#file_paths[@]}个),无法执行BCompare"exit1fi代码链接:https://github.com/a200638012/myscripts/tree/main/bash/svn_bcompare_wapper
使用方法
- modify your svn config in your home dir like ~/.subversion/config
- uncomment diff-cmd
- diff-cmd = /yourpath_to_svn_bcompare_wrapper.sh
- chomd +x /yourpath_to_svn_bcompare_wrapper.sh
- now you can use svn diff xxx.file by bcompare