Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial convert changes line endings?

I'm using the Mercurial Convert extension to import data from a PerForce repository. The conversion appears to have worked correctly, but all the Windows line endings (CRLF) were replaced by unix endings (LF).

Is there a way to get this extension to leave the line endings alone?

like image 678
NBS Avatar asked Mar 22 '11 21:03

NBS


2 Answers

While the conversion itself may change the eol style, you still can, in your new Hg repo, specify what eol you want to see for certain types of files on checkout:
See EolExtension.

When working with people on different operating systems, it can therefore be desirable to be able to checkout text files with the operating system native line ending representation.
This extension lets you specify how end of lines (EOLs) are converted between the repository representation and the working copy representation.

like image 126
VonC Avatar answered Oct 08 '22 05:10

VonC


I was able to do what I wanted using the "Perfarce" extension for Mercurial. The line endings for the mercurial repository will follow the settings of the "LineEnd" property of the Perforce workspace you are using. The steps were the following (on Windows):

  • Clone the Perfarce repository (https://www.mercurial-scm.org/wiki/PerfarceExtension)
  • In the mercurial.ini file of your user folder, add the configuration information described https://www.mercurial-scm.org/wiki/PerfarceExtension
  • Create a Perforce workspace that maps desired parts of the Perforce repository to the root folder for the workspace on the local computer
  • Update the local workspace
  • Open a command line at the parent folder of the desired mercurial repository folder
  • set P4PASSWD=your_perforce_password
  • set P4USER=your_perforce_username
  • hg clone p4://perforce_server_ip:perforce_server_port/your_perforce_workspace_name destination_folder

The resulting hgrc file for this repository is set up to pull additional changes from the Perforce repository, so it could conceivably be used on an ongoing basis, but I didn't use that.

like image 21
NBS Avatar answered Oct 08 '22 04:10

NBS