水星错误。不在根目录下
尝试将文件添加到我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想要:
!
(文件在存储库中跟踪,但在磁盘上丢失)的?
(文件未知)的状态, 然后您可以简单地发出以下命令:
如果您愿意,您可以删除
--similarity 90
部分,但如果您离开,它会尝试找出您是否已重命名添加了一些丢失的文件。如果可以的话,我会尝试使用 TortoiseHg 进行添加删除,因为它还可以进行相似性检查以查看您是否复制了文件,这可能会使这些文件的历史记录更加正确,如果它们是来自现有文件的副本(并且仍然跟踪)文件。
addremove --similarity 90
部分将仅检查重命名/移动,而不检查副本。或者,如果您只需要部分文件,则可以手动执行。对于状态为
!
的每个文件,您可以发出以下命令:其中
X
是文件的路径和名称,例如:然后对于每个您想要添加的状态
?
文件:示例:
If you want:
!
(file is tracked in repository, but missing on disk), to be removed?
(file is unknown), to be addedThen you can simply issue the following command:
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:where
X
is the path to and name of the file, for instance:and then for each of the status
?
files you want added:example: