Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move Mercurial repository

Tags:

mercurial

I have created and used a Mercurial repository in someFolder. Now I have discovered the need to keep track of files one level up. So what I would need is to create someOtherFolder and move someFolder into it. This should be no problem.

At this point I will have

someOtherFolder
    someFolder
        .hg
        many other files

Is there a way to tell Mercurial to broaden its scope and start keeping track of files inside someOtherFolder instead?

like image 484
Andrea Avatar asked Apr 28 '11 08:04

Andrea


Video Answer


2 Answers

There's probably a nicer way to do this, but one thing you could do is hg mv all the files to a new subdirectory someFolder and then rename the parent someFolder to someOtherFolder, e.g.:

someFolder$ mkdir someFolder

someFolder$ hg locate | xargs --replace=FILE hg mv FILE someFolder/FILE

someFolder$ hg status
A someFolder/a.txt
A someFolder/foo/b.txt
R a.txt
R foo/b.txt

someFolder$ hg commit -m "moved files to subfolder"
someFolder$ cd ..
$ mv someFolder someOtherFolder
like image 118
seb Avatar answered Sep 27 '22 19:09

seb


You should be able to use hg convert extension to do this.

I didn't test this, but something like this may work :

$ echo include someFolder > /tmp/myfilemap
$ echo rename someFolder someOtherFolder/someFolder >> /tmp/myfilemap
$ hg convert --filemap /tmp/myfilemap /path/to/repo/foo /tmp/mysubfoo-repo
like image 23
krtek Avatar answered Sep 27 '22 19:09

krtek