Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial ignores a file rename (changing case)

Tags:

mercurial

I'm working with a project I inherited from a Windows guy. It's under Hg version control. It got some inconsistent filename convention which I'm trying to fix so I renamed a file named jquery.fullpage.js to jquery.fullPage.js (just uppercased "P") to adhere to the original author of that jQuery library.

However, Hg doesn't detect the lowercase-uppercase change as a rename or even as deleted/created file. As a result, I can't commit that change and push it live. It works locally but on the remote staging server where I pushed, it gives 404 errors. Apparently, the files on the remote weren't renamed to the uppercase P.

I know I can fix this by deleting the file, commit, restore the file and rename, commit again but that seems to be a crude way of fixing it.

How do I fix this?

like image 671
Noel Llevares Avatar asked Dec 13 '13 20:12

Noel Llevares


People also ask

Does renaming a file change it?

Renaming a file doesn't change when it was modified.


2 Answers

This is a case folding problem. Try to rename the file through Mercurial: hg rename jquery.fullpage.js jquery.fullPage.js.

like image 53
Jakub Jirutka Avatar answered Sep 20 '22 13:09

Jakub Jirutka


If you're renaming a file you are good to go with hg rename as already said.

However (at least on Windows), if you're renaming a folder then you can't rename it directly. The common workaround is to use an intermediate:

hg rename Foo tmp
hg rename tmp foo

Another workaround is using intermediate delete. But this is discouraged because you would lose the file history.

like image 27
Luboš Turek Avatar answered Sep 21 '22 13:09

Luboš Turek