Jump to content

Text files vs. binary files


JakubH

Recommended Posts

I'm not entirely clear about a mechanism for handling text vs. binary files.

First of all, what is the effect of selecting a file as a text? Is it only the possibility to merge and diff that file, or is it handled differently (in a more effective way) in the repo?

When I set a file type to text, is it set now as a text for all future AND past revisions of that file?

Is it set for all users or just me?

How can be the type set? Are these the only options:

- A type of a specific file is set automatically by Plastic according to an extension – comparing with a build-in extensions list

- A type of a specific file is set automatically by Plastic according to an extension – defined in a %LOCALAPPDATA%\plastic4\filetypes.conf

- A type of a specific file is set manually by a user (through GUI or command line)

Can be set a global filetypes.conf or per user only?

Can be set some masks in filetypes.conf or extensions only?

It would be great if filetypes.conf can be used the same way as ignore.conf, cloaked.conf and hidden_changes.conf – per repository, with easy distribution among users, with masks. But unfortunately it probably works in a different way.

I've found only the following information:

http://www.plasticsc...-files-as-text/

http://codicesoftwar...file-types.html

Thank you very much for any help!

Link to comment
Share on other sites

Let's go! :)

First of all, what is the effect of selecting a file as a text? Is it only the possibility to merge and diff that file, or is it handled differently (in a more effective way) in the repo?

In repository terms, there's no difference between a text file and a bin file.

The only difference is in the difference/merge tool that will be appear during the merge and diff operation. The binaries are going to be opened with the "binmergetool" and the text are going to be opened with the "mergetool"

When I set a file type to text, is it set now as a text for all future AND past revisions of that file?

Is it set for all users or just me?

For all the users and for all the revisions.

How can be the type set? Are these the only options:

- A type of a specific file is set automatically by Plastic according to an extension – comparing with a build-in extensions list

- A type of a specific file is set automatically by Plastic according to an extension – defined in a %LOCALAPPDATA%\plastic4\filetypes.conf

- A type of a specific file is set manually by a user (through GUI or command line)

If you are not coming from a fast-import process the file type is calculated in the Add operation, it's pretty accurate so you should never need to change the type.

If you need to I do recommend you to use the following command:

dir /S mydir\*.cshtml | cm crt -type=txt

or

FOR /F "tokens=*" %%i IN ('dir /S /B *.cshtml') DO cm chgrevtype %%i -type=txt

Can be set a global filetypes.conf or per user only?

Can be set some masks in filetypes.conf or extensions only?

It would be great if filetypes.conf can be used the same way as ignore.conf, cloaked.conf and hidden_changes.conf – per repository, with easy distribution among users, with masks. But unfortunately it probably works in a different way.

I've found only the following information:

http://www.plasticsc...-files-as-text/

http://codicesoftwar...file-types.html

Thank you very much for any help!

If you place the "filetypes.conf" file in the "C:\Users\Xxxxx\AppData\Local\plastic4" directory the rules should be applied for all your workspaces. If it's not working like I say we need to change it.

The format of the file is "extension:type" I'm afraid that regular expressions are not allows.

Link to comment
Share on other sites

Perfect! Thank you for your answers.

Just one more question:

If you are not coming from a fast-import process the file type is calculated in the Add operation, it's pretty accurate so you should never need to change the type.

My files actually do come from fast-import. Is there any difference? There are files which were marked as binary, even though they are pure XML.

As I've said already, it may be better, if filetypes.conf worked the same way as ignore.conf. But I think I can live with that. Maybe I add it to uservoice. I need more votes. :P

Link to comment
Share on other sites

Yep, as your files are coming from the fast-import process they are not recognized as the real text files they are.

Why? Just performance... We can not afford read the fast-import files, it will take time. So, only the well known files are recognized as Text files -> Yes, we should include XML into the well known list. :)

I do recommend to change all your XML files with the:

FOR /F "tokens=*" %%i IN ('dir /S /B *.cshtml') DO cm chgrevtype %%i -type=txt

batch sentence.

Link to comment
Share on other sites

  • 4 years later...

Hello

My plastic scm is recognising .jsx files as binary, they are reactjs components and should be seen as text.

On the mac version it appears that filetypes.conf is located at ~/.plastic4/filetypes.conf

and I have added the rule to this file

.jsx:txt

but there is no change in the status of the files, they still appear as bin type in the pending changes window, even after restarting the app and even restarting my computer, no change.

can you help as I have rather a lot of .jsx files in this project.

Thank you

 

James

 

Link to comment
Share on other sites

Hello @zz_james

the filetypes rule will be only useful for new jsx files that are not part of the repository and will be added to Plastic.

If they are already added then you will need to change its type. This is an example using windows:

FOR /F "tokens=*" %%i IN ('dir /S /B *.jsx') DO cm chgrevtype %%i -type=txt

You can script the same thing for Mac or Linux, at the end fo the day it comes through using the "chgrevtype" command.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...