2
有時我似乎無法跟蹤合併衝突。 我需要一個命令,允許我放棄其中一個未提交的文件,然後使用遠程副本進行更新。如何告訴mercurial 1.放棄本地文件2.使用遠程文件
我試過hg恢復myfile後跟hg pull,hg commit 但它仍然不會讓我合併或提交。
它不斷告訴我先解決未解決的衝突。
有時我似乎無法跟蹤合併衝突。 我需要一個命令,允許我放棄其中一個未提交的文件,然後使用遠程副本進行更新。如何告訴mercurial 1.放棄本地文件2.使用遠程文件
我試過hg恢復myfile後跟hg pull,hg commit 但它仍然不會讓我合併或提交。
它不斷告訴我先解決未解決的衝突。
您可能需要讓Mercurial知道您已經使用hg resolve
解決了衝突。從手冊頁:
hg resolve [OPTION]... [FILE]...
redo merges or set/view the merge status of files
Merges with unresolved conflicts are often the result of non-interactive
merging using the "internal:merge" configuration setting, or a command-
line merge tool like "diff3". The resolve command is used to manage the
files involved in a merge, after "hg merge" has been run, and before "hg
commit" is run (i.e. the working directory must have two parents). See "hg
help merge-tools" for information on configuring merge tools.
The resolve command can be used in the following ways:
- "hg resolve [--tool TOOL] FILE...": attempt to re-merge the specified
files, discarding any previous merge attempts. Re-merging is not
performed for files already marked as resolved. Use "--all/-a" to select
all unresolved files. "--tool" can be used to specify the merge tool
used for the given files. It overrides the HGMERGE environment variable
and your configuration files. Previous file contents are saved with a
".orig" suffix.
- "hg resolve -m [FILE]": mark a file as having been resolved (e.g. after
having manually fixed-up the files). The default is to mark all
unresolved files.
- "hg resolve -u [FILE]...": mark a file as unresolved. The default is to
mark all resolved files.
- "hg resolve -l": list files which had or still have conflicts. In the
printed list, "U" = unresolved and "R" = resolved.
Note that Mercurial will not let you commit files with unresolved merge
conflicts. You must use "hg resolve -m ..." before you can commit after a
conflicting merge.
下面介紹如何從服務器獲取文件的版本。 當您「hg pull」時,來自服務器的所有更改將進入您的存儲庫副本。您可以在任何修訂版本中使用以下內容獲取文件的內容:
hg cat -r <rev> <file>
使用它覆蓋本地文件並提交。
是的我可以使用一個工具來解決(我所要做的就是選擇從服務器拉出的文件)。有沒有一種方法可以在不使用該工具的情況下實現相同的功能? – 2012-07-24 14:58:59
「hg resolve」不必使用工具:您可以使用「-m」將文件標記爲已解決。或者我誤解了你的問題? – 2012-07-24 15:12:20
在標記爲已解決之前,我需要擁有正確的文件(服務器中的文件)。我需要使用遠程副本更新本地副本。我不想合併。我的本地文件需要被丟棄。 – 2012-07-24 15:15:22