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

branch
eric7
changeset 10403
ea3320d5e8e9
parent 10373
093dcebe5ecb
child 10438
4cd7e5a8b3cf
equal deleted inserted replaced
10402:1b63ffeca110 10403:ea3320d5e8e9
225 cwdIsPpath = False 225 cwdIsPpath = False
226 if os.getcwd() == project.ppath: 226 if os.getcwd() == project.ppath:
227 os.chdir(os.path.dirname(project.ppath)) 227 os.chdir(os.path.dirname(project.ppath))
228 cwdIsPpath = True 228 cwdIsPpath = True
229 tmpProjectDir = "{0}_tmp".format(project.ppath) 229 tmpProjectDir = "{0}_tmp".format(project.ppath)
230 shutil.rmtree(tmpProjectDir, True) 230 shutil.rmtree(tmpProjectDir, ignore_errors=True)
231 os.rename(project.ppath, tmpProjectDir) 231 os.rename(project.ppath, tmpProjectDir)
232 os.makedirs(project.ppath) 232 os.makedirs(project.ppath)
233 self.vcsCheckout(vcsDataDict, project.ppath) 233 self.vcsCheckout(vcsDataDict, project.ppath)
234 if cwdIsPpath: 234 if cwdIsPpath:
235 os.chdir(project.ppath) 235 os.chdir(project.ppath)
250 if os.getcwd() == project.ppath: 250 if os.getcwd() == project.ppath:
251 os.chdir(os.path.dirname(project.ppath)) 251 os.chdir(os.path.dirname(project.ppath))
252 cwdIsPpath = True 252 cwdIsPpath = True
253 else: 253 else:
254 cwdIsPpath = False 254 cwdIsPpath = False
255 shutil.rmtree(project.ppath, True) 255 shutil.rmtree(project.ppath, ignore_errors=True)
256 os.rename(tmpProjectDir, project.ppath) 256 os.rename(tmpProjectDir, project.ppath)
257 project.setProjectData("None", dataKey="VCS") 257 project.setProjectData("None", dataKey="VCS")
258 project.vcs = None 258 project.vcs = None
259 project.setDirty(True) 259 project.setDirty(True)
260 project.saveProject() 260 project.saveProject()
261 project.closeProject() 261 project.closeProject()
262 return 262 return
263 shutil.rmtree(tmpProjectDir, True) 263 shutil.rmtree(tmpProjectDir, ignore_errors=True)
264 project.closeProject(noSave=True) 264 project.closeProject(noSave=True)
265 project.openProject(pfn) 265 project.openProject(pfn)
266 266
267 def vcsImport( 267 def vcsImport(
268 self, vcsDataDict, projectDir, noDialog=False, addAll=True # noqa: U100 268 self, vcsDataDict, projectDir, noDialog=False, addAll=True # noqa: U100
307 shutil.copytree(projectDir, os.path.join(tmpDir, project, "trunk")) 307 shutil.copytree(projectDir, os.path.join(tmpDir, project, "trunk"))
308 else: 308 else:
309 shutil.copytree(projectDir, os.path.join(tmpDir, project)) 309 shutil.copytree(projectDir, os.path.join(tmpDir, project))
310 except OSError: 310 except OSError:
311 if os.path.isdir(tmpDir): 311 if os.path.isdir(tmpDir):
312 shutil.rmtree(tmpDir, True) 312 shutil.rmtree(tmpDir, ignore_errors=True)
313 return False, False 313 return False, False
314 314
315 args = [] 315 args = []
316 args.append("import") 316 args.append("import")
317 self.addArguments(args, self.options["global"]) 317 self.addArguments(args, self.options["global"])
328 res = dia.startProcess(args, os.path.join(tmpDir, project)) 328 res = dia.startProcess(args, os.path.join(tmpDir, project))
329 if res: 329 if res:
330 dia.exec() 330 dia.exec()
331 status = dia.normalExit() 331 status = dia.normalExit()
332 332
333 shutil.rmtree(tmpDir, True) 333 shutil.rmtree(tmpDir, ignore_errors=True)
334 return status, False 334 return status, False
335 335
336 def vcsCheckout(self, vcsDataDict, projectDir, noDialog=False): 336 def vcsCheckout(self, vcsDataDict, projectDir, noDialog=False):
337 """ 337 """
338 Public method used to check the project out of the Subversion 338 Public method used to check the project out of the Subversion

eric ide

mercurial