Mercury error. Not at the root

I get the following error when trying to add files to my mercury repo.

abort: /HRTRL/img not under root 

It started when the developer decided to ignore our usual workflow and made changes directly to the production server instead of making them in his working directory and then redirecting them to the test repo. Then I needed to synchronize the test repo with its changes, so what I ended up with was just copying its changes to my working directory, which was current, and then clicking on the central repository. I did not use mercurial when copying and deleting files. Now I have unsolicited files in my directory and I want to add them so that I can commit. I get the error above.

This is the hg state output

 ! 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 
+4
source share
1 answer

If you want to:

  • All those who have a status ! (the file is tracked in the repository, but not on the disk), which must be deleted
  • All those who have a status ? (file unknown) will be added

Then you can simply execute the following command:

 hg addremove --similarity 90 

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

If you can, I would try using TortoiseHg to make addremove, since it can also do a similarity check to see if you copied the files, this can make the history for these files more correct if they are copies from existing ones (and that’s all tracked) files. The addremove --similarity 90 only checks for renames / moves, not copies.


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

 hg remove --after X 

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

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

and then for each of the status ones ? files you want to add:

 hg add X 

Example:

 hg add HRTRL/img/webheadercenter.jpg 
+2
source

Source: https://habr.com/ru/post/1332147/


All Articles