From: Fredrik Kuivinen Date: Mon, 12 Sep 2005 21:29:54 GMT Subject: [PATCH 2/5] Exit with status code 2 if we get an exception. Message-ID: <20050912212954.GD6644@c165.ib.student.liu.se> In-Reply-To: <20050912212601.GB6644@c165.ib.student.liu.se> Signed-off-by: Fredrik Kuivinen --- git-merge-fredrik.py | 23 ++++++++++++++--------- 1 files changed, 14 insertions(+), 9 deletions(-) f814a54ac034f4455363582b2c2f3d386bf8f0be diff --git a/git-merge-fredrik.py b/git-merge-fredrik.py --- a/git-merge-fredrik.py +++ b/git-merge-fredrik.py @@ -1,6 +1,6 @@ #!/usr/bin/python -import sys, math, random, os, re, signal, tempfile, stat, errno +import sys, math, random, os, re, signal, tempfile, stat, errno, traceback from heapq import heappush, heappop from sets import Set @@ -409,15 +409,20 @@ for nextArg in xrange(1, len(sys.argv)): break print 'Merging', h1, 'with', h2 -h1 = runProgram(['git-rev-parse', '--verify', h1 + '^0']).rstrip() -h2 = runProgram(['git-rev-parse', '--verify', h2 + '^0']).rstrip() -graph = buildGraph([h1, h2]) - -[res, clean] = merge(graph.shaMap[h1], graph.shaMap[h2], - firstBranch, secondBranch, graph) - -print '' +try: + h1 = runProgram(['git-rev-parse', '--verify', h1 + '^0']).rstrip() + h2 = runProgram(['git-rev-parse', '--verify', h2 + '^0']).rstrip() + + graph = buildGraph([h1, h2]) + + [res, clean] = merge(graph.shaMap[h1], graph.shaMap[h2], + firstBranch, secondBranch, graph) + + print '' +except: + traceback.print_exc(None, sys.stderr) + sys.exit(2) if clean: sys.exit(0)