如何将mercurial告知1。丢弃本地文件2。使用远程文件

如何将mercurial告知1。丢弃本地文件2。使用远程文件,mercurial,conflict,Mercurial,Conflict,有时我似乎无法跟踪合并冲突。 我需要一个命令,允许我丢弃一个未提交的文件,然后用远程副本更新它 我尝试了hg-revert-myfile,然后是hg-pull,hg-commit 但它仍然不允许我合并或提交 它一直告诉我先解决未解决的冲突。您可能需要使用hg resolve让Mercurial知道您已经解决了冲突。从手册页: hg resolve [OPTION]... [FILE]... redo merges or set/view the merge status of files

有时我似乎无法跟踪合并冲突。 我需要一个命令,允许我丢弃一个未提交的文件,然后用远程副本更新它

我尝试了hg-revert-myfile,然后是hg-pull,hg-commit 但它仍然不允许我合并或提交


它一直告诉我先解决未解决的冲突。

您可能需要使用
hg resolve
让Mercurial知道您已经解决了冲突。从手册页:

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>
hg cat-r

使用该选项覆盖本地文件并提交。

是的,我可以使用工具来解决(我所要做的就是选择从服务器中提取的文件)。有没有一种方法可以在不使用工具的情况下实现相同的功能?“hg resolve”不必使用工具:您可以使用“-m”将文件标记为已解析。还是我误解了您的问题?在标记为已解决之前,我需要有正确的文件(服务器中的文件)。我需要用远程副本更新本地副本。我不想合并。我的本地文件需要丢弃。当您“hg pull”时,服务器上的所有更改都会进入存储库的副本中。您可以使用“hg cat-r”获取任何版本中的文件内容。使用该选项覆盖本地文件,并提交.Cool Peter(+1)。正是我想要的。