Move Mercurial repository
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 bro开发者_JS百科aden its scope and start keeping track of files inside someOtherFolder
instead?
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
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
精彩评论