使用 Mercurial (hg) 来跟踪更改并自动同步?
首先,我一直盯着一页又一页的解决方案,但似乎没有一个适合我的情况。
我在全国各地都有使用 Windows 工作站和 Eclipse 的 Web 开发人员。我们认为 DVCS 最适合我们,因为集中式系统无法正常工作(Serena:缓慢的网络连接需要很长时间才能签入......他们不这样做,因为它不是“精简的”,等等)
我们使用 Eclipse 来在不同状态下编辑和修改开发服务器上的文件。 (大多数 DVCS 场景假设您在工作站上设置了 Web 服务器或正在进行二进制可执行开发。)
我想尝试的是为开发人员更改和“功能发挥”提供一个本地存储库,但自动保持开发存储库正常运行迄今为止。我想过使用 Mercurial 钩子来自动拉/更新/合并/推送,但这需要开发人员每次想要测试更改时都进行提交。 (为了触发将文件上传到开发服务器的钩子。)最好在文件保存时自动发生这种情况,因为培训人们使用版本控制已经是一个问题(主要是因为目前的 PITA 速度很慢) WAN 和虚拟位置不是一个选项。)
我的猜测是,我必须设置 Unison 或其他东西来保持开发人员的存储库同步到开发服务器,就好像它是本地副本一样。当然会与其他开发人员同步。我试图找出是否有人有一个简化/简单的解决方案,可以让所有开发人员保持最新状态,同时允许他们随意(轻松)进行版本控制。
First off, I've been staring at page after page of solutions but none of them seem to fit the situation I have.
I have web developers all around the country using Windows workstations with Eclipse. We decided DVCS was best for us because the centralized system just isn't working (Serena: slow network connections takes forever to check in... they don't do it because it's not "streamlined", etc.)
We use Eclipse to edit and modify files on a development server in a different state. (Most DVCS scenarios assume you have a web server setup on your workstation or are doing binary executable development.)
What I'd like to try is to have a local repository for developer changes and "feature play" but automatically keep the development repository up to date. I thought of using Mercurial hooks to automatically pull/update/merge/push but that requires the developer to commit every time they want to test a change. (in order to fire the hook to upload their file to the development server.) It would be ideal to have this automatically happen on file saves because it's already an issue with training people to use version control (mainly because it's PITA slow currently with the WAN and virtual locations. Getting the WAN upgraded is not an option.)
My guess is that I'm going to have to setup Unison or something to keep the developer's repository synced to the development server as if it were a local copy and that of course would sync with the other developers. I was trying to find out if anyone had a solution that's streamlined/simple for keeping all developers up to date while allowing them to version control at will (easily.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这就是分支的用途。有一个名为“不稳定”的分支,并使用一个存储库设置您的开发服务器,该存储库在提交/合并时自动更新到仅该分支(通过钩子)。个人开发人员可以自由地在功能分支上工作并在本地提交。当某些内容准备好共享时,开发人员会将其更改合并到“不稳定”分支中,并将该分支推送到开发服务器/存储库。
我以这种方式管理我的部署。我的 Web 服务器虚拟主机 Web 根目录指向 Mercurial 存储库/工作副本。当某些内容准备好发布时,我将其合并到“稳定”分支并将“稳定”推送到服务器。存储库挂钩使用新更改更新虚拟主机上的文件。
我只这样做了一个月左右,但效果非常好。
另外,+1 查看 Hudson/Jenkins。您正在寻找的就是所谓的“持续集成”(CI),Hudson 和 Jenkins 可以实现这一点。
如果您不能在所有工作站上都有开发服务器,那么也许可以使用测试驱动开发以及适合您的语言的某种单元测试框架 - 其中大多数不需要完整的服务器实现就能够编写和测试你的代码。这需要改变范式,但你肯定会从中获得更好的代码质量。
This is what branches are for. Have a branch called "unstable" and set your development server up with a repository that auto-updates on commits/merges to only that branch (via hook). Individual developers are free to work on feature branches and commit locally. When something is ready to be shared, the developer merges their changes into the "unstable" branch and pushes that branch to the development server/repository.
I manage my deployments this way. My Web server virtual host web root points to a Mercurial repository/working copy. When something is ready to go out, I merge it into the "stable" branch and push "stable" to the server. The repository hook updates the files on the virtual host with the new changes.
I've only been doing this for a month or so but it's been working like a charm.
Also, +1 on checking out Hudson/Jenkins. What you're looking for is called "continuous integration" (CI) and Hudson and Jenkins make that happen.
If you can't have a development server on all workstations, then maybe using Test Driven Development with some sort of Unit Test framework for your language would work - most of those don't require a full server implementation to be able to write and test your code. It would require a change in paradigm but you'd sure get better quality of code out of that.
我们对 Mercurial 非常满意,但我们必须改变我们的习惯……这花了一些时间
每个开发人员现在在本地都有一个测试平台。提交是通过分支进行的,在本地验证测试之前不会推送任何内容。
然后,Hudson 是我们的朋友。为了集成团队工作,每次提交都会生成一个测试应用程序完整性的构建。红色表示回滚并返回给开发人员。绿色很酷
开发人员在这里提交“健全的”代码并由团队集成到中央存储库。他们必须决定何时该推动。没有任何同步任务可以使他们摆脱这种负担。当我看到所有可能发生的错误时,即使每个推送选择都是由人类自觉做出的,我也无法想象每个文件上是否会自动发生更改,
以保存 Mercurial 的良好体验...
We're very happy with mercurial, but we had to change our habits... and it took some time
Each dev has now a test platform locally. Commits are made through branches and nothing is pushed before tests have been validated locally
Then, Hudson is our friend. To integrate teams works, each commit results in a build that tests the integrity of the app. Red signify rollback and return to the dev. Green is cool
Devs are here to commit 'sane' code and integrate by team to the central repo. They must decide when it's the time to push. No synchronized task can deliver them from this burden. When I see all the errors that can happen, even if each push choice is made consciensciouly by a human, I can't imagine if changes happened automatically on each file save
Good experience with Mercurial...
您说您希望拥有一个用于开发人员更改的本地存储库,但会自动将任何更改推送到服务器。如果您无法拥有本地开发环境来测试更改,那么拥有本地开发分支有什么意义呢?如果您的测试必须在开发服务器上完成,那么我无法想到允许在本地存储库中进行“功能播放”,同时在开发服务器上保持任何类型的健全性。
在这种情况下,您最好的选择可能是在开发服务器上进行分支,并让服务器签出不同的分支来测试不同的功能(hg update -C feature-blah)。服务器存储库的默认状态应该是主“devel”分支的签出(hg update -C devel),并且当任何功能或错误修复分支被验证为工作时,它们将合并回“devel”并更新服务器的存储库从那。
编辑以澄清:您的开发人员可以从“开发”或从功能分支签出到本地计算机。然后,他们将进行任何编辑并将其推送回服务器,然后将服务器的活动分支切换到新更新的代码。
另外,我从您的其他评论中假设只有一台开发服务器,并且它一次只能运行一个版本的代码。如果不是这样的话,我的回答就毫无意义了。
You say that you want to have a local repository for developer changes, but automatically push any changes to the server. If you cannot have a local dev environment to test changes on, what is the point of having local development branches? If your testing must be done on the development server, there is no way I can think of to allow for "feature play" in local repositories while maintaining any kind of sanity on your development server.
Your best bet in this scenario would probably be branching on the development server and having the server checkout different branches to test different features (hg update -C feature-blah). The default state for the server's repository should be a checkout of the main "devel" branch (hg update -C devel), and when any features or bugfix branches are verified as working they are merged back into "devel" and the server's repository updated from that.
Edit to clarify: your developers would either checkout from "devel" or from a feature branch to their local machine. They would then make any edits and push it back up to the server, and then switch the server's active branch to the newly-updated code.
Also, I am assuming from your other comments that there is only one dev server and it is only able to run one version of the code at a time. If this is not the case, my answer makes no sense at all.