当我执行 hg pull 和 hg update 时,哪些文件将被更改和添加

发布于 2024-09-10 13:08:56 字数 270 浏览 6 评论 0原文

因此,在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

深居我梦 2024-09-17 13:08:56

Omni 有你的答案,我投票支持它,但只是为了显示所有选项:

在拉取 hg传入之前

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

hg传入 --patch # 显示拉取(但不更新)后

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

Omni has your answer, and I voted for it, but just to show all the options:

Before pulling

  • hg incoming # shows the changesets you'll get
  • hg incoming --verbose # shows the changesets you'll get including a file list for each
  • hg incoming --patch # shows the full diffs of all the changesets you'll be getting

After pulling (but not updating):

  • hg log -r .:tip # shows the changesets you got
  • hg log --verbose -r .:tip # shows the changesets you got including a file list for each
  • hg log --patch -r .:trip # shows the full diffs of all the changesets you got
爱要勇敢去追 2024-09-17 13:08:56

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

在类 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:

$ 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

which corresponds to this update:

$ 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

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:

[hooks]
preupdate = hg status --rev .:%HG_PARENT1%

Replace %HG_PARENT1% with $HG_PARENT1 on Unix-like systems. This should make the Mercurial experience even more Subversion-like :-)

随心而道 2024-09-17 13:08:56

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 do hg diff --git -r <rev> and it will give you a diff that shows which files are new.

初见 2024-09-17 13:08:56

您可以将 hgcoming 与捆绑包一起使用,将 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

You can use hg incoming with bundles, to apply Martin's answer to changes you haven't actually pulled yet.

> 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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文