Search code examples
mercurialeol

How to make previous commits with EOL issues consistent in Mercurial


We have a Mercurial repository with a standard of using Unix-style line endings.

If a user hasn't noticed EOL issues when committing a file - they may be 'helpfully' hidden by the diff tool - then it's a pain to fix down the line unless it's noticed immediately.

Is there a way to use "hg convert" (or similar) to re-create the repository with consistent line endings?


Solution

  • There's no easy way to do it, but you could use hg transplant with the --filter option to reapply those changesets in a corrected form and then hg strip the wrong ones. It'll be enough of a hassle that you'll probably put a pretxnchangegroup hook on your centralish repo to prevent folks from pushing them in the future.