Skip to content

Commit

Permalink
hg-to-git: abort if the project directory is not a hg repo
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Miklos Vajna authored and Junio C Hamano committed Jul 6, 2008
1 parent 6376cff commit 2553ede
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion contrib/hg-to-git/hg-to-git.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ def getgitenv(user, date):
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

Expand Down

0 comments on commit 2553ede

Please sign in to comment.