在 Mercurial (TortoiseHG) 中共享相同历史记录的复制文件 [英] Copied file sharing same mutual history in Mercurial (TortoiseHG)

查看:33
本文介绍了在 Mercurial (TortoiseHG) 中共享相同历史记录的复制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Mercurial 中(最好通过 TortoiseHG 接口)是否可以复制提交的文件,并且新的目标文件可以共享源文件的历史记录?

In Mercurial (preferably via TortoiseHG interface) is it possible to copy a committed file, and for the new destination file to share the history for the source file?

我很确定这是不可能的,但我问是希望它真的很好地隐藏在文档中.

I'm pretty sure this is not possible, but I'm asking in the hope that it's just really well hidden in the documentation.

我有一个具有相当长更改历史的文件,但我现在需要在项目中拥有此文件的第二个副本,其中将包含它自己的单个更改.但是,如果能够查看此复制文件的历史记录并查看复制前对原始文件所做的所有更改(以及复制后发生的更改),将非常有用.<小时>

更新

I have a file with a fairly long history of changes, but I now need to have have a 2nd copy of this file within the project which will contain it's own individual changes. However, it would be exceedingly useful to be able to view the history of this copied file and see all the changes that took place on the original before the copy took place (as well as those that have taken place since the copy).

感谢@Inspired 的回答.正如我在给他们的评论中所说的那样,我有错...

Update

我刚刚意识到它为什么不起作用:我没有通过命令行或 THG 复制文件,而是通过 Visual Studio (2010) 使用 VisualHG.VHG 必须复制文件然后添加它,而不是使用 mercurial 复制功能.所以以后要记得直接用mercurial!

Thanks to @Inspired for their answer. As I said in my comment to them, I was at fault...

或者更准确地说,我的猜测是 VisualHG 无法覆盖 Visual Studio 的默认功能,因此只能使用复制的文件,而不是运行 mercurial copy 命令.这纯粹是我的猜测.

I just realised why it wasn't working: I didn't copy the file through either the command line or THG, but through Visual Studio (2010) using VisualHG. VHG must copy the file and then add it, rather than using the mercurial copy function. So I need to remember to use mercurial directly in the future!

推荐答案

从命令行,您可以发出 hg copy

解决方案
    <新名称>.Mercurial 确实在您执行复制或重命名(hg cp/hg mv)时保存历史日志.

From command line, you can issue hg copy <old name> <new name>. Mercurial does save the history log when you perform copy or rename (hg cp / hg mv).

在 TortoiseHG 中复制有点棘手:您必须手动复制文件(例如通过 cp),然后在 Commit 模式下的 THG 中右键单击带有未版本控制的新文件的左下方窗格,然后选择 Detect renames.取消勾选只考虑已删除的文件,让TortoiseHG找到类似的文件,完成后点击源文件.TortoiseHG 会将新文件记录为副本.我还没有找到更简单的方法.

In TortoiseHG the copy is a bit tricky: you have to copy the file manually (e.g. via cp), then in THG in Commit mode right-click at the left low pane with the unversioned new file and select Detect renames. Uncheck Only consider deleted files, let TortoiseHG find similar files and click the source file when it finishes. TortoiseHG will record the new file as a copy. I haven't found a simpler way.

从命令行查看历史时,查看历史时需要指定-f(或--follow):hg log -f<文件名>.TortoiseHG 已经做到了.

When viewing history from command line, you need to specify -f (or --follow) when you are viewing the history: hg log -f <filename>. TortoiseHG already does that.

这篇关于在 Mercurial (TortoiseHG) 中共享相同历史记录的复制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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