Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Perforce workaround to add files with '@'

Tags:

By design, Perforce does not allow filenames with wildcards @#%* be added. It is giving this error:

Can't add filenames with wildcards [@#%*] in them.
Use -f option to force add.

However, I have SASS files that have @ on them to support mixins. For example:

[email protected]
[email protected]

What is the best workaround to have these files added to Perforce, with most minimal disruption on checkin, checkout, compile, build, and deploy flow ?

like image 824
Jeson Martajaya Avatar asked Jun 21 '16 19:06

Jeson Martajaya


1 Answers

You can add files with Perforce wildcard characters in them. As the 'p4 help add' page documents:

To add files with filenames that contain wildcard characters, specify the -f flag. Filenames that contain the special characters '@', '#', '%' or '*' are reformatted to encode the characters using ASCII hexadecimal representation. After the files are added, you must refer to them using the reformatted file name, because Perforce does not recognize the local filesystem name.

The requirement to uniformly refer to the filename from then on using the encoded '%40' is annoying, I agree, but it does work.

Here's a short example:

$ touch '[email protected]'
$ p4 add '[email protected]'
The file named '[email protected]' contains wildcards [@#%*].
Can't add filenames with wildcards [@#%*] in them.
Use -f option to force add.
$ p4 add -f '[email protected]'
//depot/carbon-fiber-%402X.png#1 - opened for add
/path/to/[email protected] - empty, assuming text.
$ p4 submit -d added-carbon-fibre
Submitting change 2.
Locking 1 files ...
add //depot/carbon-fiber-%402X.png#1
Change 2 submitted.
$ p4 files //...
//depot/carbon-fiber-%402X.png#1 - add change 2 (text)
$ p4 fstat //depot/carbon-fiber-%402X.png
... depotFile //depot/carbon-fiber-%402X.png
... clientFile /path/to/[email protected]
... isMapped 
... headAction add
... headType text
... headTime 1466547058
... headRev 1
... headChange 2
... headModTime 1466547033
... haveRev 1
like image 171
Bryan Pendleton Avatar answered Sep 28 '22 03:09

Bryan Pendleton