克隆后存储库中的文件,但没有历史记录

发布于 2024-10-16 22:41:51 字数 942 浏览 1 评论 0原文

我们不久前有一个从 Subversion 转换而来的 Mercurial 存储库,今天注意到存储库中的某些文件没有任何历史记录。

此行为的症状之一是 hg status 将文件报告为干净,而 hg log 报告同一文件没有更改集:

> hg clone [repo]
> hg st -c FileWithMissingHistory.cs

C  FileWithMissingHistory.cs

> hg blame FileWithMissingHistory.cs
FileWithMissingHistory.cs: no such file in rev [...]
> hg log FileWithMissingHistory.cs
> hg log FileWithMissingHistory.cs -f
abort: cannot follow nonexistent file: "FileWithMissingHistory.cs"

> hg log -v | grep FileWithMissingHistory.cs

[gives output, there arechangesets mentioning the file]

显然示例中的文件名已更改。我尝试过使用 hg verify,但此命令报告存储库正常。有没有人经历过这种情况?我们可以做些什么来让历史“复活”?将虚拟历史记录放在有问题的文件上是可以接受的,但不是最理想的。

编辑: 我做了更多调查,注意到“FileWithMissingHistory.cs”在修订版 238 中从另一个文件名(hg 复制 + 删除)重命名。如果我在该修订版中执行 hg update -r238 和 hg 登录该文件,我不会得到任何历史。对原始文件执行 hg log 按预期报告历史记录,因此似乎历史记录在复制过程中以某种方式丢失(同样,使用 hg copy 重命名该文件,并且更改集清楚地表明该文件已被复制)。

We have a Mercurial repository converted from Subversion a while ago and have today noticed that there are files in the repository that have no history whatsoever.

One of the sympomts of this behaviour is that hg status reports the file as clean, while hg log reports no changesets for the same file:

> hg clone [repo]
> hg st -c FileWithMissingHistory.cs

C  FileWithMissingHistory.cs

> hg blame FileWithMissingHistory.cs
FileWithMissingHistory.cs: no such file in rev [...]
> hg log FileWithMissingHistory.cs
> hg log FileWithMissingHistory.cs -f
abort: cannot follow nonexistent file: "FileWithMissingHistory.cs"

> hg log -v | grep FileWithMissingHistory.cs

[gives output, there arechangesets mentioning the file]

Obviously the filenames have been changed in the example. I've tried using hg verify, but this command reports that the repo is fine. Has anyone experienced this and is there anything we could do to bring the history "back to life"? Placing dummy history on the files in question would be acceptable, but suboptimal.

EDIT:
I've done some more investigation and noticed that "FileWithMissingHistory.cs" was renamed from another filename (hg copy + delete) in revision 238. If I do hg update -r238 and hg log on the file at this revision I do not get any history. Doing hg log on the original file reports the history as expected, so it seems that the history is somehow lost during copy (again, the file is renamed using hg copy, and the changeset clearly indicates that the file has been copied).

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

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

发布评论

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

评论(2

顾忌 2024-10-23 22:41:51

听起来很奇怪,实际上不可能。我要尝试调试此问题的方法是更新到不同的修订版,并检查文件第一次出现在工作副本中的修订版。如果您以二分搜索方式执行此操作(类似于 bisect 扩展 的工作方式),您应该找到在几次更新后引入该文件的修订版。

这并不能解决问题,但可能有助于追踪其根源。

Sounds strange, actually impossible. What I would try to debug this issue is to update to different revisions and check at which revision the file appears in the working copy the first time. If you do this in a binary search fashion (similar to how the bisect extension works), you should find a revision which introduces the file after a few updates.

This does not solve the problem, but it may help in tracking down its source.

z祗昰~ 2024-10-23 22:41:51

我终于找到了上述影响的原因,看来这是由混合大小写问题引起的。一些文件位于名称小写的目录中,而其他文件位于名称相同的目录中,只是大小写混合(例如“directory/FileWithHistory.cs”和“DiReCtOrY/FileWithMissingHistory.cs”)。在 Windows 上,这两个文件将位于同一目录中,从而导致问题。

I've finally tracked down the cause of the effects mentioned above and it seems that this is caused by mixed casing issues. Some of the files are located in directories with lowercase names while others are located in the directories with equal names, only that the case is mixed (e.g. "directory/FileWithHistory.cs" and "DiReCtOrY/FileWithMissingHistory.cs"). On Windows, both files will be located in the same directory causing issues.

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