如何创建在 Mercurial 中使用的模板入门项目?
我正在研究使用 Mercurial 作为我们公司的源代码控制系统。一个直接的要求是能够拥有一个模板项目,其中内置有许多我们重用的代码,并让其他开发人员将其用作他们项目的起点。
例如,我在我们公司做了很多asp.net mvc 2开发。我创建了几个 html 帮助器、扩展类、pdf 创建和日志记录实用程序。我犹豫是否将它们移至自己的项目中并引用该 dll,因为每个项目的需求都如此不同。我宁愿有一种基本的模板项目,其中包含所有这些东西。当同事去创建一个新项目时,我希望他们能够下载此代码,但我不希望他们更改模板(尽管我希望能够对模板进行更改) ...我只是不希望他们在这种情况下这样做)。
我该怎么做呢?
如果问题很混乱,我深表歉意。我是水银新手。我已经观看了 http://tekpub.com/codeplex 视频,并且即将查看 Joel 的http://hginit.com/index.html 教程,但我想把这个用例放在那里看看这样的事情是如何完成的。
I'm researching using Mercurial for our companies source control system. One immediate requirement that is the ability to have a template project that has a lot of code we reuse built into it and let other developers use that as a starting point for their projects.
For example, I do a lot of asp.net mvc 2 development in our company. I've created several html helpers, extension classes, pdf creation, and logging utilities. I hesitate to move these into their own project and reference that dll as each projects needs are so different. I would rather like to have a sort of basic template project with all of these things in them. When a co-worker goes to create a new project, I'd like them to be able to pull down this code, but I don't want them changing the template (though I would want to be able to make changes to the template...I just wouldn't want them doing it in this case).
How would I go about doing this?
I apologize if the question is jumbled. I'm new to mercurial. I've been through the http://tekpub.com/codeplex video and am about to look over Joel's http://hginit.com/index.html tutorial, but I wanted to put this use case out there to see how something like this might be accomplished.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种解决方案是拥有一个包含模板代码的公共只读存储库。
当开发人员开始一个新项目时,他们只需克隆模板存储库并开始工作。
由于模板是只读的,因此他们无法推送会影响模板的更改。理想情况下,他们应该更改
.hg/hgrc
中的默认拉取 URL,以指向特定于该项目的新位置。One solution would be to have a public, read-only repository with your template code.
When developers start a new project, they simply clone the template repository and begin to work.
Since the template is read-only, they cannot push changes that would affect the template. Ideally, they should change the default pull URL in
.hg/hgrc
to point to a new location specific to that project.