3

I have a JS compressed file which is long about 14k and it is on one single line. This creates some problem on Clear Case, making check in impossible

Is there a way to fix clearcase?

If I whant to split the JS file on multiple lines, should I pay attention to something when inserting line breaks. Obviously I won't split a string or anumber, after that any other non obvious thing to keep in mind?

Paolo
  • 2,461
  • 5
  • 31
  • 45

3 Answers3

4

The other solution would be to change the type of your compressed JS file to... "compressed_file":

cleartool chtype Compressed_file

That way, you wouldn't have to modify your file.
See "Clearcase issue while “add file to source control”" for more on that technique.

You can also specify the merge manager to always copy over that file when merged, to avoid any merge issue. See "Clearcase UCM is trying to merge pdf files".

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Actually it is a compressed js into a JSP file. Anyway good idea. I can always put the JS outside the jsp – Paolo Sep 10 '12 at 12:02
  • @Paolo yes, isolating the issue in its own file would be best, as it would allow the Version Control tool to manage it more appropriately (`compressed_file`) – VonC Sep 10 '12 at 12:03
1

I don't know about ClearCase. A safe place to split is after a ; or } outside of a string constant since there shouldn't be any comments in compressed JS.

You can also split the file manually; the file probably doesn't change often and 10 line feeds more or less won't hurt the performance.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
0

Yes, line-breaks have a syntactic meaning in JS. A javascript instruction is terminated either by a semicolon or a line-break (or, what's usually the case, both). When the whole script was written without linebreaks, the only way to separate the instructions were semicolons. So when you add a line-break after every semicolon, the syntactical meaning should stay the same.

But are you sure that you should check-in the compressed Javascript code and not the original, uncompressed version? Especially when you have to edit it to do so? Artifacts, like compiled binaries, usually don't belong into version control. A compressed JS file should also be treated like that, in my opinion.

Philipp
  • 67,764
  • 9
  • 118
  • 153