##// END OF EJS Templates
ui: use try..finally in configoverride...
Gregory Szorc -
r30537:4b0e6677 default
parent child Browse files
Show More
@@ -1201,16 +1201,18 b' class ui(object):'
1201 `overrides` must be a dict of the following structure:
1201 `overrides` must be a dict of the following structure:
1202 {(section, name) : value}"""
1202 {(section, name) : value}"""
1203 backups = {}
1203 backups = {}
1204 for (section, name), value in overrides.items():
1204 try:
1205 backups[(section, name)] = self.backupconfig(section, name)
1205 for (section, name), value in overrides.items():
1206 self.setconfig(section, name, value, source)
1206 backups[(section, name)] = self.backupconfig(section, name)
1207 yield
1207 self.setconfig(section, name, value, source)
1208 for __, backup in backups.items():
1208 yield
1209 self.restoreconfig(backup)
1209 finally:
1210 # just restoring ui.quiet config to the previous value is not enough
1210 for __, backup in backups.items():
1211 # as it does not update ui.quiet class member
1211 self.restoreconfig(backup)
1212 if ('ui', 'quiet') in overrides:
1212 # just restoring ui.quiet config to the previous value is not enough
1213 self.fixconfig(section='ui')
1213 # as it does not update ui.quiet class member
1214 if ('ui', 'quiet') in overrides:
1215 self.fixconfig(section='ui')
1214
1216
1215 class paths(dict):
1217 class paths(dict):
1216 """Represents a collection of paths and their configs.
1218 """Represents a collection of paths and their configs.
General Comments 0
You need to be logged in to leave comments. Login now