eric6/Plugins/VcsPlugins/vcsSubversion/SvnUtilities.py

changeset 7785
9978016560ec
parent 7780
41420f82c0ac
child 7836
2f0d208b8137
equal deleted inserted replaced
7784:3257703e10c5 7785:9978016560ec
50 try: 50 try:
51 os.makedirs(os.path.dirname(config)) 51 os.makedirs(os.path.dirname(config))
52 except OSError: 52 except OSError:
53 pass 53 pass
54 try: 54 try:
55 f = open(config, "w") 55 with open(config, "w") as f:
56 f.write(DefaultConfig) 56 f.write(DefaultConfig)
57 f.close()
58 except IOError: 57 except IOError:
59 pass 58 pass
60 59
61 60
62 def amendConfig(): 61 def amendConfig():
63 """ 62 """
64 Module function to amend the config file. 63 Module function to amend the config file.
65 """ 64 """
66 config = getConfigPath() 65 config = getConfigPath()
67 try: 66 try:
68 f = open(config, "r") 67 with open(config, "r") as f:
69 configList = f.read().splitlines() 68 configList = f.read().splitlines()
70 f.close()
71 except IOError: 69 except IOError:
72 return 70 return
73 71
74 newConfig = [] 72 newConfig = []
75 ignoresFound = False 73 ignoresFound = False
101 else: 99 else:
102 newConfig.append(line) 100 newConfig.append(line)
103 101
104 if newConfig != configList: 102 if newConfig != configList:
105 try: 103 try:
106 f = open(config, "w") 104 with open(config, "w") as f:
107 f.write("\n".join(newConfig)) 105 f.write("\n".join(newConfig))
108 f.close()
109 except IOError: 106 except IOError:
110 pass 107 pass

eric ide

mercurial