Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows & Mercurial change cases of class names

I have inherited a Java project which includes a number of classes that are not named according to the UpperCamelCase naming convention.

This is particularly the case with abbreviations (e.g. HTMLButton rather than HtmlButton). Whilst I know there are some differences of opinion on the use of CamelCase with abbreviations, we would like to switch to only using a capital letter for the first letter of the abbreviation. (Currently, there appear to be several simultaneous naming conventions.)

I'd like to tidy this up. We're using Mercurial as our source code repository and working on Windows machines (including XP, Vista, 7). However, if I change a class name from HTMLButton to HtmlButton, Mercurial recognises this as a class name change, but not as a file name change. (And subsequently any pulls from Mercurial don't pick up the file name change.)

I know that Windows works on a case-insenstive file system, and I understand that Mercurial picks up on this feature when accepting pushes from a Windows box...

So...: - Is there a setting I can change to get Mercurial to use case-sensitive file names? - Is there a setting I can change to get Windows to use case-sensitive file names? (These are separate questions. My priority is to get Mercurial to accept file name changes, if necessary, we can then manually force file renames in our IDE. However, a straight-through solution would be preferred!)

(If all else fails, I might try renaming HTMLButton to HtmlButtonA, commit and push, and rename HtmlButtonA to HtmlButton, and do another commit and push... However, I'm not certain what impact this would have on Windows file names if someone else only did a pull after the second push...)

like image 949
amaidment Avatar asked Sep 09 '11 13:09

amaidment


1 Answers

If you do:

hg rename foo bar
hg rename bar Foo

You don't need to actually commit and push until the end. In other words, your repository won't be aware of this Windows-specific workaround.

Another option is to rename the file in Windows, then invoke:

hg rename foo Foo --after

to notify Mercurial of the change.

Source: http://hgbook.red-bean.com/read/mercurial-in-daily-use.html#id364064

like image 93
Gili Avatar answered Oct 05 '22 23:10

Gili