git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 7/8] git-p4: decode p4 wildcard characters

From
PWPete Wyckoff <pw@padd.com>
Date
Feb 8, 2011, 23:26 UTC
Message-ID
<20110208232606.GA32491@arf.padd.com>
In-Reply-To
<AANLkTi=Gah9yeYYnHPZ2Z6-OZQ2-CU5Kub=o5SqWAXht@mail.gmail.com>
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
Previous: Tor Arvid LundNext: Pete Wyckoff
Message 16 of 18 in “git-p4 fixes and enhancements”
  1. 0/8 git-p4 fixes and enhancementsPete Wyckoff, Feb 5, 2011
  2. 1/8 git-p4: test scriptPete Wyckoff, Feb 5, 2011
  3. Vitor AntunesFeb 6, 2011
  4. Junio C HamanoFeb 7, 2011
  5. Pete WyckoffFeb 7, 2011
  6. 2/8 git-p4: fix key error for p4 problemPete Wyckoff, Feb 5, 2011
  7. 3/8 git-p4: add missing newline in initial import messagePete Wyckoff, Feb 5, 2011
  8. Tor Arvid LundFeb 8, 2011
  9. 4/8 git-p4: accommodate new move/delete type in p4Pete Wyckoff, Feb 5, 2011
  10. Tor Arvid LundFeb 8, 2011
  11. 5/8 git-p4: reinterpret confusing p4 messagePete Wyckoff, Feb 5, 2011
  12. 6/8 git-p4: better message for "git-p4 sync" when not clonedPete Wyckoff, Feb 5, 2011
  13. Tor Arvid LundFeb 8, 2011
  14. 7/8 git-p4: decode p4 wildcard charactersPete Wyckoff, Feb 5, 2011
  15. Tor Arvid LundFeb 8, 2011
  16. Pete WyckoffFeb 8, 2011
  17. 8/8 git-p4: support clone --barePete Wyckoff, Feb 5, 2011
  18. Tor Arvid LundFeb 8, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.