Mercurial 和代码审查;良好的工作流程?
我在一个小型分布式团队中,使用 Mercurial 作为中央存储库。我们每个人都通过 ssh 将其克隆到我们自己的 Linux 机器上。我们的目的是在将更改推送到中央存储库之前审查彼此的工作,以帮助保持中央存储库的干净。在不同 Linux 机器上的开发人员之间共享代码的好方法是什么?我是 Mercurial 的新手。我能想到的选项(通过阅读,而不是经验)是:
1:作者提交所有本地更改并使用中央提示更新工作克隆。如果有办法指定捆绑包中包含哪些本地转速,作者会使用 hg 捆绑包。 (一项实验表明,“捆绑”仅获取未提交的更改,即使中央不知道以前的本地提交)作者将捆绑文件发送给审阅者。审阅者从中心的尖端创建一个新的干净克隆,并将包导入到该克隆中。 或者,
2:作者和审阅者都从中心的提示中获取后,作者使用补丁,审阅者导入补丁。 或者,
3:作者推送到审阅者或审阅者从作者处拉取(但是,到底是如何?我读到的只是关于向/从原始服务存储库推送和拉取,和/或在同一个盒子上而不是在不同的 Linux 盒子之间推送和拉取。 )
4:忘记在推送到中央之前检查代码;继续推进,使用标签来识别哪些内容已被审查或未审查,并使用 Hudson(已经在工作)来标记最新的安全构建,以便团队成员可以知道从哪一个中提取。
如果您的团队使用 Mercurial 并进行代码审查,您如何让审查者看到您的更改?
I'm in a small distributed team using Mercurial for a central repository. We each clone it via ssh onto our own linux boxes. Our intent is to review each others' work before pushing changes up to the central repository, to help keep central's tip clean. What is a good way to share code between developers on different linux boxes? I'm new to Mercurial. The options I can think of (through reading, not experience) are:
1: Author commits all local changes and updates working clone with central's tip. Author uses hg bundle, if there's a way to specify which local revs to include in the bundle. (an experiment showed me "bundle" only grabs uncommited changes, even if there are previous local commits that central doesn't know about) Author gets bundle file to reviewer. Reviewer creates a new clean clone from central's tip, and imports the bundle into that clone.
or,
2: After both author and reviewer fetch from central's tip, author uses patch and reviewer imports the patch.
or,
3: Author pushes to reviewer or reviewer pulls from author (but how, exactly? What I read is only about pushing and pulling to/from the original served repository, and/or on the same box instead of between different linux boxes.)
4: Forget reviewing the code prior to pushing to central; go ahead and push, using tags to identify what's been reviewed or not, and use Hudson (already working) to tag the latest safe build so team members can know which one to pull from.
If your team uses Mercurial and does code reviews, how do you do get the reviewer to see your changes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
其中大多数都是可能的,但有些比其他更乏味。
--base
来使用捆绑包:hg bundle --base 4a3b2c1d review.bundle
hgserve
,您就可以拉取。在您提供的选项中,#1 和#3 可能是最简单的,仅取决于你们是否可以到达对方的盒子。
相关说明:这个问题促使我和我的同事开始开发 Kiln,我们的(Fog Creek 的)Mercurial 托管和代码审查工具。我们的计划和最初的原型将保留多个存储库,一个“中央”存储库和一堆“审查”存储库。审查过程首先将中央存储库克隆到服务器上的审查存储库中,然后在两者之间运行完整的存储库差异,并使用一个简单的 Web 界面来获取和查看差异。
我们已经对该工作流程进行了相当大的改进,但总体思路仍然是相同的,即有一个分支存储库来推送未经审核的更改,并有一个界面在将它们推送到中央存储库之前对其进行审核。我不想在这里做广告,但我确实建议给予尝试一下。
Most of these are possible, some are more tedious than others.
--base
:hg bundle --base 4a3b2c1d review.bundle
hg serve
on their machine, and you will be able to pull.Of the options you presented, #1 and #3 are probably easiest, just depending on whether or not you can reach each other's boxes.
On a related note: This is the question that got my colleague and I started on developing Kiln, our (Fog Creek's) Mercurial hosting and code review tool. Our plan, and the initial prototype, would keep multiple repositories around, one "central" repository, and a bunch of "review" repositories. The review process would be started by cloning the central repo into a review repo on the server, and then running a full repo diff between the two, with a simple web interface for getting and viewing the diffs.
We've evolved that workflow quite a bit, but the general idea, having a branch repo to push unreviewed changes to and an interface to review them before you push them into the central repo, is still the same. I don't want to advertise here, but I do recommend giving it a try.
这个问题的一半答案是使用 ReviewBoard 和 Mercurial 扩展。它允许通过发出以下命令来推送某些修订以供审查
Half answer to this question is using ReviewBoard with Mercurial extention. It allows to push certain revisions for review by issuing the following command
我将添加第五个选项 - 在命名分支上进行所有开发工作,最好每个任务一个。允许将任何内容提交给名为“开发”的分支,无论它是否处于工作状态。
推送到中央存储库,让审阅者拉取分支。对分支机构进行审核。
当审核通过后,将开发工作合并到适当的功能分支中。
这个工作流程(对我而言)出人意料地不受欢迎,但它具有许多优点:
所有工作都已提交 - 您不必在提交之前等待审核完成。
您不会构建错误的版本。您只能从功能分支进行构建。
正在进行的工作不会干扰其他开发人员。
从开发分支,您可以查看最新的更改(例如,处理审核意见的更改集),与分支点进行比较,或者与最新的功能分支进行比较 - 所有这些都可以提供有用的信息。
I'll add a 5th option - do all development work on named branches, preferably one per task. Allow anything to be committed to a "development" named branch, whether it's in working state or not.
Push to the central repository, have reviewer pull the branch. Perform the review on the branch.
When the review has passed, merge the development work into the appropriate feature branch.
This workflow, which is (to me) surprisingly unpopular, has many advantages:
All work gets committed - you do not have to wait for a review to be done before committing.
You will not build off the wrong version. You only ever build from the feature branch.
In-progress work does not interfere with other developers.
From the development branch, you can either look at the latest changes (e.g. the changesets addressing review comments), compare with the branch point, or compare with the latest feature branch - all of which can give useful information.