Skip to content

Commit 2553ede

Browse files
Miklos Vajnagitster
authored andcommitted
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>
1 parent 6376cff commit 2553ede

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

contrib/hg-to-git/hg-to-git.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ def getgitenv(user, date):
106106
else:
107107
print 'State does not exist, first run'
108108

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)
110113
if verbose:
111114
print 'tip is', tip
112115

0 commit comments

Comments
 (0)