簡體   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