[英]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.