Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial Error. Not under root

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
like image 385
afkbowflexin Avatar asked Nov 06 '22 05:11

afkbowflexin


1 Answers

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
like image 60
Lasse V. Karlsen Avatar answered Nov 09 '22 14:11

Lasse V. Karlsen