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

branch
eric7
changeset 10403
ea3320d5e8e9
parent 10373
093dcebe5ecb
child 10438
4cd7e5a8b3cf
equal deleted inserted replaced
10402:1b63ffeca110 10403:ea3320d5e8e9
214 cwdIsPpath = False 214 cwdIsPpath = False
215 if os.getcwd() == project.ppath: 215 if os.getcwd() == project.ppath:
216 os.chdir(os.path.dirname(project.ppath)) 216 os.chdir(os.path.dirname(project.ppath))
217 cwdIsPpath = True 217 cwdIsPpath = True
218 tmpProjectDir = "{0}_tmp".format(project.ppath) 218 tmpProjectDir = "{0}_tmp".format(project.ppath)
219 shutil.rmtree(tmpProjectDir, True) 219 shutil.rmtree(tmpProjectDir, ignore_errors=True)
220 os.rename(project.ppath, tmpProjectDir) 220 os.rename(project.ppath, tmpProjectDir)
221 os.makedirs(project.ppath) 221 os.makedirs(project.ppath)
222 self.vcsCheckout(vcsDataDict, project.ppath) 222 self.vcsCheckout(vcsDataDict, project.ppath)
223 if cwdIsPpath: 223 if cwdIsPpath:
224 os.chdir(project.ppath) 224 os.chdir(project.ppath)
239 if os.getcwd() == project.ppath: 239 if os.getcwd() == project.ppath:
240 os.chdir(os.path.dirname(project.ppath)) 240 os.chdir(os.path.dirname(project.ppath))
241 cwdIsPpath = True 241 cwdIsPpath = True
242 else: 242 else:
243 cwdIsPpath = False 243 cwdIsPpath = False
244 shutil.rmtree(project.ppath, True) 244 shutil.rmtree(project.ppath, ignore_errors=True)
245 os.rename(tmpProjectDir, project.ppath) 245 os.rename(tmpProjectDir, project.ppath)
246 project.setProjectData("None", dataKey="VCS") 246 project.setProjectData("None", dataKey="VCS")
247 project.vcs = None 247 project.vcs = None
248 project.setDirty(True) 248 project.setDirty(True)
249 project.saveProject() 249 project.saveProject()
250 project.closeProject() 250 project.closeProject()
251 return 251 return
252 shutil.rmtree(tmpProjectDir, True) 252 shutil.rmtree(tmpProjectDir, ignore_errors=True)
253 project.closeProject(noSave=True) 253 project.closeProject(noSave=True)
254 project.openProject(pfn) 254 project.openProject(pfn)
255 255
256 def vcsImport( 256 def vcsImport(
257 self, vcsDataDict, projectDir, noDialog=False, addAll=True # noqa: U100 257 self, vcsDataDict, projectDir, noDialog=False, addAll=True # noqa: U100
296 shutil.copytree(projectDir, os.path.join(tmpDir, project, "trunk")) 296 shutil.copytree(projectDir, os.path.join(tmpDir, project, "trunk"))
297 else: 297 else:
298 shutil.copytree(projectDir, os.path.join(tmpDir, project)) 298 shutil.copytree(projectDir, os.path.join(tmpDir, project))
299 except OSError: 299 except OSError:
300 if os.path.isdir(tmpDir): 300 if os.path.isdir(tmpDir):
301 shutil.rmtree(tmpDir, True) 301 shutil.rmtree(tmpDir, ignore_errors=True)
302 return False, False 302 return False, False
303 303
304 cwd = os.getcwd() 304 cwd = os.getcwd()
305 os.chdir(os.path.join(tmpDir, project)) 305 os.chdir(os.path.join(tmpDir, project))
306 opts = self.options["global"] 306 opts = self.options["global"]
331 ) 331 )
332 dlg.finish() 332 dlg.finish()
333 dlg.exec() 333 dlg.exec()
334 os.chdir(cwd) 334 os.chdir(cwd)
335 335
336 shutil.rmtree(tmpDir, True) 336 shutil.rmtree(tmpDir, ignore_errors=True)
337 return status, False 337 return status, False
338 338
339 def vcsCheckout(self, vcsDataDict, projectDir, noDialog=False): 339 def vcsCheckout(self, vcsDataDict, projectDir, noDialog=False):
340 """ 340 """
341 Public method used to check the project out of the Subversion 341 Public method used to check the project out of the Subversion

eric ide

mercurial