移动 Mercurial 存储库

发布于 2024-11-04 07:01:01 字数 329 浏览 2 评论 0原文

我在 someFolder 中创建并使用了 Mercurial 存储库。现在我发现需要跟踪上一级的文件。所以我需要创建 someOtherFolder 并将 someFolder 移入其中。这应该没有问题。

此时我将有

someOtherFolder
    someFolder
        .hg
        many other files

是否有办法告诉 Mercurial 扩大其范围并开始跟踪 someOtherFolder 内的文件?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

难以启齿的温柔 2024-11-11 07:01:04

您应该能够使用 hg 转换扩展 来执行此操作。

我没有对此进行测试,但类似的方法可能会起作用:

$ echo include someFolder > /tmp/myfilemap
$ echo rename someFolder someOtherFolder/someFolder >> /tmp/myfilemap
$ hg convert --filemap /tmp/myfilemap /path/to/repo/foo /tmp/mysubfoo-repo

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
小忆控 2024-11-11 07:01:03

可能有更好的方法来做到这一点,但您可以做的一件事是将所有文件 hg mv 复制到新的子目录 someFolder 中,然后重命名父目录 someFolder< /code> 到 someOtherFolder,例如:

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文