209 "Select version control system for the project"), |
209 "Select version control system for the project"), |
210 vcsSystemsDisplay, |
210 vcsSystemsDisplay, |
211 0, False) |
211 0, False) |
212 if not ok: |
212 if not ok: |
213 return |
213 return |
|
214 |
|
215 selectedVcsSystem = None |
214 for vcsSystem, vcsSystemDisplay in list(vcsSystemsDict.items()): |
216 for vcsSystem, vcsSystemDisplay in list(vcsSystemsDict.items()): |
215 if vcsSystemDisplay == vcsSelected: |
217 if vcsSystemDisplay == vcsSelected: |
|
218 selectedVcsSystem = vcsSystem |
216 break |
219 break |
217 |
220 |
218 if not self.project.closeProject(): |
221 if not self.project.closeProject(): |
219 return |
222 return |
220 |
223 |
221 vcs = self.project.initVCS(vcsSystem) |
224 vcs = self.project.initVCS(selectedVcsSystem) |
222 if vcs is not None: |
225 if vcs is not None: |
223 vcsdlg = vcs.vcsNewProjectOptionsDialog() |
226 vcsdlg = vcs.vcsNewProjectOptionsDialog() |
224 if vcsdlg.exec_() == QDialog.Accepted: |
227 if vcsdlg.exec_() == QDialog.Accepted: |
225 projectdir, vcsDataDict = vcsdlg.getData() |
228 projectdir, vcsDataDict = vcsdlg.getData() |
226 # edit VCS command options |
229 # edit VCS command options |
403 "Select version control system for the project"), |
406 "Select version control system for the project"), |
404 vcsSystemsDisplay, |
407 vcsSystemsDisplay, |
405 0, False) |
408 0, False) |
406 if not ok: |
409 if not ok: |
407 return |
410 return |
|
411 |
|
412 selectedVcsSystem = None |
408 for vcsSystem, vcsSystemDisplay in list(vcsSystemsDict.items()): |
413 for vcsSystem, vcsSystemDisplay in list(vcsSystemsDict.items()): |
409 if vcsSystemDisplay == vcsSelected: |
414 if vcsSystemDisplay == vcsSelected: |
|
415 selectedVcsSystem = vcsSystem |
410 break |
416 break |
411 |
417 |
412 self.project.pdata["VCS"] = vcsSystem |
418 if selectedVcsSystem is not None: |
413 self.project.vcs = self.project.initVCS(vcsSystem) |
419 self.project.pdata["VCS"] = selectedVcsSystem |
414 if self.project.vcs is not None: |
420 self.project.vcs = self.project.initVCS(selectedVcsSystem) |
415 vcsdlg = self.project.vcs.vcsOptionsDialog(self.project, |
421 if self.project.vcs is not None: |
416 self.project.name, 1) |
422 vcsdlg = self.project.vcs.vcsOptionsDialog( |
417 if vcsdlg.exec_() == QDialog.Accepted: |
423 self.project, self.project.name, 1) |
418 vcsDataDict = vcsdlg.getData() |
424 if vcsdlg.exec_() == QDialog.Accepted: |
419 # edit VCS command options |
425 vcsDataDict = vcsdlg.getData() |
420 if self.project.vcs.vcsSupportCommandOptions(): |
426 # edit VCS command options |
421 vcores = E5MessageBox.yesNo( |
427 if self.project.vcs.vcsSupportCommandOptions(): |
422 self.parent(), |
428 vcores = E5MessageBox.yesNo( |
423 QCoreApplication.translate( |
429 self.parent(), |
424 "VcsProjectHelper", "Import Project"), |
430 QCoreApplication.translate( |
425 QCoreApplication.translate( |
431 "VcsProjectHelper", "Import Project"), |
426 "VcsProjectHelper", |
432 QCoreApplication.translate( |
427 """Would you like to edit the VCS command""" |
433 "VcsProjectHelper", |
428 """ options?""")) |
434 """Would you like to edit the VCS command""" |
|
435 """ options?""")) |
|
436 else: |
|
437 vcores = False |
|
438 if vcores: |
|
439 from .CommandOptionsDialog import \ |
|
440 VcsCommandOptionsDialog |
|
441 codlg = VcsCommandOptionsDialog(self.project.vcs) |
|
442 if codlg.exec_() == QDialog.Accepted: |
|
443 self.project.vcs.vcsSetOptions(codlg.getOptions()) |
|
444 self.project.setDirty(True) |
|
445 self.project.vcs.vcsSetDataFromDict(vcsDataDict) |
|
446 self.project.saveProject() |
|
447 isVcsControlled = self.project.vcs.vcsImport( |
|
448 vcsDataDict, self.project.ppath)[0] |
|
449 if isVcsControlled: |
|
450 # reopen the project |
|
451 self.project.openProject(self.project.pfile) |
|
452 else: |
|
453 # revert the changes to the local project |
|
454 # because the project dir is not a VCS directory |
|
455 revertChanges() |
429 else: |
456 else: |
430 vcores = False |
457 # revert the changes because user cancelled |
431 if vcores: |
|
432 from .CommandOptionsDialog import VcsCommandOptionsDialog |
|
433 codlg = VcsCommandOptionsDialog(self.project.vcs) |
|
434 if codlg.exec_() == QDialog.Accepted: |
|
435 self.project.vcs.vcsSetOptions(codlg.getOptions()) |
|
436 self.project.setDirty(True) |
|
437 self.project.vcs.vcsSetDataFromDict(vcsDataDict) |
|
438 self.project.saveProject() |
|
439 isVcsControlled = self.project.vcs.vcsImport( |
|
440 vcsDataDict, self.project.ppath)[0] |
|
441 if isVcsControlled: |
|
442 # reopen the project |
|
443 self.project.openProject(self.project.pfile) |
|
444 else: |
|
445 # revert the changes to the local project |
|
446 # because the project dir is not a VCS directory |
|
447 revertChanges() |
458 revertChanges() |
448 else: |
|
449 # revert the changes because user cancelled |
|
450 revertChanges() |
|
451 |
459 |
452 def _vcsUpdate(self): |
460 def _vcsUpdate(self): |
453 """ |
461 """ |
454 Protected slot used to update the local project from the repository. |
462 Protected slot used to update the local project from the repository. |
455 """ |
463 """ |