1588
"work from a local git branch that is not master"),
1589
optparse.make_option("--disable-p4sync", dest="disable_p4sync", action="store_true",
1590
help="Skip Perforce sync of p4/master after submit or shelve"),
1591
+ optparse.make_option("--no-verify", dest="no_verify", action="store_true",
1592
+ help="Bypass p4-pre-submit"),
1593
]
1594
self.description = """Submit changes from git to the perforce depot.\n
1593
- The `p4-pre-submit` hook is executed if it exists and is executable.
1594
- The hook takes no parameters and nothing from standard input. Exiting with
1595
- non-zero status from this script prevents `git-p4 submit` from launching.
1595
+ The `p4-pre-submit` hook is executed if it exists and is executable. It
1596
+ can be bypassed with the `--no-verify` command line option. The hook takes
1597
+ no parameters and nothing from standard input. Exiting with a non-zero status
1598
+ from this script prevents `git-p4 submit` from launching.
1599
1597
- One usage scenario is to run unit tests in the hook."""
1600
+ One usage scenario is to run unit tests in the hook.
1601
+ """
1602
1603
self.usage += " [name of git branch to submit into perforce depot]"
1604
self.origin = ""
1616
self.exportLabels = False
1617
self.p4HasMoveCommand = p4_has_move_command()
1618
self.branch = None
1619
+ self.no_verify = False
1620
1621
if gitConfig('git-p4.largeFileSystem'):
1622
die("Large file system not supported for git-p4 submit command. Please remove it from config.")
2410
sys.exit("number of commits (%d) must match number of shelved changelist (%d)" %
2411
(len(commits), num_shelves))
2412
2408
- try:
2409
- if not run_git_hook("p4-pre-submit"):
2410
- print("\nThe p4-pre-submit hook failed, aborting the submit.\n\nYou can skip " \
2411
- "this pre-submission check by adding\nthe command line option '--no-verify', " \
2412
- "however,\nthis will also skip the p4-changelist hook as well.")
2413
+ if not self.no_verify:
2414
+ try:
2415
+ if not run_git_hook("p4-pre-submit"):
2416
+ print("\nThe p4-pre-submit hook failed, aborting the submit.\n\nYou can skip " \
2417
+ "this pre-submission check by adding\nthe command line option '--no-verify', " \
2418
+ "however,\nthis will also skip the p4-changelist hook as well.")
2419
+ sys.exit(1)
2420
+ except Exception as e:
2421
+ print("\nThe p4-pre-submit hook failed, aborting the submit.\n\nThe hook failed "\
2422
+ "with the error '{0}'".format(e.message) )
2423
sys.exit(1)
2414
- except Exception as e:
2415
- print("\nThe p4-pre-submit hook failed, aborting the submit.\n\nThe hook failed "\
2416
- "with the error '{0}'".format(e.message) )
2417
- sys.exit(1)
2424
2425
#
2426
# Apply the commits, one at a time. On failure, ask if should