Macro Scheduler with Git
Moderators: Dorian (MJT support), JRL
Macro Scheduler with Git
Hi everyone,
I've been using Macro Scheduler to develop bots for my company for quite a while now.
Currently our team is expanding and so does the amount of scripts that we have, for this reason we decided that we will need to use git for version control.
The problem with this is that git recognises .scp files as binary files, therefore, we are not able to see differences between the files using "git diff" command. We can force it to be shown using "git diff --text" but obviously that does not display the text in readable format.
I was wondering if anyone here already used MS with Git and could help me resolve this issue to view difference in .scp files. The only thing I can think of currently is to have a txt copy of each script, but I would prefer too see diff straight in the .scp files. Any ideas?
Thanks in advance.
I've been using Macro Scheduler to develop bots for my company for quite a while now.
Currently our team is expanding and so does the amount of scripts that we have, for this reason we decided that we will need to use git for version control.
The problem with this is that git recognises .scp files as binary files, therefore, we are not able to see differences between the files using "git diff" command. We can force it to be shown using "git diff --text" but obviously that does not display the text in readable format.
I was wondering if anyone here already used MS with Git and could help me resolve this issue to view difference in .scp files. The only thing I can think of currently is to have a txt copy of each script, but I would prefer too see diff straight in the .scp files. Any ideas?
Thanks in advance.
- Grovkillen
- Automation Wizard
- Posts: 1128
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: Macro Scheduler with Git
Shouldn't GitHub interpret any UTF-8 or ASCII as a text file?
Re: Macro Scheduler with Git
Hi Grovkillen, I checked what the character encoding of scp file is within notepad++. It appears to be "UCS-2 LE BOM" which is a 16-bit Unicode encoding.
Is there any setting that allows to change the character encoding to UTF-8 in Macro Scheduler files?
Is there any setting that allows to change the character encoding to UTF-8 in Macro Scheduler files?
- Grovkillen
- Automation Wizard
- Posts: 1128
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: Macro Scheduler with Git
If you open them in Notepad++ and change the document encoding, will it still revert that upon save in MS?
Re: Macro Scheduler with Git
Yes, I changed the encoding to "utf-8", saved script in MS, checked back in notepad++ and it was "ucs-2 le bom" again.
I went through whole of MS and couldn't find any setting for encoding, I've also been looking online for any git command that would change encoding for viewing differences between files, couldn't find any but found two CMD commands:
iconv -f UCS-2LE -t UTF-8 test-encoding.scp > test-encoding-2.scp
move /y test-encoding-2.scp test-encoding.scp
First one creates copy of file with encoding converted from "UCS-2 LE BOM" into "UTF-8 BOM". Second one makes the copy overwrite the original file. Files with this new encoding work properly with diff. I am thinking of creating a batch file that would convert all files in the directory this way. It would need to be ran each time before diff or push.
Unless you have any other ideas that might be better?
I went through whole of MS and couldn't find any setting for encoding, I've also been looking online for any git command that would change encoding for viewing differences between files, couldn't find any but found two CMD commands:
iconv -f UCS-2LE -t UTF-8 test-encoding.scp > test-encoding-2.scp
move /y test-encoding-2.scp test-encoding.scp
First one creates copy of file with encoding converted from "UCS-2 LE BOM" into "UTF-8 BOM". Second one makes the copy overwrite the original file. Files with this new encoding work properly with diff. I am thinking of creating a batch file that would convert all files in the directory this way. It would need to be ran each time before diff or push.
Unless you have any other ideas that might be better?
- Grovkillen
- Automation Wizard
- Posts: 1128
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: Macro Scheduler with Git
Hmm, perhaps Marcus could shed some light on this. I would like to know if the .SCP files need to be encoded as such or if it would be possible to have it changed in the settings.
So for your problem, yes I would also do a batch conversion like you suggested.
So for your problem, yes I would also do a batch conversion like you suggested.
Re: Macro Scheduler with Git
Thanks for your help, it would be nice if Marcus could have a look into it too.
- Marcus Tettmar
- Site Admin
- Posts: 7393
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Macro Scheduler with Git
Macro Scheduler script files are unicode. We don't offer a way to change that and if you do change the encoding you are likely to corrupt your scripts at worst and at best will not be able to see your code in the built in editor.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
- Grovkillen
- Automation Wizard
- Posts: 1128
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: Macro Scheduler with Git
So the best would then be to do a batch script that copy each file and perhaps give them the file extension of ".SCPGIT" or something. Thanks for the feedback Marcus.
Re: Macro Scheduler with Git
Adding:
*.scp text working-tree-encoding=UCS-2LE eol=CRLF
to the .gitattributes file seems to have done the trick. Ignore BOM.
This helped: https://stackoverflow.com/questions/281 ... inary-file
*.scp text working-tree-encoding=UCS-2LE eol=CRLF
to the .gitattributes file seems to have done the trick. Ignore BOM.
This helped: https://stackoverflow.com/questions/281 ... inary-file