繁体   English   中英

当我执行hg pull和hg更新时,将添加哪些文件与添加

[英]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有你的答案,我投了赞成票,但只是为了展示所有的选择:

拉之前

  • hg incoming#显示你将获得的变更集
  • hg incoming --verbose#显示您将获得的更改集,包括每个的文件列表
  • hg incoming --patch#显示你将获得的所有变更集的完整差异

拉(但不更新)后:

  • hg log -r .: tip#显示你得到的变更集
  • hg log --verbose -r .: tip#显示你得到的变更集,包括每个变量集的文件列表
  • hg log --patch -r .: trip#显示你得到的所有变更集的完整差异

使用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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM