使用Mercurial重新组织目录结构

Joh*_*åde 4 mercurial

我有一个目录结构的项目

Foo/
    .hg
    Bar1/
        ...
    Bar2/
        ...
    Zope/
        ...
Run Code Online (Sandbox Code Playgroud)

我想改成这个

Foo/
    .hg
    Source/
        Bar1/
            ...
        Bar2/
            ...
    Zope/
        ...
Run Code Online (Sandbox Code Playgroud)

什么是最简单的方法?(有太多的文件可以逐个移动它们.并且有几个文件具有相同的内容,所以如果我只是移动文件并要求Mercurial事后解决问题,那么事情就会变得有些混乱.)

Chr*_*cht 7

Mercurial有一个特殊的命令来移动东西:hg mv
当你像这样移动你的文件夹时,它知道Foo/Source/Bar/SomeFile以前的历史记录Foo/Bar/SomeFile.
因此,当您查看Foo/Source/Bar/SomeFile现在的历史记录时,您还会看到文件静止时所做的更改Foo/Bar/SomeFile.

这是一个如何将Bar1文件夹移动到文件Source夹并提交的示例:

hg mv Bar1 Source
hg commit -m "moved to Source folder"
Run Code Online (Sandbox Code Playgroud)