summaryrefslogtreecommitdiff
path: root/contrib/hg-to-git/hg-to-git.py
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2008-07-06 03:15:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-07-06 06:35:11 (GMT)
commit2553ede5a9b09260be69de72b60e5038f5452c44 (patch)
treea78a971e64e281e309cc337134ba9e48fcbe4dee /contrib/hg-to-git/hg-to-git.py
parent6376cffaebe40947eea9afb4ae6df05a6ac59ae8 (diff)
downloadgit-2553ede5a9b09260be69de72b60e5038f5452c44.zip
git-2553ede5a9b09260be69de72b60e5038f5452c44.tar.gz
git-2553ede5a9b09260be69de72b60e5038f5452c44.tar.bz2
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>
Diffstat (limited to 'contrib/hg-to-git/hg-to-git.py')
-rwxr-xr-xcontrib/hg-to-git/hg-to-git.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/contrib/hg-to-git/hg-to-git.py b/contrib/hg-to-git/hg-to-git.py
index 25d9941..130b1c4 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