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)
| 1421 | |
| 1422 | |
| 1423 | def 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 | |
| 1443 | def wildcard_encode(path): |