12

My question is this: what might be causing Mercurial to indicate (via "status" or TortoiseHgWorkbench) files as "Modified" when they are unchanged?

Here's the situation: I have a repository local to a Linux machine. I only work with the repository on the Linux machine. I do, however, have an exact copy of the repository (and the working file) on a Windows machine (I synchronize via a flash drive, using BeyondCompare). To my best recollection, I never invoke mercurial on the Windows machine, though it is installed there.

I recently wanted to do a commit on the Linux machine, and many files that I didn't expect to show up were listed as "Modified". I did a visual diff (using BeyondCompare) which indicates that the working directory copy is "binary identical" to the parent in the repository. TortoiseHgWorkbench shows the file "modified", and the differences window shows the entire file, in green, (as if the repository had an empty file, I guess). On the file in question, the file date on the file system is months old, whereas my last commit (I commit all changed files) was a couple weeks ago. Some unchanged files show as "modified", but some do not. I have not ever seen this behavior previously, so I'm a little confused.

I ran "hg verify" on the repository and it didn't note anything interesting.

I guess it is not a big deal since all the files in the working directory are intact, and if I were to commit the files (even though they are unchanged), I'm not sure anything would be hurt. But I am keen to understand what has happened.

Thanks in advance for any ideas what to look for.

[EDIT]

Still haven't found a root cause (file permissions and access dates unchanged) but @barjak's response pointed me in the direction where I found this:Why does "hg status" show changed files when "hg diff -g" doesn't? (One parent). My situation is the same as described there (both hg diff and hg diff --git only show files that really have changed, while hg status shows a few unchanged files). BTW I'm using Hg 2.6.

[EDIT]

If it is helpful to anyone, here is how I got back to a normal repository:

in a shell:

cd src
hg diff --git > ../junk
grep "\-\-git" ../junk

in tortoiseHgWorkbench

uncheck all files marked "M"
check all files indicated in the grep results above (i.e., have real diffs)
commit

in a shell:

hg revert --all

then clean up the working directory (revert --all generated some defunct files. Also reset some file dates (I'm the only person using this repository and file dates are useful to me. Yes there is an Hg extension to restore file dates but I've not installed it yet).

This process got me all lined up again.

4

2 回答 2

12

更改 Unix 权限时,也可以将文件标记为已修改。尝试hg diff -g检查权限。

于 2013-10-03T21:53:36.197 回答
4

只是做一个还原对我没有帮助。即使我已提交文件,这些文件仍将保持在已修改状态。如果我再次尝试提交。所以我只是删除了显示为已修改的文件(如果需要,请进行备份),这导致所有文件都显示为 ! 我跑的时候在它旁边

hg st

之后,我运行以下命令来恢复文件(已经签入):

hg revert --all --no-backup

这解决了问题

于 2015-11-16T21:36:52.177 回答