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

Function p4_has_move_command

git-p4.py:427–446  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

425
426
427def 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
449def system(cmd, ignore_error=False, *k, **kw):

Callers 1

__init__Method · 0.85

Calls 3

p4_has_commandFunction · 0.85
p4_build_cmdFunction · 0.85
decode_text_streamFunction · 0.85

Tested by

no test coverage detected