在 Windows 上,只要文件本身没有更改,Mercurial 就会忽略文件的创建/修改时间。 Linux 显然无法做到这一点。在我的工作中,有些人在 Windows 机器上工作,有些人在 Linux 机器上工作,我们在 Mercurial 中有很多误报的变化。
很好的例子是我们从 YML 文件重新生成 Doctrine 模型。它们中的大多数保持不变,只有一两个更改,但所有更改都会重新生成,我必须仔细检查所有更改并确保忽略它们的更改(恢复)是安全的,这样它们就不会弄乱 Mercurial提交。
有没有办法让 Linux 像 Windows 一样看到这些文件?
顺便说一句:我已经检查过,它与 EOL 问题或 UTF-8 BOM 或其他隐藏字符无关。仅时间戳发生变化。
提前致谢!
最佳答案
如果 mtime 是唯一的更改,Linux 上的 Mercurial 不会提交文件:
~ $ mkdir test ~ $ cd test/ ~/test $ hg init ~/test $ echo a > a ~/test $ ls -l total 4 -rw------- 1 user users 2 Jul 23 13:21 a ~/test $ hg add a adding a ~/test $ hg commit -m "Adding a" a committed changeset 0:e7d3dddff169 ~/test $ ls -l total 4 -rw------- 1 user users 2 Jul 23 13:21 a ~/test $ touch a ~/test $ ls -l total 4 -rw------- 1 user users 2 Jul 23 13:22 a ~/test $ hg status ~/test $ hg commit -m "Mtime changed on a" a nothing changed ~/test $
如果 ctime 发生更改,它也不会检测到更改:
~/test $ ls -l total 4 -rw------- 1 user users 2 Jul 23 13:22 a ~/test $ rm a rm: remove regular file ‘a’? y ~/test $ echo a > a ~/test $ ls -l total 4 -rw------- 1 user users 2 Jul 23 14:27 a ~/test $ hg status ~/test $ hg commit -m "Ctime changed on a" a nothing changed ~/test $
关于linux - Mercurial 忽略 LInux 上的创建/修改日期更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17806265/