简体   繁体   English

版本控制系统历史记录处理

[英]version control system history handling

i am currently coding a simple Node.js based revision system: just commit , brunch and revert nothing fancy, just an exercise to keep skills in shape. 我目前正在编写一个基于Node.js的简单修订系统:只需commitbrunchrevert任何花哨的内容,仅是一种使技能保持良好状态的练习。 I am using sqlite as data-backend with following simple shema: 我正在使用sqlite作为具有以下简单shema的数据后端:

commitid int
parentid int
branch text
diff blob

Now when I switch branches, I would need to traverse all the commits and apply the diffs on top on each other, this might work fine for 10 commits but with 1000 this will for sure take some time. 现在,当我切换分支时,我将需要遍历所有提交并将差异彼此叠加应用,这对于10次提交可能效果很好,但是对于1000次提交,这肯定会花费一些时间。 Other systems like Hg or git switch branches within seconds, and ( actual question ) I wonder if them keep some kind of cache like every 100 commits, or how else is this handled? 其他系统,例如Hggit switch会在几秒钟内分支,并且( 实际问题 )我想知道它们是否保留某种高速缓存,例如每100次提交,还是如何处理?

Well, one thing for sure is that, in git: 好吧,可以肯定的是,在git中:

  • you can have several parents 你可以有几个父母
  • the branch name is not part of the commit: the same commit can belong to several branches 分支名称不是提交的一部分:同一提交可以属于多个分支

Also, the blob in git is not the diff, but the full file; 另外,git中的blob不是diff,而是完整文件; but as far as I know, hg keeps the diff. 但据我所知,汞保持差异。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM