src/eric7/Plugins/VcsPlugins/vcsSubversion/SvnUtilities.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
16 16
17 17
18 def getServersPath(): 18 def getServersPath():
19 """ 19 """
20 Module function to get the filename of the servers file. 20 Module function to get the filename of the servers file.
21 21
22 @return filename of the servers file (string) 22 @return filename of the servers file (string)
23 """ 23 """
24 if Utilities.isWindowsPlatform(): 24 if Utilities.isWindowsPlatform():
25 appdata = os.environ["APPDATA"] 25 appdata = os.environ["APPDATA"]
26 return os.path.join(appdata, "Subversion", "servers") 26 return os.path.join(appdata, "Subversion", "servers")
30 30
31 31
32 def getConfigPath(): 32 def getConfigPath():
33 """ 33 """
34 Module function to get the filename of the config file. 34 Module function to get the filename of the config file.
35 35
36 @return filename of the config file (string) 36 @return filename of the config file (string)
37 """ 37 """
38 if Utilities.isWindowsPlatform(): 38 if Utilities.isWindowsPlatform():
39 appdata = os.environ["APPDATA"] 39 appdata = os.environ["APPDATA"]
40 return os.path.join(appdata, "Subversion", "config") 40 return os.path.join(appdata, "Subversion", "config")
62 try: 62 try:
63 with open(config, "r") as f: 63 with open(config, "r") as f:
64 configList = f.read().splitlines() 64 configList = f.read().splitlines()
65 except OSError: 65 except OSError:
66 return 66 return
67 67
68 newConfig = [] 68 newConfig = []
69 ignoresFound = False 69 ignoresFound = False
70 amendList = [] 70 amendList = []
71 for line in configList: 71 for line in configList:
72 if line.find("global-ignores") in [0, 2]: 72 if line.find("global-ignores") in [0, 2]:
92 for amend in oldAmends: 92 for amend in oldAmends:
93 if amend not in line: 93 if amend not in line:
94 amendList.append(amend) 94 amendList.append(amend)
95 else: 95 else:
96 newConfig.append(line) 96 newConfig.append(line)
97 97
98 if newConfig != configList: 98 if newConfig != configList:
99 with contextlib.suppress(OSError), open(config, "w") as f: 99 with contextlib.suppress(OSError), open(config, "w") as f:
100 f.write("\n".join(newConfig)) 100 f.write("\n".join(newConfig))

eric ide

mercurial