将 Mercurial 与分支结合使用 - 发布到仅可通过 FTP 访问的 Web 服务器
我们是一个开发 Web 应用程序的小团队,该应用程序使用只能通过 FTP 访问的 Web 服务器发布。
我们的工作流程如下:
- 开发人员正在本地开发一些请求的功能
- 完成后,将其提交并推送到“中央”存储库
- 一天几次,其中一位开发人员发布< /em> 已更改为测试网站的文件,让关键用户了解功能是如何实现的。
- 每周一次,我们部署到生产站点。
由于我们的 Web 服务器不支持 SSH,我们无法在服务器上推送变更集和更新,因此我们创建了一个自定义脚本,通过 FTP 传输更改的文件。
每次我们使用该脚本时,都会创建一个新标签,因此我们知道 - 使用 hg diff - 标签 之间的差异(我们的一个版本)。
直到现在,一切都很好,我们在工作流程中引入了分支,让开发人员可以对代码进行彻底的更改,并继续为发布到生产环境的日常小更改做出贡献。
问题是 hg diff 不支持分支 (或者似乎仍在开发中)
那么,哪一个是最好的方法呢?我们一直在考虑的一些选项是:
- 将 FTP 安装为本地卷(使用 MacFuse 或类似的)并使用 Mercurial 推送/更新 但会很慢。
- 尝试一下 Bundles ,看看它们是否可以帮助我们,但看起来相当复杂
示例
$ hg tag qa-001 /* init to see diferences QA Site */
$ hg tag prod-001 /* init to see diferences Production Site */
$ hg ci -m "working on a stable feature"
$ hg tag qa-002
$ hg ci -m "change on the stable feature"
$ hg tag qa-003
$ hg tag prod-002
$ hg ci -m "another change on stable"
$ hg pull ../CentralRepo /*Where there is another Branch with unstable files*/
通过最后一次操作,创建了一个新头,所以现在有两个头(稳定和不稳定分支)
$hg diff -r qa-003 -r tip
hg diff 在没有进行合并的情况下显示不稳定文件
非常感谢您的评论
We are a small team of developers working with a Web Application which is published using a Web Server that is only accessible throught FTP.
Our workflow is the following one:
- A developer is working out some requested feature locally
- When its done, commits it and Pushes to a 'central' repository
- Few times a day, one of developers publishes the files that have been changed to a testing WebSite, to let key users see how does features have been implemented.
- Once in a week, we deploy to our production site
As our Webserver doesnt support SSH, we can't push changesets and update on the server, so we created a custom script which Transfers the changed files throught FTP.
Each time we use that script a new tag is created, so we know -using hg diff- the diference between tags (a release for us).
It was all fine until now, that we introduced branches in our workflow, to let a developer work on a radical changes in the code, and keep contributing in daily small changes which are published to production.
The problem is that hg diff doesnt support Branches (or seems that its still in development)
So, which would be the best way to do it ? some options we have been thinking about are:
- Mounting FTP as a Volume localy (using MacFuse or similar) and use mercurial push/update But would be so sloooow.
- Play around with Bundles and see if they can help us but seems quite complicated
Example
$ hg tag qa-001 /* init to see diferences QA Site */
$ hg tag prod-001 /* init to see diferences Production Site */
$ hg ci -m "working on a stable feature"
$ hg tag qa-002
$ hg ci -m "change on the stable feature"
$ hg tag qa-003
$ hg tag prod-002
$ hg ci -m "another change on stable"
$ hg pull ../CentralRepo /*Where there is another Branch with unstable files*/
With last operation, a new head is created , so now there are two heads (stable, and unstable branch)
$hg diff -r qa-003 -r tip
The Result of hg diff is showing up the Unstable Files without doing the merge
Many Thanks for your comments
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的示例中,您正在创建 标签,而不是(命名)分支机构。标签不会帮助您创建单独的开发线:它们只是分配有特定修订的独立标识符。
创建分支
要开始使用分支,您可能需要查看一些教程,例如:
根据您的描述,您可能希望根据当前的
default
分支以及任何功能/主题分支创建prod
和qa
分支你可能想要激进的变化。一旦您拥有这些分支,就可以很容易地比较它们、在它们之间进行合并、查看从一个分支到另一个分支有哪些待处理的更改,等等,以满足您的工作流程的要求。
捆绑包
如果您只有 FTP 访问权限,那么捆绑包可能无法帮助您。您可以通过 FTP 将捆绑包上传到服务器,但您需要能够在服务器上运行
hg
才能将捆绑包解压到存储库中。In your example, you are creating tags, not (named) branches. Tags won't help you to create separate lines of development: they are just stand-alone identifiers assigned with particular revisions.
Creating branches
To start using branches, you probably want to review some tutorials, such as:
Based on your description, you probably want to create
prod
andqa
branches based on your currentdefault
branch, as well as any feature / topic branches you might want for radical changes.Once you have these branches in place, it's very easy to compare them, merge between them, see what changes are pending from one to the other, and so on as your workflow demands.
Bundles
If you only have FTP access, then bundles probably won't help you. You could upload a bundle to the server via FTP, but you would need to be able to run
hg
on the server to unpack the bundle into a repository.