From: Miklos Vajna Date: Sun, 6 Jul 2008 03:15:18 +0000 (+0200) Subject: hg-to-git: abort if the project directory is not a hg repo X-Git-Tag: v1.6.0-rc0~131 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2553ede5a9b09260be69de72b60e5038f5452c44;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/contrib/hg-to-git/hg-to-git.py b/contrib/hg-to-git/hg-to-git.py index 25d99411c..130b1c4bc 100755 --- a/contrib/hg-to-git/hg-to-git.py +++ b/contrib/hg-to-git/hg-to-git.py @@ -106,7 +106,10 @@ if state: else: print 'State does not exist, first run' -tip = os.popen('hg tip --template "{rev}"').read() +sock = os.popen('hg tip --template "{rev}"') +tip = sock.read() +if sock.close(): + sys.exit(1) if verbose: print 'tip is', tip