Mercurial 中各种文件的特定提交消息
在我的 Mercurial 存储库中,我修改了 4 个文件,
当我进行提交时,提交消息应用于我修改的所有文件,但是,有任何形式可以为我在提交屏幕中修改的每个文件编写特定的提交消息吗? ?
In My Mercurial Repository, I have 4 files I modified,
When I make a Commit, The commit message applied to all Files I modified, but, there are any form to write a specific commit message for every file I modified in the commit screen??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
理想情况下,每个变更集都应该包含一些特定的更改,无论是小到通过更正文件中的一行来修复小错误,还是大到更改整个代码库中函数的签名。
这允许您稍后执行诸如将变更集移植到不同分支之类的操作,只有当您的变更集没有被不相关的内容污染时,这才容易。
,这是现代 DVCS(例如 Mercurial 或 Git)与旧系统(例如跟踪修订版本的 SVN)之间的主要区别。现代 DVCS 跟踪更改。)
(顺便说一句 就像您需要为每个文件编写单独的注释一样,这可能意味着您实际上一次提交了几个不相关的更改,这不是一个好的做法。
另一方面,如果不是这种情况,你当然可以编写多行消息:
Ideally, every changeset should contain some specific change, be it something as small as fixing a small bug by correcting a single line in a file, or something as big as changing the signature of a function all over the codebase.
This allows you to do things like transplanting a changeset to a different branch later, which is only easy when your changesets are not polluted by unrelated stuff.
(By the way, this is the main difference between modern DVCS like Mercurial or Git, which track changes, and older systems like SVN, which track revisions.)
If you feel like you need to write separate comments for every file, this might mean you're actually committing several unrelated changes at once, which isn't good practice.
On the other hand, if it's not the case, you can of course write a multi-line message:
如果您使用命令行,您可以通过在
hg commit
命令行上传递单个文件来提交对它们的更改:您可以使用 TortoiseHg 执行相同的操作,只需“检查”您想要检查的文件在
thg commit
窗口中 - 或者更准确地说,通过取消选中那些您不想提交的内容。但请注意,这将创建多个变更集,每个变更集对应一个提交。如果这不是你想要的,那么我会同意 Helgi 的观点。
在 TortoiseHg 的早期版本中(当它是使用 tk 编写时,所以不是很久以前),实际上可以选择文件更改的单个“块”并单独提交它们。然而,当前版本中尚不提供此功能,而且据我所知,暂时还没有计划。
If you are using the command line, you can commit changes to individual files by passing them on the
hg commit
command line:You can do the same thing using TortoiseHg by only "checking" the files you want checked in in the
thg commit
window - or more precisely, by unchecking those you don't want committed.Note however that this will create several changesets, one for each commit. If this is not what you want, then I would agree with Helgi.
In a previous version of TortoiseHg (back when it was written using tk, so not that long ago), it was actually possible to select individual "chunks" of changes to a file and commit them separately. However this is not available in the current version, and as far as I am aware is not planned for a while.
实际上,提交消息适用于变更集,其中包含对您修改的文件的更改。
如果您想解决对每个文件的更改,您可以创建多行消息:
但是,我不建议为每个文件执行更改集,尽管这是可能的。
Actually, the commit message applies to the changeset, which contains changes to the files you modified.
You could make multi-line messages if you want to address the changes to each file:
I don't recommend doing a changeset for each file, however, even though that is possible.