Re: [PATCH 7/8] git-p4: decode p4 wildcard characters
torarvid@gmail.com wrote on Tue, 08 Feb 2011 10:09 +0100:
Show 14 quoted lines
> On Sat, Feb 5, 2011 at 11:52 PM, Pete Wyckoff <pw@padd.com> wrote:
> > + # The p4 wildcards are not allowed in filenames. It complains
> > + # if you try to add them, but you can override with "-f", in
> > + # which case it translates them into %xx encoding. Search for
> > + # and fix just these four characters. Do % last so it does
> > + # not inadvertantly create new %-escapes.
> > + def wildcard_decode(self, path):
> > + path = path.replace("%23", "#") \
> > + .replace("%2A", "*") \
>
> This probably works fine on UNIX platforms, but the asterisk '*'
> character is not allowed in windows filenames. I don't really know
> what perforce does in that scenario. Does it make the most sense to
> just keep the %2A in the filename if we are running on windows (??)I changed it to do the "*" translation if not self.isWindows, so %2A will remain in the filename. Good that you noticed it.
Just for giggles, I found a windows VM to test perforce on. Built two files with different wildcards on a unix box, then pointed a windows client at it:
C:\DOCUME~1\ADMINI~1\DESKTOP>set P4PORT=192.168.2.1:1666
C:\DOCUME~1\ADMINI~1\DESKTOP>p4 files //depot/... //depot/file%25percent#1 - add change 1 (binary) //depot/file%2Astar#1 - add change 1 (binary)
C:\DOCUME~1\ADMINI~1\DESKTOP>p4 client Client soulfree saved.
C:\DOCUME~1\ADMINI~1\DESKTOP>p4 sync //depot/file%25percent#1 - added as c:\Documents and Settings\Administrator\Desktop\file%percent //depot/file%2Astar#1 - added as c:\Documents and Settings\Administrator\Desktop\file*star open for write: c:\Documents and Settings\Administrator\Desktop\file*star: The filename, directory name, or volume label syntax is incorrect.
And only the one file was synced to the windows client. So "*" is not well handled in perforce on windows anyway.
Docs are not helpful:
http://www.perforce.com/perforce/doc.current/manuals/cmdref/o.fspecs.html#1041962
For git, leaving a %2A in a filename is better than an error, I believe.
Thanks for the other acks.
-- Pete