Mercurial显示文件修改不正确 [英] Mercurial showing files as modified incorrectly

查看:69
本文介绍了Mercurial显示文件修改不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我克隆出Mercurial存储库时,通常会显示文件被修改而没有被修改的情况.当我执行以下步骤时,可能会发生这种情况;

When I clone out a Mercurial repository it usually shows files as being modified when they have not. This can happen when I do the following steps;

$ hg clone <url>
$ cd project
$ hg st
.... large number of files with M at the start for modified
$ hg diff
.... no result.

我认为这是因为在此过程中文件的权限已更改,因此文件似乎有所不同,因为使用hg st时hg实际上并未对每个文件进行比较.我知道这也可能在git中发生.

I think this is because the files have had their permissions changed in the process so it seems like the files are different since hg doesn't actually do a diff on each file when hg st is used. I know this can happen in git too.

如果我执行了hg commit,那么问题就消失了,但这意味着我必须执行一个空的commit,这并不是特别好.

if I do a hg commit then the problem does go away but it means I have to do an empty commit and that isn't particularly nice.

我尝试做各种事情,例如hg st --all以获得更多信息,它仅显示某些文件已修改-并非全部.我看不到图案.

I've tried doing various things like hg st --all to get more information and it only shows that some files are modified - not all. I can't see a pattern.

在进行hg克隆时,由于备份而在我使用的网络驱动器上发生它-我不确定这是否是导致文件权限更改的原因吗?我当前正在运行Ubunut 9.04.

When I'm doing my hg clone its happening on my network drive that I used because its backed up - I'm not sure if this could be whats causing the file permissions to change? I'm currently running Ubunut 9.04.

有没有办法让我以某种方式纠正自身?

is there a way that I can get hg st to correct itself somehow?

有问题的项目(尽管它是与其他人一起发生的)是 http://bitbucket.org /d0ugal/django-bursar/overview/,因为我正在为此做一些工作.

The project in question (although its happened with others) is http://bitbucket.org/d0ugal/django-bursar/overview/ as I'm looking to do some work on it.

推荐答案

事实证明:

$ hg diff --git

...显示文件权限确实从644更改为755.

...shows that the file permissions had indeed changed from 644 to 755.

我不太喜欢该解决方案,但是我能够通过运行它来解决它(在托管代码的服务器上,而不是在我的本地计算机上).

I don't particularly like the solution but I was able to resolve it by running this (on the server hosting the code, not my local machine).

find . -type f -print | xargs chmod 644

然后两个文件显示它们已从755更改为644(因此我分别进行了更新).幸运的是,在这种情况下这非常容易,但是具有更多文件权限的项目可能会成为问题.

Then two files showed they had changed from 755 to 644 (so I updated those individually). Luckily it was pretty easy in this case but a project with more diverse file permissions could be a problem.

我认为问题可能出在我的服务器共享驱动器的方式上-我需要在另一点进行调查,但这适合临时情况.这必须与如何将文件保存到远程计算机有关.我想下一次,我将尝试在服务器本身上进行git clone并在本地项目上进行工作.

I think the issue could be with how my server is sharing the drive - I'll need to look into that at another point but this serves a fit for the interim. It must be something to do with how the files are saved to the remote machine? I think next time I'll try doing the git clone on the server itself and the work on the project locally.

作为旁注,git的常见问题解答中对此行为有一个要点. http://git.wiki.kernel.org/index.php/GitFaq#Why_does_git_diff_sometimes_list_a_file_that_has_no_changes.3F -虽然我找不到任何用于水银的东西.

As a side note, there is a point about this behavior in git's FAQ. http://git.wiki.kernel.org/index.php/GitFaq#Why_does_git_diff_sometimes_list_a_file_that_has_no_changes.3F - i couldn't find anything for mercurial though.

这篇关于Mercurial显示文件修改不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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