[英]What files will be changed vs added when I do an hg pull and hg update
所以在Subversion中,当我执行svn up
我得到一个添加,修改,删除和冲突的文件列表。
当我做一个hg pull
然后hg up -v
它只显示一个列表: getting file.ext
但我无法知道该文件是新的还是已经存在。 有没有办法让Mercurial显示关于文件是否被添加,修改或删除的相同类型的元?
Mercurial是否提供任何能力来做我要求的事情?
Omni有你的答案,我投了赞成票,但只是为了展示所有的选择:
拉之前
拉(但不更新)后:
使用status命令列出工作副本与其父版本之间或任何两个版本之间的文件状态更改。 它为您提供如下输出:
$ hg status --rev .:tip
M hgext/keyword.py
M mercurial/cmdutil.py
M mercurial/commands.py
M mercurial/context.py
M mercurial/patch.py
A tests/test-encoding-align
A tests/test-encoding-align.out
对应于此更新:
$ hg update -v
resolving manifests
getting hgext/keyword.py
getting mercurial/cmdutil.py
getting mercurial/commands.py
getting mercurial/context.py
getting mercurial/patch.py
getting tests/test-encoding-align
getting tests/test-encoding-align.out
7 files updated, 0 files merged, 0 files removed, 0 files unresolved
编辑:您可以创建一个preupdate
挂钩,以便始终将此信息作为更新的一部分。 我现在碰巧在Windows上,这个钩子工作:
[hooks]
preupdate = hg status --rev .:%HG_PARENT1%
更换%HG_PARENT1%
与$HG_PARENT1
在类Unix系统。 这应该让Mercurial体验更像Subversion :-)
hg incoming --stat
命令就像你要问的那样。 此外,如果您要更新到新版本,则可以执行hg diff --git -r <rev>
,它将为您提供显示哪些文件是新文件的差异。
您可以使用hg incoming
捆绑包,将Martin的答案应用于您尚未实际提取的更改。
> cd myrepo
# Get the latest revision in my copy
> hg tip
changeset: 17:5005ce2dc418
.
.
.
# Get a bundle file of changes, but don't put them in myrepo yet
> hg incoming --bundle changes.bundle
# Overlay the bundle on myrepo and do hg status as if I've already pulled
> hg -R changes.bundle status --rev 17:tip
A addedfile
M modifiedfile
.
.
.
# Changes are good! Pull from bundle
hg pull changes.bundle
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.