]> git.ipfire.org Git - thirdparty/git.git/commitdiff
hg-to-git: abort if the project directory is not a hg repo
authorMiklos Vajna <vmiklos@frugalware.org>
Sun, 6 Jul 2008 03:15:18 +0000 (05:15 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 6 Jul 2008 06:35:11 +0000 (23:35 -0700)
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>
contrib/hg-to-git/hg-to-git.py

index 25d99411ca5d2ff8d7296cb9a70c6d0bdd0b934a..130b1c4bcda98354dd1b599bc2a4788985fa6beb 100755 (executable)
@@ -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