Issue750

Title Revisions with case-only renames cannot be checkout on case-folding systems
Priority bug Status resolved
Superseder Nosy List abuehl, bos, cpbotha, djc, jglick, mpm, p.f.moore, pmezard
Assigned To mpm Topics casefolding, patch

Created on 2007-09-23.19:21:12 by pmezard, last changed 2008-07-25.11:50:26 by djc.

Files
File name Uploaded Type Edit Remove
issue750.patch p.f.moore, 2008-04-26.21:03:34 text/x-patch
update.patch pmezard, 2007-09-23.19:21:11 text/x-patch
Messages
msg6586 (view) Author: djc Date: 2008-07-25.11:50:26
In main, resolving.
msg6533 (view) Author: p.f.moore Date: 2008-07-19.11:12:10
Now in crew as changeset 482581431dcd
msg5991 (view) Author: p.f.moore Date: 2008-05-01.07:44:37
Fix posted to mercurial-devel as part of the patch series at
http://www.selenic.com/pipermail/mercurial-devel/2008-April/006078.html
msg5979 (view) Author: djc Date: 2008-04-28.15:05:11
Looks good to me.
msg5973 (view) Author: p.f.moore Date: 2008-04-26.21:30:23
This patch also fixes Issue912
msg5972 (view) Author: p.f.moore Date: 2008-04-26.21:03:34
While Patrick's patch is a bit too magical, it is correct in practical terms.
The problem is that a case-changing rename appears as a 'r' (remove) action and
a 'g' (get) action, on 2 files which only differ in case. These 2 actions may be
done in either order on a case-preserving system, but on a case-folding system
it is essential that the remove is done before the get.

I have attached a patch which sorts the list case insensitively on case-folding
systems. This keeps remove/get pairs on filenames that only differ in case, in
the right order. It fixes this issue, and does not introduce any test failures
on Windows.

(By the way, is it right that Mercurial code needs to stick with Python 2.3
compatibility? I assumed so, and used a comparison function rather than a key
function)
msg5862 (view) Author: abuehl Date: 2008-04-09.18:48:54
See also Issue1083 ("Case collision error between different revisions in history")
msg5797 (view) Author: cpbotha Date: 2008-04-01.20:59:13
C:\TEMP\hgtest>hg manifest
AAA.txt
aaa.txt

So it does seem to think that they're both there.  I have to conclude that
something goes wrong during the hgpullsvn, as AAA.txt really does not exist in
the current-most version.  See hgpullsvn.exe output:

C:\TEMP\hgtest>\Python25\Scripts\hgpullsvn.exe
* c:\apps\subversion\bin\svn.exe "info" "--xml" "."
* c:\apps\subversion\bin\svn.exe "info" "--xml"
"svn+ssh://cpbotha@luxemburg.twi.tudelft.nl/home/cpbotha/work/svn/testing/hgtest"
No revisions after 2 in SVN repo, nothing to do

and then:
C:\TEMP\hgtest>svn list
aaa.txt
msg5796 (view) Author: cpbotha Date: 2008-04-01.20:42:00
C:\TEMP\hgtest>hg manifest default
abort: unknown revision 'default'!

I have however managed to create a small test-case for others to test.  You can
download a small hgimportsvn repo from
http://visualisation.tudelft.nl/~cpbotha/thingies/hgtest.zip (5K)

Steps were:
1. create SVN repo on Linux, add AAA.txt, svn rename to aaa.txt, then commit
2. use hgimportsvn + hgpullsvn on Windows to create synced HG repo

If you unpack hgtest.zip on Windows, and use mercurial version
1e4ddc9ac9f7+20080325 (this was the 1.0 binary download) to do "hg update",
you'll get the feared: 
C:\TEMP\hgtest>hg update
abort: case-folding collision between aaa.txt and AAA.txt

Interestingly, if you do step 2 on Linux, then clone / copy the repo to Windows,
the error does not occur.

Thanks for looking into this!
msg5795 (view) Author: mpm Date: 2008-04-01.20:20:59
That really sounds like you have -both- names in the manifest you're trying to
update to.

Can you double-check 'hg manifest default'?
msg5793 (view) Author: cpbotha Date: 2008-04-01.19:47:29
Sure!

C:\work\code\hg\devide>hg co null
0 files updated, 0 files merged, 1197 files removed, 0 files unresolved

C:\work\code\hg\devide>hg update
abort: case-folding collision between devide/docs/help/devide.chm and
devide/docs/help/DeVIDE.chm

I tried it again, just to make sure:

C:\work\code\hg\devide>hg update
abort: case-folding collision between devide/docs/help/devide.chm and
devide/docs/help/DeVIDE.chm
msg5778 (view) Author: mpm Date: 2008-04-01.15:26:16
Can you do "hg co null" followed by an update?
msg5774 (view) Author: cpbotha Date: 2008-04-01.11:56:13
I am using mercurial (version 1e4ddc9ac9f7+20080325) on Windows XP SP2 to work from an hgsvn synchronised repository.  The problem is that I changed the case of a single filename a while back, and now hg is choking on this:

C:\work\code\hg\devide>hg update
abort: case-folding collision between devide/docs/help/devide.chm and devide/docs/help/DeVIDE.chm

Note that only the lowercase devide.chm still exists in this directory, I quadruple-checked.

UNLIKE the test cases below, repeated "hg update"s do NOT succeed.  Each time I do "hg update", I get exactly the same behaviour.  With my mercurial installation,  I can also reproduce the test cases below, and it does succeed after the second try.  

To reproduce on Windows (this takes a while and needs hgsvn):

mkdir dhelp
cd dhelp
hgimportsvn.exe http://devide.googlecode.com/svn/trunk/devide/docs/help/
cd help
hgpullsvn
hg update

I would appreciate any help on this.  I'm on my mobile phone connection at the moment, but if anyone's interested, I could tarball up a small mercurial repo with which one should be able to reproduce the problem more easily.
msg5083 (view) Author: abuehl Date: 2008-02-02.17:53:25
Similar to Issue912, simply repeating the last command succeeds:

> hg version
Mercurial Distributed SCM (version 9f1e6ab76069+tortoisehg)
...
> cd
C:\tmp\repos\testrepo
> hg init
> echo aaa >aaa.txt
> hg add
adding aaa.txt
> hg ci -m 1
> hg ren aaa.txt qqq
> hg ren qqq AAA.TXT
> hg ci -m 2
> hg update -C 0
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
> hg --traceback update -C 1
Traceback (most recent call last):
  File "mercurial\dispatch.pyc", line 45, in _runcatch
  File "mercurial\dispatch.pyc", line 360, in _dispatch
  File "mercurial\dispatch.pyc", line 413, in _runcommand
  File "mercurial\dispatch.pyc", line 369, in checkargs
  File "mercurial\dispatch.pyc", line 352, in <lambda>
  File "mercurial\commands.pyc", line 2650, in update
  File "mercurial\hg.pyc", line 286, in clean
  File "mercurial\merge.pyc", line 684, in update
  File "mercurial\merge.pyc", line 579, in recordupdates
  File "mercurial\dirstate.pyc", line 236, in normal
WindowsError: [Error 2] The system cannot find the file specified:
'C:\\tmp\\repos\\testrepo\\AAA.TXT'
abort: The system cannot find the file specified: C:\tmp\repos\testrepo\AAA.TXT
> hg --traceback update -C 1
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
msg5082 (view) Author: abuehl Date: 2008-02-02.17:34:32
See also:
Issue912 ("hg update fails on Windows if case of file changed in repo")
msg5080 (view) Author: abuehl Date: 2008-02-02.17:19:58
Repeating use case sequence with current TortoiseHg 0.3 (released on 2008-02-01):

> hg version
Mercurial Distributed SCM (version 9f1e6ab76069+tortoisehg)
...
> cd
C:\tmp\repos\testrepo
> hg init
> echo aaa >aaa.txt
> hg add
adding aaa.txt
> hg ci -m 1
> hg ren aaa.txt qqq
> hg ren qqq AAA.TXT
> hg ci -m 2
> hg update -C 0
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
> hg --traceback update -C 1
Traceback (most recent call last):
  File "mercurial\dispatch.pyc", line 45, in _runcatch
  File "mercurial\dispatch.pyc", line 360, in _dispatch
  File "mercurial\dispatch.pyc", line 413, in _runcommand
  File "mercurial\dispatch.pyc", line 369, in checkargs
  File "mercurial\dispatch.pyc", line 352, in <lambda>
  File "mercurial\commands.pyc", line 2650, in update
  File "mercurial\hg.pyc", line 286, in clean
  File "mercurial\merge.pyc", line 684, in update
  File "mercurial\merge.pyc", line 579, in recordupdates
  File "mercurial\dirstate.pyc", line 236, in normal
WindowsError: [Error 2] The system cannot find the file specified:
'C:\\tmp\\repos\\testrepo\\AAA.TXT'
abort: The system cannot find the file specified: C:\tmp\repos\testrepo\AAA.TXT
msg4443 (view) Author: mpm Date: 2007-12-02.21:22:49
Fixing title.

This fix is a bit too magical. And if we want removes to sort first, we can
simply change their key. This will also probably break cases where the move
needs a merge.

Perhaps we should do a silly-rename. That is: detect the rename collision,
rename to something silly, then do a fixup afterwards.
msg4034 (view) Author: pmezard Date: 2007-09-23.19:21:11
Posted by Andrei Vermel, with suggested patch attached:

C:\temp\aaa>hg version
Mercurial Distributed SCM (version 81575b7b505e)

Copyright (C) 2005-2007 Matt Mackall <mpm@selenic.com> and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

C:\temp\aaa>hg init
C:\temp\aaa>echo aaa >aaa.txt
C:\temp\aaa>hg add
adding aaa.txt
C:\temp\aaa>hg ci -m 1
C:\temp\aaa>hg ren aaa.txt qqq
C:\temp\aaa>hg ren qqq AAA.TXT
C:\temp\aaa>hg ci -m 2
C:\temp\aaa>hg update -C 0
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
C:\temp\aaa>hg --traceback update -C 1
Traceback (most recent call last):
  File "C:\Python24\Lib\site-packages\mercurial\dispatch.py", line 45, in _runcatch
    return _dispatch(ui, args)
  File "C:\Python24\Lib\site-packages\mercurial\dispatch.py", line 348, in _dispatch
    ret = _runcommand(ui, options, cmd, d)
  File "C:\Python24\Lib\site-packages\mercurial\dispatch.py", line 401, in
_runcommand
    return checkargs()
  File "C:\Python24\Lib\site-packages\mercurial\dispatch.py", line 357, in checkargs
    return cmdfunc()
  File "C:\Python24\Lib\site-packages\mercurial\dispatch.py", line 340, in <lambda>
    d = lambda: func(ui, repo, *args, **cmdoptions)
  File "C:\Python24\Lib\site-packages\mercurial\commands.py", line 2713, in update
    return hg.clean(repo, rev)
  File "C:\Python24\Lib\site-packages\mercurial\hg.py", line 273, in clean
    stats = _merge.update(repo, node, False, True, None)
  File "C:\Python24\Lib\site-packages\mercurial\merge.py", line 628, in update
    recordupdates(repo, action, branchmerge)
  File "C:\Python24\Lib\site-packages\mercurial\merge.py", line 526, in
recordupdates
    repo.dirstate.normal(f)
  File "C:\Python24\Lib\site-packages\mercurial\dirstate.py", line 221, in normal
    s = os.lstat(self._join(f))
OSError: [Errno 2] No such file or directory: 'C:\\temp\\aaa\\AAA.TXT'
abort: No such file or directory: C:\temp\aaa\AAA.TXT
History
Date User Action Args
2008-07-25 11:50:26djcsetstatus: testing -> resolved
nosy: mpm, bos, pmezard, p.f.moore, jglick, djc, abuehl, cpbotha
messages: + msg6586
2008-07-19 11:12:11p.f.mooresetstatus: chatting -> testing
nosy: mpm, bos, pmezard, p.f.moore, jglick, djc, abuehl, cpbotha
messages: + msg6533
2008-05-01 07:44:37p.f.mooresetnosy: mpm, bos, pmezard, p.f.moore, jglick, djc, abuehl, cpbotha
messages: + msg5991
2008-04-28 15:05:12djcsetnosy: + djc
messages: + msg5979
2008-04-26 21:30:23p.f.mooresetnosy: mpm, bos, pmezard, p.f.moore, jglick, abuehl, cpbotha
messages: + msg5973
2008-04-26 21:03:37p.f.mooresetfiles: + issue750.patch
nosy: + p.f.moore
messages: + msg5972
2008-04-09 18:48:54abuehlsetnosy: mpm, bos, pmezard, jglick, abuehl, cpbotha
messages: + msg5862
2008-04-01 20:59:13cpbothasetnosy: mpm, bos, pmezard, jglick, abuehl, cpbotha
messages: + msg5797
2008-04-01 20:42:00cpbothasetnosy: mpm, bos, pmezard, jglick, abuehl, cpbotha
messages: + msg5796
2008-04-01 20:20:59mpmsetnosy: mpm, bos, pmezard, jglick, abuehl, cpbotha
messages: + msg5795
2008-04-01 19:47:30cpbothasetnosy: mpm, bos, pmezard, jglick, abuehl, cpbotha
messages: + msg5793
2008-04-01 15:26:16mpmsetnosy: mpm, bos, pmezard, jglick, abuehl, cpbotha
messages: + msg5778
2008-04-01 11:56:13cpbothasetnosy: + cpbotha
messages: + msg5774
2008-03-18 21:55:48djcsettopic: + patch
nosy: mpm, bos, pmezard, jglick, abuehl
2008-03-17 19:44:14bossetnosy: + bos
2008-02-02 17:53:25abuehlsetnosy: mpm, pmezard, jglick, abuehl
messages: + msg5083
2008-02-02 17:34:32abuehlsetnosy: mpm, pmezard, jglick, abuehl
messages: + msg5082
2008-02-02 17:26:27abuehlsettopic: + casefolding
nosy: mpm, pmezard, jglick, abuehl
2008-02-02 17:19:59abuehlsetnosy: mpm, pmezard, jglick, abuehl
messages: + msg5080
2008-02-02 17:00:35abuehlsetnosy: + abuehl
2007-12-15 01:01:35jglicksetnosy: + jglick
2007-12-02 21:22:49mpmsetstatus: unread -> chatting
assignedto: mpm
messages: + msg4443
nosy: + mpm
title: Revisions with case-only renames cannot be checkout on case-aware systems -> Revisions with case-only renames cannot be checkout on case-folding systems
2007-09-23 19:21:12pmezardcreate