mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1047592 - mercurial-setup should error when trying to read a config with %include. r=gps
This commit is contained in:
parent
b4e226068a
commit
ecc2933e4b
@ -16,6 +16,10 @@ HOST_FINGERPRINTS = {
|
||||
}
|
||||
|
||||
|
||||
class HgIncludeException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class MercurialConfig(object):
|
||||
"""Interface for manipulating a Mercurial config file."""
|
||||
|
||||
@ -35,6 +39,15 @@ class MercurialConfig(object):
|
||||
else:
|
||||
infile = None
|
||||
|
||||
# Mercurial configuration files allow an %include directive to include
|
||||
# other files, this is not supported by ConfigObj, so throw a useful
|
||||
# error saying this.
|
||||
with open(infile, 'r') as f:
|
||||
for line in f:
|
||||
if line.startswith('%include'):
|
||||
raise HgIncludeException(
|
||||
'%include directive is not supported by MercurialConfig')
|
||||
|
||||
# write_empty_values is necessary to prevent built-in extensions (which
|
||||
# have no value) from being dropped on write.
|
||||
# list_values aren't needed by Mercurial and disabling them prevents
|
||||
|
@ -23,6 +23,7 @@ from mozversioncontrol.repoupdate import (
|
||||
)
|
||||
|
||||
from .config import (
|
||||
HgIncludeException,
|
||||
HOST_FINGERPRINTS,
|
||||
MercurialConfig,
|
||||
)
|
||||
@ -195,6 +196,10 @@ class MercurialSetupWizard(object):
|
||||
print(error.message)
|
||||
|
||||
return 1
|
||||
except HgIncludeException as e:
|
||||
print(e.message)
|
||||
|
||||
return 1
|
||||
|
||||
print(INITIAL_MESSAGE)
|
||||
raw_input()
|
||||
|
Loading…
Reference in New Issue
Block a user