处理版本控制系统上的多用户工作
我可以想象多个程序员如何同时在同一代码库上密集工作的系统。
我认为当连接到代码库的程序员之一开始编辑一个文件时,服务器上的版本控制系统应该能够锁定一个文件进行编辑有关代码库更改的实时通知并将更新的文件推送给其他人(通过通知或自动更新)
即时谈论变更集,显示提交和差异(像 Trac 或类似的一些集成源代码历史浏览器也可以)
与某些特色 IDE(如 Netbeans 或 Eclipse)集成的解决方案
但是什么有一些便宜的(完美的开源)解决方案吗?
您测试过哪些系统并可以推荐我使用哪些系统?
编辑1:
建议的解决方案不必提供我在问题中编写的所有功能。 该列表是我想象的该系统可能具有的列表,而不是需求列表。 问题更多是关于如何解决“svn/cvs/etc.. 上的多用户工作”以及您最喜欢哪种解决方案。
编辑2
@thiton 评论的一点点
需要指出的是,存在一种称为 RCS(修订控制系统)的东西。据我所知,RSC 是 CVS 的祖先。 CVS 作为一个概念在 svn、git、mercurial、bazaar 等中实现...
我们从 RSC 转向其后继者的原因是,旧的做事方式会减慢团队工作的速度并使团队工作变得过于复杂。锁定文件并仅在编辑结束后才释放它们,这不是我们想要的方式。 现在,由于我们可以撤消对单个文件的更改(将其恢复到给定的修订号),从而修复我们或其他的错误,因此有必要这样做。
所以我划掉了清单上的第一点(注意它不是按优先级降序写下来的),并感谢@thiton 提醒我这一点。
I can imagine system of how can multiple programmers work intensive on same codebase in same time.
I think the Version Control System on server should be able to lock one file for editing when one of programmers connected to codebase starts editing itLive notification about changes in codebase and pushing updated files to others (via notification or automatic updating)
Chatting about changesets on fly, showing commits and diffs (some integrated source history browser like Trac has or similar would be fine too)
Solution integrated with some featured IDE (like Netbeans or Eclipse)
But what is some cheap (perfect would be open source) solution for this?
What systems have you tested and can recommend me to use?
Edit no.1:
Suggested solution doesn't have to provide all functions I wrote in question.
That list is my imaginary list of what could this system have, not a requirements list.
Question is more about how do you solve "multi-user work on svn/cvs/etc.." and what solution you like most.
Edit no.2
Little bit around @thiton comment
It is very important to point out that there exists something called RCS (Revision Control System). From what I know RSC is an ancestor of CVS. CVS as a concept is implemented in svn, git, mercurial, bazaar, etc...
The reason why we moved from RSC to its successors, is that old way of doing things was slowing down and overcomplicating team work. Locking files and releasing them only after end of editing them, is not the way we want to go.
Now as we can reverse changes on a single file (reverting it to given revision number) and so repair our or others faults, there is need for that.
So I striked out the first point on my list (note it's not written down in descending priority order), and thank @thiton to remind me that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
应用程序生命周期管理 (ALM) 和大量 ALM 工具包涵盖了您提出的问题。此类工具包的示例:
这就是为什么你可能不喜欢它。不过,还有其他选择。
除了所有提到的工具之外,我建议对 subversion 存储库使用以下存储库结构:
此存储库结构侧重于版本控制的以下重要方面:
我提到了这个存储库结构,因为当存在这样的约定时它会很有帮助:
What you ask about is covered by Application Lifecycle Management (ALM) and the plenty of ALM toolkits. Examples of such toolkits:
And that's why you might not like it. There are alternatives, though.
In addition to all the mentioned tools, I would recommend using following repository structure for subversion repository:
This repo structure is focused on following important aspects of version control:
I mentioned this repository structure because it help a lot when such convention exists:
您可以使用 Subversion (svn) 做您想做的事情。我喜欢的实时通知是每次提交后发送的包含更改差异的电子邮件。一开始这有点奇怪,但一旦你习惯了,你就会想念它,如果它不可用。
每个开发人员都有电子邮件并且知道如何处理它。如果您不想被打扰,只需关闭邮件客户端即可。由于它在服务器上运行,因此它适用于所有工具。您可以找到有关此问题的教程。
如果一名开发人员正在编辑文件,我不会锁定该文件。在这种情况下,所有其他开发人员都无法进行更改,并且每个人的速度都会变慢。如果您的业务逻辑有很长的帮助程序类,那么这种情况会很快发生。
并且不自动更新工作副本。如果您正在构建项目或更改文件,则很容易导致冲突。在最好的情况下,您只需要再次构建它,但在最坏的情况下,您会丢失自上次提交以来的所有数据。
如果您更喜欢分布式版本控制系统,也可以使用 git 和 Mercurial 来完成挂钩脚本方法。在这种情况下,挂钩在您选择作为主库的存储库上运行。
You can do what you want with Subversion (svn). What I like for live notifications is an email sent after every commit with the diff of the change. This seams strange at first but as soon as you get used to it you miss it if it's not available.
Every developer has e-mail and knows how to handle it. If you do not want to be disturbed you simply close your mail client. It works with every tool since it runs on the server. You can find a tutorial on this Question.
I would not lock a file if one developer is editing it. In this case all other developers can't make their changes and everyone get slowed down. This happens quiet fast if you have long helper classes for your business logic.
And do not automatically update the working copy. If you are building your project or changing a file it leads easily to conflicts. In the best case you only have to build it again, but on the worst case you lost all your data since your last commit.
The hook script approach can be done also with git and mercurial, if you prefer a distributed version control system. In that case the hook runs on the repository you elected to be the master.
如果您确实希望在其他人提交更改时在工作树中进行实时更新,那么您需要像 ClearCase 这样的东西,但这绝对不便宜(我和我认识的大多数人都讨厌它)。
否则,如果您希望在准备好后手动拉取其他人的更改,则您在编辑 2 中列出的所有 VCS 都会执行电子邮件通知(您需要自己编写一个挂钩脚本,在大多数情况下)例),并且大多数都有图形界面,可以进行差异和其他操作。
您没有提供足够的信息来决定推荐哪个。您必须决定是想要集中式还是分布式,除此之外,这实际上只是一个品味问题。我不知道有任何集成的聊天工具,但是,嘿,设置一个 IRC 服务器并不难,或者只是在 freenode 上创建一个房间(如果你不做任何保密的事情)。
SVN、Git 和 Bazaar 都是不错的选择。我没有使用过 Mercurial,但我听说过它的一些好消息。 Arch 可以用,但我不喜欢它。 CVS 可以工作,但是带有变更集的东西将使历史(更)以后更容易理解。
其他 VCS 也可用。
If you really want live updates in your working tree when others commit changes then you need something like ClearCase, but that's most decidedly not cheap (and I and most people I know hate it).
Otherwise, if you prefer to pull others' changes manually when you're ready for them, all the VCS you list in edit 2 will do email notifications (you need to write a hook script yourself, in most cases), and most have graphical interfaces that do diffs and what-not.
You haven't given enough info to decide which to recommend. You have to decide if you want centralized or distributed, and then beyond that it's really just a matter of taste. I'm not aware of any having integrated chat facilities, but hey, it's not hard to set up an IRC server, or just create a room on freenode (if you're not doing anything confidential).
SVN, Git, and Bazaar are all good options. I've not used Mercurial, but I've heard good things about it. Arch will work, but I don't like it. CVS will work, but something with changesets will make the history easier to understand (much) later.
Other VCS are available also.
关于版本控制系统的使用有多种思想流派。
我的偏好是尝试让每个即将推出的功能在单独的功能分支中运行(无论多小)。分配给该功能的人员只能进行自己的更改;没有来自其他开发者的干扰。
错误修复(除了真正微不足道的错误之外)也首先作为单独的分支进行,只是为了保持主干线的稳定和干净。最新的主干版本始终对应于产品的最后交付版本(版本)。
当准备新版本时,如果只有一个更改即将到来,并且该更改本身基于先前交付的版本,则可以针对分支版本运行测试,并且在新版本发布时,从分支只是集成到主干版本中。像 cvs 和 svn 这样的版本控制系统对这种合并操作有很好的支持(我自己没有使用过 git,但了解分支和合并在那里也处理得很好)。
如果有几个不同的更改需要集成,我更喜欢创建一个单独的“集成”分支,我首先将所有要集成的更改一一收集到该分支。同样,当存在冲突编辑时(即单个代码文件的一个位置有两个不同的更改),版本控制系统会进行标记。可以理解的是,他们无法判断是否存在由几个不同的变化引起的功能冲突。因此,每次集成后至少需要一些监督,最好还需要测试。
然后,当所有单独的更改都已集成到集成分支时,可以对其进行彻底测试,并在准备发布时再次合并到主干。如果需要做进一步的修正,可以在原来的特征分支中进一步发展,然后将修正的agani集成到集成分支中。
这种方式非常适合快速错误纠正响应,因为主干始终包含最新版本。它还非常适合投机开发,因为独特的功能分支仅在集成时影响主干线。此外,功能可以在多个发布周期内工作,因为发布不会影响功能分支中正在进行的开发。这样,“巴士因素”(如果一名开发人员被巴士碾过会发生什么情况)也减少了;不完整甚至无法编译的代码可以在功能分支中签入——如果有人因任何原因缺勤,所有完成的工作都可供其他开发人员使用。此外,工作站灾难不会引起重大担忧,就像工作站可以轻松容纳一周的未签入、未备份的开发工作一样。
随着新版本的发布,是否始终将长期存在的功能分支更新到最新版本是一个策略问题,并且也可能取决于上一个版本中的内容。另一个政策问题是整合分支的所有权;是否有某个人负责收集所有功能分支更改并进行所需的小更改以使它们适应其他更改,或者每个功能开发人员/团队是否负责将特定功能分支的更改获取到集成分支。我喜欢单独的“发布构建者”(当然,他通常是功能开发人员之一)。
至少在我的现实中,如果 3-4 名开发人员能够相互沟通(共享办公空间是首选方式),他们似乎可以在一个分支中很好地工作。他们确实自己安排工作,并且可以避免踩到对方的脚趾。此外,单独的功能分支似乎很少相互接触相同的文件,因此大多数合并周期都相当轻松(并且可以通过更改描述来预测痛苦的周期)。另一方面,如果变更没有在分支中隔离,即使单个开发人员在多个不同但同时发生的变更任务上执行多任务,也会遇到麻烦。
所以,总结一下:不要锁定文件,而是拥有良好的版本控制系统,勇敢地利用分支,并在合并分支更改时保持警惕。
There are multiple schools of thought regarding the use of version control systems.
My preference is to try to keep each upcoming feature worked in a separate feature branch (pretty much no matter how small). The person(s) assigned for this feature then only have their own changes to work on; no interference comes from the other developers.
Bug fixes (aside from truly trivial ones) also go first in as separate branches, just to keep the trunk line stable and clean. Latest trunk revision always corresponds to the last delivered version (release) of the product.
When a new release is being prepared, if there is only a single change coming, and that change itself is based on the previously delivered version, then the tests can be run against the branch version, and at time of new release, changes from the branch are simply integrated into the trunk version. Version control systems such as cvs and svn have decent support for this kinds of merge operations (I haven't been working with git myself, but understand that branches and merges are handled well there as well).
If there are several distinct changes to be integrated, I prefer to create a separate "integration" branch, to which I first collect one by one all the changes to be integrated. Again, the version control systems do flag when there are conflicting edits (i.e. two different changes in one place of a single code file). What they understandably cannot tell is if there are functional conflicts caused by several distinct changes. So at least some oversight, and prefrably also testing, will be needed after each integration.
Then, when all the individual changes have been integrated to the integration branch, it can be thoroughly tested, and again merged to the trunk when it is ready for release. If there are further corrections to be made, they can be developed further in the original feature branches, and then the corrections integrated agani to the integration branch.
This way lends itself very well to fast bug correction response, as the trunk always contains the last release. It also lends itself nicely to speculative development, as the distinct feature branches only affect the trunk line when integrated. Also, features can be worked over several release cycles, as releases do not affect the ongoing development in feature branches. This way the "bus factor" (what happens if one of the developers is run over by a bus) is also reduced; incomplete and even incompilable code can be checked in in the feature branches -- and all work done is available for other developers if for any reason someone is missing from work. Also, workstation disasters do not cause a significant worry, as would be if the workstation could easily hold one weeks worth of development work not checked in, not backed up.
Whether to update the long-lived feature branches always to latest releases as new releaases are made is a question of policy, and also may depend on what went in in the last release. Another question of policy is the ownership of the integration branch; whether there's some single person responsible for collecting all the feature branch changes and making the needed smal changes to make them fit with the other changes, or whether each feature developer/team will be responsible for getting the changes from that specific feature branch to the integration branch. I favor the separate "release builder" (who of course typically is one of the feature developers).
At least in my reality it seems that 3-4 devs can pretty well work in a single branch, if they otherwise communicate with each other (shared office space is the preferred way). They do organise their work themselves, and can avoid stepping on each others' toes. Also, the separate feature branches seem to rather seldom touch the same files with each other, so most of the merge cycles are rather painless (and the painful ones can be predicted by the change descriptions). On the other hand, even a single developer multi-taskng over several distinct but simultaneous change tasks will end up in trouble, if the changes are not isolated in branches.
So, in a summary: do not lock files, but instead have a good version control system, utilize branches bravely, and keep your eyes open when merging changes from branches.