Mercurial:将一个文件及其历史记录复制到另一个存储库 [英] Mercurial: copying ONE file and its history to another repository

查看:58
本文介绍了Mercurial:将一个文件及其历史记录复制到另一个存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以将一个文件及其历史记录从一个存储库复制到另一个存储库,而不必导入整个其他存储库.

I'm wondering if I can copy one file and its history from one repository to another, without having to import the whole other repository.

推荐答案

您可以使用 ConvertExtension 将仅一个文件从第一个存储库导出到新的临时存储库中,然后使用hg pull -f将新存储库导入到目标存储库中.

You can use the ConvertExtension to export just that one file from the first repository into a new temporary repository, then use hg pull -f to import the new repository into the target repository.

用单行为ConvertExtension创建文件映射:

Create a filemap for the ConvertExtension with the single line:

include path/to/file

然后使用:

hg convert path/to/original path/to/temporary --filemap filemap

创建临时存储库.接下来,在目标存储库中,执行以下操作:

to create the temporary repository. Next, in the target repository, do:

hg pull -f path/to/temporary

拉入该文件及其历史记录.这将创建一个新的标头,因此请使用hg merge将其与目标存储库中的标头合并.

to pull in that file with its history. This will create a new head, so use hg merge to merge it with the head in your target repository.

这篇关于Mercurial:将一个文件及其历史记录复制到另一个存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆