Fix traceback in salt.fileserver.hgfs.init()

Older versions of hglib did not raise an exception when no refs were
found. This commit catches the exception, fixing a traceback that
prevents new remotes from ever being fetched for the first time.
This commit is contained in:
Erik Johnson 2015-02-21 23:26:14 -06:00 committed by C. R. Oldham
parent 3c51b3116c
commit c83e558728

View File

@ -253,7 +253,14 @@ def init():
)
continue
refs = repo.config(names='paths')
try:
refs = repo.config(names='paths')
except hglib.error.CommandError:
refs = None
# Do NOT put this if statement inside the except block above. Earlier
# versions of hglib did not raise an exception, so we need to do it
# this way to support both older and newer hglib.
if not refs:
# Write an hgrc defining the remote URI
hgconfpath = os.path.join(rp_, '.hg', 'hgrc')