See if the move command exists, that it supports -k, and that it has not been administratively disabled. The arguments must be correct, but the filenames do not have to exist. Use ones with wildcards so even if they exist, it will fail.
()
| 425 | |
| 426 | |
| 427 | def p4_has_move_command(): |
| 428 | """See if the move command exists, that it supports -k, and that it has not |
| 429 | been administratively disabled. The arguments must be correct, but the |
| 430 | filenames do not have to exist. Use ones with wildcards so even if they |
| 431 | exist, it will fail. |
| 432 | """ |
| 433 | |
| 434 | if not p4_has_command("move"): |
| 435 | return False |
| 436 | cmd = p4_build_cmd(["move", "-k", "@from", "@to"]) |
| 437 | p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| 438 | out, err = p.communicate() |
| 439 | err = decode_text_stream(err) |
| 440 | # return code will be 1 in either case |
| 441 | if err.find("Invalid option") >= 0: |
| 442 | return False |
| 443 | if err.find("disabled") >= 0: |
| 444 | return False |
| 445 | # assume it failed because @... was invalid changelist |
| 446 | return True |
| 447 | |
| 448 | |
| 449 | def system(cmd, ignore_error=False, *k, **kw): |
no test coverage detected