hg-to-git: abort if the project directory is not a hg repo
Check the exit code of the first hg command, and abort to avoid a later ValueError exception. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Miklos Vajna committed
Jul 6, 2008 at 05:15 UTC
2553ede5a9b09260be69de72b60e5038f5452c44
1 file changed
+4
-1
contrib/hg-to-git/hg-to-git.py
+4
-1
@@ -106,7 +106,10 @@ if state:
106
else:
107
print 'State does not exist, first run'
108
109
-tip = os.popen('hg tip --template "{rev}"').read()
109
+sock = os.popen('hg tip --template "{rev}"')
110
+tip = sock.read()
111
+if sock.close():
112
+ sys.exit(1)
113
if verbose:
114
print 'tip is', tip
115