Bug 3576 - hg commit requires the exact case stored by add on Windows
Summary: hg commit requires the exact case stored by add on Windows
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: earlier
Hardware: All All
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-07 13:38 UTC by Teddy
Modified: 2017-11-01 18:05 UTC (History)
8 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Teddy 2012-08-07 13:38 UTC
C:\ugs\CMM\8>hg version
Mercurial Distributed SCM (version 2.3)
(see http://mercurial.selenic.com for more information)

Copyright (C) 2005-2012 Matt Mackall 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:\ugs\CMM\8>hg init

C:\ugs\CMM\8>hg add Config\cmmConfig.xml

C:\ugs\CMM\8>hg commit config\cmmConfig.cmd
abort: config/cmmConfig.cmd: file not tracked!

C:\ugs\CMM\8>hg commit Config\cmmConfig.xml
abort: empty commit message

C:\ugs\CMM\8>hg commit config\cmmconfig.xml
abort: config/cmmconfig.xml: file not tracked!


Should commit either way on windows. 
-----------------------------------------------------------------------------


C:\Users\ideasadm\test>hg version
Mercurial Distributed SCM (version 2.2.1)
(see http://mercurial.selenic.com for more information)


Copyright (C) 2005-2012 Matt Mackall 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:\Users\ideasadm>hg version
Mercurial Distributed SCM (version 2.2.1)
(see http://mercurial.selenic.com for more information)

Copyright (C) 2005-2012 Matt Mackall 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:\Users\ideasadm>mkdir test

C:\Users\ideasadm>mkdir test\Config\

C:\Users\ideasadm>echo "Hello" > test\Config\config.xml

C:\Users\ideasadm>cd test

C:\Users\ideasadm\test>hg add config\config.xml
adding Config\config.xml

C:\Users\ideasadm\test>hg commit Config\config.xml

C:\Users\ideasadm\test>hg init

-------------------------------------------------------------------------------
Works fine in 2.2.1
Comment 1 Teddy 2012-08-07 13:40 UTC
Pardon my poor copy and paste in the second example. I put the text in before the init command, but you get the idea.
Comment 2 Nikolaj Sjujskij 2012-08-07 13:43 UTC
Could you bisect the issue to find out which changese had introduced this regression?
Comment 3 Teddy 2012-08-07 16:05 UTC
(In reply to comment #2)

Perhaps later tonight (After 8PM EDT)
Comment 4 Teddy 2012-08-07 21:28 UTC
Issue is not a regression. I rolled back to 1.9 and the behavior is consistent. 

Real issue differs somewhat from original classification. When using commit to commit individual files, the case used to specify the file must match the exact windows case (output by the add command). 

Add allows file names with any case to be added. Mercurial then emits the actual name of the added file back to the user. 

For commit to be successful, when specifying a single file to commit, The case must match the case of the file exactly. e.g.


Config\AddMeToTheRepo.txt

hg add config\addmetotherepo.txt
adding Config/AddMeToTheRepo.txt

hg commit -m "really!?" config\addmetotherepo.txt # fails
abort:  config/addmetotherepo.txt: file not tracked!

hg commit -m "really!?" Config\addMetoTherepo.txt # fails
abort:  Config/addMetoTherepo.txt: file not tracked!

hg commit -m "exact path" Config/AddMeToTheRepo.txt #success


Long story short, on the Windows platform I'd expect to be lazy with the capitalization for the commit command as well as with the add command.
Comment 5 Bryan O'Sullivan 2012-08-14 10:32 UTC
This seems to affect all OSes if the filesystem is case insensitive but preserving. I can repro it on OS X, too.
Comment 6 Matt Mackall 2012-08-17 15:45 UTC
I've queued this fix for stable:

diff -r c6f88e7f95b7 mercurial/localrepo.py
--- a/mercurial/localrepo.py	Sat Aug 11 12:45:53 2012 -0500
+++ b/mercurial/localrepo.py	Fri Aug 17 14:34:44 2012 -0500
@@ -1312,6 +1312,7 @@
                 matched = set(changes[0] + changes[1] + changes[2])
 
                 for f in match.files():
+                    f = self.dirstate.normalize(f)
                     if f == '.' or f in matched or f in wctx.substate:
                         continue
                     if f in changes[3]: # missing
Comment 7 HG Bot 2012-08-21 14:01 UTC
Fixed by http://selenic.com/repo/hg/rev/b05e517c2236
Matt Mackall <mpm@selenic.com>
commit: normalize filenames when checking explicit files (issue3576)

(please test the fix)
Comment 8 Matt Mackall 2012-09-30 16:19 UTC
Mass close old bugs in testing.