Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mercurial 中止:工作目录中未跟踪的文件与请求修订版中的文件不同:';。hgignore';_Mercurial_Hgignore - Fatal编程技术网

Mercurial 中止:工作目录中未跟踪的文件与请求修订版中的文件不同:';。hgignore';

Mercurial 中止:工作目录中未跟踪的文件与请求修订版中的文件不同:';。hgignore';,mercurial,hgignore,Mercurial,Hgignore,我正在尝试提取一些文件和目录,并收到以下消息: 当我查看我的存储库时,我可以看到文件已经下载,但所有文件都包含作为前缀,甚至文件和文件夹的名称也包含 requesting all changes adding changesets adding manifests adding file changes added 1094 changesets with 4304 changes to 1071 files abort: untracked file in working direct

我正在尝试提取一些文件和目录,并收到以下消息:

当我查看我的存储库时,我可以看到文件已经下载,但所有文件都包含
作为前缀,甚至文件和文件夹的名称也包含

requesting all changes 
adding changesets 
adding manifests 
adding file changes 
added 1094 changesets with 4304 changes to 1071 files abort:
untracked file in working directory differs from file in requested revision: '.hgignore' [command interrupted]

怎么了?

我认为您在工作目录中创建了一个
.hgignore
,但没有将其添加到存储库(
hgadd
)。此文件“未跟踪”

来自另一个克隆的其他人也添加了此文件,提交并推送了它。现在,当您尝试更新您的工作目录时,Mercurial尝试添加此文件,但在您的工作目录中看到一个名称相同但未跟踪且不同的文件

您的问题有两种解决方案:

  • 备份.hgignore文件,进行更新,必要时添加与备份的差异
  • 使用
    hg Add
    将您自己的文件添加到存储库中,然后重新运行更新。可能需要在更新之前提交文件

  • 我建议使用第一种解决方案。

    当你说存储库中的文件以
    \u
    作为前缀时,你是在向下看
    .hg
    目录,不是吗?这是Mercurial本身的数据存储,其中的文件是revlog,而不是您的文件。在
    .hg
    之外,您将拥有一个工作目录,其中的文件是您期望的实际文件。您现在没有收到这些文件,因为
    hg update
    拒绝更新工作目录,因为这样做会覆盖您未提交的
    .hgignore
    文件

    您正在运行的确切命令是什么?它看起来像是在做一个
    hg pull
    ,然后是
    hg update
    ,所以我猜
    hg clone
    ,但是如果你已经有了一个
    .hgignore
    ,那么这不是正确的命令。如果您使用的是
    hg pull-u
    hg fetch
    ,那么您应该使用
    hg pull
    来获取变更集。然后你可以:

    hg add .hgignore  # add the hg ignore file you already have that's untracked
    hg commit -m .hgignore  # commit the .hgignore file you just added
    hg merge  # merge your new commit (.hgignore) with the changesets you just pulled down.
    

    解决方案1对我有效,我移动了上述文件,一切正常。非常感谢。