MCPcopy Create free account
hub / github.com/git/git / wildcard_decode

Function wildcard_decode

git-p4.py:1423–1440  ·  view source on GitHub ↗

Decode P4 wildcards into %xx encoding P4 wildcards are not allowed in filenames. P4 complains if you simply add them, but you can force it with "-f", in which case it translates them into %xx encoding internally.

(path)

Source from the content-addressed store, hash-verified

1421
1422
1423def wildcard_decode(path):
1424 """Decode P4 wildcards into %xx encoding
1425
1426 P4 wildcards are not allowed in filenames. P4 complains if you simply
1427 add them, but you can force it with "-f", in which case it translates
1428 them into %xx encoding internally.
1429 """
1430
1431 # Search for and fix just these four characters. Do % last so
1432 # that fixing it does not inadvertently create new %-escapes.
1433 # Cannot have * in a filename in windows; untested as to
1434 # what p4 would do in such a case.
1435 if not platform.system() == "Windows":
1436 path = path.replace("%2A", "*")
1437 path = path.replace("%23", "#") \
1438 .replace("%40", "@") \
1439 .replace("%25", "%")
1440 return path
1441
1442
1443def wildcard_encode(path):

Callers 1

stripRepoPathMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected