拉入 Mercurial 之前自动搁置(使用 TortoiseHG)?
我有一些更改的文件我不想提交(例如 web.config)。在拉取并更新到新的变更集之前,我必须将它们搁置起来。拉完后更新,我必须取消搁置它们。
我目前正在使用 TortoiseHG。有没有任何扩展可以自动执行此操作?
I have some changed files I don't want to commit (e.g. web.config). Before I pull and update to new changesets, I have to shelve them. After the pull & update, I have to unshelve them.
I'm currently using TortoiseHG. Is there any extension which can do this automatically?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我建议其他一些东西:您可以使用两个不同的配置文件,而不是总是搁置和取消搁置:一个是存储库的一部分,包含虚拟/示例数据,另一个是每个用户在本地实际使用的,它被忽略善变的。
查看这个答案以获取更详细的解释我的意思。
我给出的示例是针对 Visual Studio 的,我从您的其他问题和答案中看到您显然正在使用 .net 和 Visual Studio,因此您可以完全按照编写的方式使用我的示例。
I'd suggest something else: instead of always shelving and unshelving, you could use two different config files: one which is part of the repository and contains dummy/example data, and another one which each user really uses locally, which is ignored by Mercurial.
Check out this answer for a more detailed explanation what I mean.
The example I'm giving there is for Visual Studio, and I see from your other questions and answers that you're apparently using .net and Visual Studio, so you can just use my example exactly as written.
在 Mercurial 中,只需
hg pull -u
。未提交的更改将与提示合并。结果与搁置、拉取/更新、取消搁置相同。使用 TortoiseHg 会出现一个对话框,提示丢弃/搁置/合并。您可能会以这种方式得到一个合并对话框,但对于搁置方法来说也是如此,因为取消搁置也可能必须合并。如果没有冲突,您将不会在命令行中收到提示。如果没有冲突,TortoiseHg 可能有一个选项来抑制对话框,但我没有检查过。
In Mercurial, just
hg pull -u
. Uncommitted changes are merged with the tip. Same result as shelve, pull/update, unshelve. With TortoiseHg a dialog will come up prompting for discard/shelve/merge.You may get a merge dialog this way but that would be true with the shelving approach because unshelve may have to merge as well. From the command line you won't get a prompt if there are no conflicts. TortoiseHg may have an option to suppress the dialog if there are no conflicts, but I haven't checked.
我会用这个尝试一些不同的事情。
特别是对于 Web.config 文件,您可能希望考虑使用本地配置文件进行覆盖,而不是保留本地更改未提交。 (例如引用 .hgignore 中的单独文件)。我过去从事的项目这样做是为了将测试/产品配置与开发设置分开,反之亦然。
我认为没有任何扩展可以为您执行此操作,但您最好编写一个快速批处理或 powershell 脚本来为您执行此工作流程。在以前的项目中,我有一个脚本可以做类似的事情,因为它会执行拉/更新/变基以将我的更改保留在提示中(我正在使用 hg 针对 SVN 服务器,这使得这一点很重要。)
我知道我没有直接回答你的问题,但我希望这对你有帮助!
I would try a few different things with this.
Regarding the Web.config file in particular, you might want to look at using local configuration files for overrides instead of leaving local changes uncommitted. (e.g. referencing an separate file that is in .hgignore). Projects I've worked on in the past did this to separate test/prod configurations from the settings for development, or vice-versa.
I don't think there is any extension which will do this for you, but you might be better off writing a quick batch or powershell script to do this workflow for you. On previous projects, I had a script which would do something similar in that it would do a pull/update/rebase to keep my changes at the tip (I was working with hg against an SVN server which made that important.)
I know I didn't answer your question directly, but I hope this helps!
直接回答: https://pypi.org/project/hg-autoshelve/
但是正如建议的那样,专用的配置文件存储库似乎是一个更好的主意
克里斯蒂安·斯佩希特那里
Direct answer: https://pypi.org/project/hg-autoshelve/
But a dedicated repository for configuration files seems a better idea as suggested by
Christian Specht there