当我执行 hg pull 和 hg update 时,哪些文件将被更改和添加
因此,在 Subversion 中,当我执行 svn up
时,我会得到已添加、修改、删除和冲突的文件列表。
当我执行 hg pull
然后 hg up -v
时,它只显示一个列表:getting file.ext
但我无法知道如果该文件是新的或已经存在。有没有办法让 Mercurial 显示有关文件是否被添加、修改或删除的相同类型的元数据?
Mercurial 是否能够满足我的要求?
So in Subversion when I do an svn up
I get a list of files that were added, modified, deleted, and conflicted.
When I do an hg pull
then hg up -v
it just displays a list of: getting file.ext
but I have no way of know if that file is new or already existed. Is there a way to have Mercurial display the same sort of meta about if the file was added, modified, or deleted?
Does Mercurial offer any ability to do what I am asking?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Omni 有你的答案,我投票支持它,但只是为了显示所有选项:
在拉取 hg传入之前
hg传入 --patch # 显示拉取(但不更新)后
Omni has your answer, and I voted for it, but just to show all the options:
Before pulling
After pulling (but not updating):
使用 status 命令列出工作副本与其父修订版之间或任意两个修订版之间之间的文件状态更改。它为您提供如下输出:
对应于此更新:
编辑: 您可以创建一个
preupdate
挂钩,以始终将此信息作为更新的一部分获取。我现在碰巧在 Windows 上,这个钩子在这里起作用:在类 Unix 系统上用
$HG_PARENT1
替换%HG_PARENT1%
。这应该会让 Mercurial 体验更像 Subversion :-)Use the status command to list changes in file status between the working copy and its parent revision or between any two revisions. It gives you output like this:
which corresponds to this update:
Edit: You can create a
preupdate
hook to always get this information as part of your updates. I happen to be on Windows right now, and here this hook works:Replace
%HG_PARENT1%
with$HG_PARENT1
on Unix-like systems. This should make the Mercurial experience even more Subversion-like :-)hg传入--stat
命令执行类似于您所要求的操作。另外,如果您要更新到新版本,您可以执行hg diff --git -r
,它会给您一个差异,显示哪些文件是新的。The
hg incoming --stat
command does something like what you're asking. Also, if you're updating to a new revision, you can dohg diff --git -r <rev>
and it will give you a diff that shows which files are new.您可以将
hgcoming
与捆绑包一起使用,将 Martin 的答案应用于您尚未实际提取的更改。You can use
hg incoming
with bundles, to apply Martin's answer to changes you haven't actually pulled yet.