2
Y:\>hg -R Y:/mercFlow.cache/vm-linux rename Migration-2010/create_directory_stru
cture.pl Migration-2010/create_directory_structure.pl2
abort: Migration-2010/create_directory_structure.pl not under root

I am in windows using Mercurial. I am trying to rename\move a file as a simple test. Y:/mercFlow.cache/vm-linx/Migration-2010/create_directory_structure.pl exists and is brow-sable in the file browser. Migration-2010/create_directory_Structure.pl most definitely does seem to exist under the vm-linux local repository.

What's going wrong here?

2 Answers2

5

You need to use paths relative to your current working directory when you use hg -R -- that is, the -R option does not change the working directory of the hg proceess. The --cwd option does change the working directory.

This illustrates the difference:

$ hg init test
$ echo hello > test/hello.txt
$ hg -R test add test/hello.txt
$ hg -R test status test/hello.txt
A test/hello.txt
$ hg --cwd test status hello.txt
A hello.txt

and this does not work:

$ hg -R test status hello.txt
abort: hello.txt not under root
$ hg --cwd test status test/hello.txt
test/hello.txt: No such file or directory
  • Pitty there's no mention of this at http://www.selenic.com/mercurial/hg.1.html#options – Piotr Dobrogost Feb 14 '14 at 12:52
  • 1
    @PiotrDobrogost: It's a little implicit now, yes. Maybe you could submit a patch with better help strings for the options? Please see http://mercurial.selenic.com/wiki/ContributingChanges. – Martin Geisler Feb 14 '14 at 13:13
  • Newer versions of Mercurial apparently show a hint (consider using '--cwd ') when using -R, --repository option together with any option taking file name pattern when the file name pattern is not rooted in the specified repository root directory. – Piotr Dobrogost Nov 24 '17 at 14:20
0

is Migration-2010/create_directory_structure.pl under version control? It has to be in your Mercurial repository before you can manipulate it with Mercurial.

erjiang
  • 747