查看一个文件上两个变更集之间的差异
我在 Mercurial 中跟踪了一个文件。我可以通过 hg log
查看它的历史记录。如何查看最新版本和上次签入的变更集之间的差异?
I have a file tracked in Mercurial. I can see its history with hg log
. How can I see the diffs between its most recent version, and the last checked-in changeset?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
hg diff -r:filename
可以做到这一点,
例如
hg diff -r 0:1 default.aspx
希望它有帮助
hg diff -r <first_revision_number>:<other_revision_number> filename
that will do it
e.g
hg diff -r 0:1 default.aspx
hope it helps
如果您知道修订号,那么 PaulStack 所说的是正确的。
如果您明确想知道分支的当前尖端与上一个尖端之间的差异,则可以使用快捷方式。当然,如果文件没有更改,差异将不会显示任何有用的内容。
hg diff -r -1:. filename
-1
表示此分支上的先前变更集。 '.
' 表示当前变更集。您可以使用-2
、-3
等,但是一旦到达合并点,它就会变得更有趣。 (参考:http://hgtip.com/tips /beginner/2009-10-05-shortcuts-for-specifying-revisions/)如果您想要的是工作区中的突出更改,那么它只是 hg diff 文件名。
对于 HG 新手来说,一些有用的地方是 http://hgtip.com。
HG 权威指南位于 http://hgbook.red-bean.com/。
Kiln 支持网站是一个类似 stackoverflow 的网站,它更针对 HG。 http://kiln.stackexchange.com。 Kiln 建立在 HG 之上,并使用修改后的 TortoiseHG 客户端,因此大多数问题和答案都内容丰富。即使您不是用户,他们也会回答问题。
If you know the revision numbers, then what PaulStack said is correct.
If you explicitly want to know the difference between the current tip of the branch, and it's previous, you can use shortcuts. Of course, if the file hasn't changed, the diff won't show anything useful.
hg diff -r -1:. filename
The
-1
says previous changeset on this branch. the '.
' means the current changeset. You can use-2
,-3
etc, but once you hit a merge point, it gets a little more interesting. (reference: http://hgtip.com/tips/beginner/2009-10-05-shortcuts-for-specifying-revisions/)If what you want is the outstanding changes in your workspace, then it's merely hg diff filename.
A few useful places for HG newbies is http://hgtip.com.
The HG definitive guide at http://hgbook.red-bean.com/.
A stackoverflow like site that's more HG specific is the Kiln support site. http://kiln.stackexchange.com. Kiln is built on top of HG, and uses a modified TortoiseHG client, so most of the questions and answers there are informative. They will also answer questions even if you aren't a user.
父修订版还有 de
^
语法,除了.
(工作目录的父目录)之外,它还构成了一个有用的组合:显示当前签出的差异修订版及其父修订版(这适用于
tip
和-1
限制)there is also de
^
syntax for the parent revision, which in addition to.
(the parent of the working directory) make a useful combination:show the diff between current checked out revision and its parent revision (this works around
tip
and-1
limitations)