文章摘要
Bram Cohen发布了Manyana项目,提出基于CRDT的版本控制系统新思路。该系统通过标记相互影响的变更来展示冲突,而非传统合并失败。冲突标记更清晰,显示变更内容和操作者,如删除或新增代码段,提升可读性。这解决了传统版本控制中冲突信息不透明的问题。
文章总结
标题:Manyana:基于CRDT的版本控制系统新构想
作者Bram Cohen发布了名为Manyana的开源项目(GitHub链接),提出了一种基于CRDT(无冲突复制数据类型)的版本控制系统创新方案。该项目虽仅包含470行Python代码(目前仅支持单文件操作),但完整呈现了其设计理念。
核心创新点: 1. 革命性冲突处理机制 - 传统系统展示冲突时呈现两个不透明代码块(示例对比展示) - Manyana能清晰标注"谁做了什么"(如"左侧删除函数/右侧添加行") - 冲突标记包含操作意图而非仅显示结果
- CRDT技术优势
- 确保最终一致性:合并永不失败
- 顺序无关性:无论分支合并顺序如何,结果始终一致
- 永久性行排序:解决多分支并行修改时的顺序混乱问题
- 数据结构革新
- 采用"编织"(weave)结构存储完整历史
- 每条代码行都带有增删元数据
- 无需追溯共同祖先或遍历DAG图即可完成合并
- 历史保留特性
- 变基操作不再破坏历史记录
- 通过DAG图中的"主祖先"标注实现历史追溯
项目现状: - 暂未实现cherry-picking和本地撤销功能 - 提供完整设计文档(详见README) - 代码采用公共领域授权
该设计证明了CRDT技术能有效解决现有版本控制系统的用户体验痛点,为下一代工具开发提供了可行方案。
评论总结
以下是评论内容的总结:
支持CRDT应用于版本控制的观点
认为CRDT是自然的选择
- "Codeville predates the introduction of CRDTs by almost a decade, and at least on the face of it the two concepts seem like a natural fit." (评论1)
- "I'm sure a lot of us have been idly wondering why CRDTs aren't used for VCS for some time, so it's really cool to see someone take a stab at it!" (评论2)
对现有VCS的不满
- "We really do need an improvement over git; the question is how to overcome network effects." (评论2)
- "My issue with git is handling non-text files, which is a common issue with game development." (评论7)
对CRDT应用于版本控制的质疑
合并冲突的必要性
- "Often a merge failure indicates a semantic conflict, not just 'two changes in the same place'. You want to be aware of and forced to manually deal with such cases." (评论4)
- "Also keep in mind that syntactic correctness doesn't mean functional correctness." (评论15)
CRDT的适用性问题
- "How on earth is crdt a sound base for a version control system? This makes no sense fundamentally." (评论9)
- "Well, isn't that what the CRDT does in its own data structure?" (评论15)
对现有工具的改进建议
现有工具已足够
- "I just use p4merge as a merge tool and get a proper 4-pane merge tool... I don't understand why you need to switch out the VCS to fix that issue." (评论11)
- "See vim-mergetool... I've resolved conflicts that other people didn't even want to touch." (评论12)
Git的改进空间
- "For the conflicts, note that in Git you can do
git config --global merge.conflictstyle diff3to get something like what is shown in the article." (评论14) - "Jujutsu honestly is the future IMO, it already does what you have outlined but solved in a different way with merges." (评论16)
- "For the conflicts, note that in Git you can do
其他观点
规模与团队协作问题
- "What kind of problems do 1 person, 10 person, 100 person, 1k (etc) teams really run into with managing merge conflicts?" (评论8)
- "Size of repository & rate of change of repositories are starting to push limits of git." (评论6)
对Bram Cohen的认可
- "I like that Bram hasn’t let go of the problem, and is still trying out new ideas in the space." (评论1)
- "In case the name doesn't jump out at you, this is Bram Cohen, inventor of Bittorrent." (评论10)
总结:评论中对CRDT应用于版本控制的看法分歧较大,支持者认为其能改善合并冲突问题,而反对者则质疑其适用性和必要性。同时,许多评论者认为现有工具(如Git及其插件)已能解决大部分问题,或建议改进现有工具而非完全替换。团队规模和协作方式也是讨论的重点之一。