水星错误。不在根目录下

发布于 2024-10-08 02:50:21 字数 778 浏览 0 评论 0原文

尝试将文件添加到我的 Mercurial 存储库时出现以下错误。

abort: /HRTRL/img not under root

当这里的开发人员决定忽略我们的正常工作流程并直接对生产服务器进行更改而不是在他的工作目录中进行更改,然后将它们推送到测试存储库时,这一切就开始了。然后,我需要将测试存储库与他的更改同步,所以我最终所做的只是将他的更改复制到我的当前工作目录,然后推送到中央存储库。复制和删除文件时我没有使用 Mercurial。我现在的目录中有未跟踪的文件,并且想添加它们以便我可以提交。我最终遇到了上述错误。

这是 hg status 的输出

! HRTRL/css/grid.css
! HRTRL/css/ie.css
! HRTRL/css/ie7.css
! HRTRL/css/jquery.lightbox-0.5.css
! HRTRL/css/layout.css
! HRTRL/css/productPages.css
! HRTRL/css/reset.css
! HRTRL/css/typography.css
? HRTRL/img/webheadercenter.jpg
? HRTRL/img/webheaderleft.jpg
? HRTRL/img/webheaderright.jpg
? HRTRL/includes/CallLog/tests/all_tests.php
? HRTRL/includes/CallLog/views/index.php
? HRTRL/includes/CallLog/views/styles/style.css

I'm getting the following error when trying to add files to my mercurial repo.

abort: /HRTRL/img not under root

This started when a developer here decided to ignore our normal workflow and made changes directly to the production server instead of making them in his working directory and then pushing them to the test repo. I then needed to sync the test repo with his changes, so what I ended up doing was just copying his changes over to my working directory, which was current, and then pushing to the central repository. I did not use mercurial when copying and removing files. I now have untracked files in my directory and would like to add them so I can commit. I end up with the above error.

This is the output of hg status

! HRTRL/css/grid.css
! HRTRL/css/ie.css
! HRTRL/css/ie7.css
! HRTRL/css/jquery.lightbox-0.5.css
! HRTRL/css/layout.css
! HRTRL/css/productPages.css
! HRTRL/css/reset.css
! HRTRL/css/typography.css
? HRTRL/img/webheadercenter.jpg
? HRTRL/img/webheaderleft.jpg
? HRTRL/img/webheaderright.jpg
? HRTRL/includes/CallLog/tests/all_tests.php
? HRTRL/includes/CallLog/views/index.php
? HRTRL/includes/CallLog/views/styles/style.css

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

撕心裂肺的伤痛 2024-10-15 02:50:21

如果您想要:

  • 删除所有状态为 !(文件在存储库中跟踪,但在磁盘上丢失)的
  • 所有状态所有状态为 ?(文件未知)的状态, 然后您可以简单地发出

以下命令:

hg addremove --similarity 90

如果您愿意,您可以删除 --similarity 90 部分,但如果您离开,它会尝试找出您是否已重命名添加了一些丢失的文件。

如果可以的话,我会尝试使用 TortoiseHg 进行添加删除,因为它还可以进行相似性检查以查看您是否复制了文件,这可能会使这些文件的历史记录更加正确,如果它们是来自现有文件的副本(并且仍然跟踪)文件。 addremove --similarity 90 部分将仅检查重命名/移动,而不检查副本。


或者,如果您只需要部分文件,则可以手动执行。对于状态为 ! 的每个文件,您可以发出以下命令:

hg remove --after X

其中 X 是文件的路径和名称,例如:

hg remove --after HRTRL/css/grid.css

然后对于每个您想要添加的状态 ? 文件:

hg add X

示例:

hg add HRTRL/img/webheadercenter.jpg

If you want:

  • All those with status ! (file is tracked in repository, but missing on disk), to be removed
  • All those with status ? (file is unknown), to be added

Then you can simply issue the following command:

hg addremove --similarity 90

You can, if you want to, drop the --similarity 90 part, but if you leave it will try to find out if you have renamed the added files from some of the missing ones.

If you can, I would try using TortoiseHg to do the addremove, since it can also do the similarity check to see if you've copied the files, this might make history for those files more correct if they are copies from existing (and still tracked) files. The addremove --similarity 90 part will only check for renames/moves, not for copies.


Or, if you only want some of the files, you can do it manually. For each of the files with status !, you can issue the following command:

hg remove --after X

where X is the path to and name of the file, for instance:

hg remove --after HRTRL/css/grid.css

and then for each of the status ? files you want added:

hg add X

example:

hg add HRTRL/img/webheadercenter.jpg
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文