e.stages[stage].mode = mode
e.stages[stage].sha1 = sha1
else:
- print 'Error: Merge program failed: Unexpected output from', \
- 'git-ls-files:', l
- sys.exit(2)
+ die('Error: Merge program failed: Unexpected output from', \
+ 'git-ls-files:', l)
return res
def mergeTrees(head, merge, common, branch1Name, branch2Name,
os.unlink(src1)
os.unlink(src2)
else:
- print 'ERROR: Fatal merge failure.'
- print "ERROR: Shouldn't happen"
- sys.exit(2)
+ die("ERROR: Fatal merge failure, shouldn't happen.")
return cleanMerge
def usage():
- print 'Usage:', sys.argv[0], ' <base>... -- <head> <remote>..'
- sys.exit(2)
+ die('Usage:', sys.argv[0], ' <base>... -- <head> <remote>..')
# main entry point as merge strategy module
# The first parameters up to -- are merge bases, and the rest are heads.
# This strategy module figures out merge bases itself, so we only
# get heads.
+if len(sys.argv) < 4:
+ usage()
+
for nextArg in xrange(1, len(sys.argv)):
if sys.argv[nextArg] == '--':
if len(sys.argv) != nextArg + 3:
- print 'Not handling anything other than two heads merge.'
- sys.exit(2)
+ die('Not handling anything other than two heads merge.')
try:
h1 = firstBranch = sys.argv[nextArg + 1]
h2 = secondBranch = sys.argv[nextArg + 2]