eric6/Plugins/VcsPlugins/vcsPySvn/SvnUtilities.py

changeset 7785
9978016560ec
parent 7780
41420f82c0ac
child 7836
2f0d208b8137
equal deleted inserted replaced
7784:3257703e10c5 7785:9978016560ec
76 try: 76 try:
77 os.makedirs(os.path.dirname(config)) 77 os.makedirs(os.path.dirname(config))
78 except OSError: 78 except OSError:
79 pass 79 pass
80 try: 80 try:
81 f = open(config, "w") 81 with open(config, "w") as f:
82 f.write(DefaultConfig) 82 f.write(DefaultConfig)
83 f.close()
84 except IOError: 83 except IOError:
85 pass 84 pass
86 85
87 86
88 def amendConfig(): 87 def amendConfig():
89 """ 88 """
90 Module function to amend the config file. 89 Module function to amend the config file.
91 """ 90 """
92 config = getConfigPath() 91 config = getConfigPath()
93 try: 92 try:
94 f = open(config, "r") 93 with open(config, "r") as f:
95 configList = f.read().splitlines() 94 configList = f.read().splitlines()
96 f.close()
97 except IOError: 95 except IOError:
98 return 96 return
99 97
100 newConfig = [] 98 newConfig = []
101 ignoresFound = False 99 ignoresFound = False
127 else: 125 else:
128 newConfig.append(line) 126 newConfig.append(line)
129 127
130 if newConfig != configList: 128 if newConfig != configList:
131 try: 129 try:
132 f = open(config, "w") 130 with open(config, "w") as f:
133 f.write("\n".join(newConfig)) 131 f.write("\n".join(newConfig))
134 f.close()
135 except IOError: 132 except IOError:
136 pass 133 pass

eric ide

mercurial