19 from E5Gui.E5Action import E5Action |
19 from E5Gui.E5Action import E5Action |
20 |
20 |
21 import UI.PixmapCache |
21 import UI.PixmapCache |
22 import Preferences |
22 import Preferences |
23 |
23 |
|
24 |
24 class HgProjectHelper(VcsProjectHelper): |
25 class HgProjectHelper(VcsProjectHelper): |
25 """ |
26 """ |
26 Class implementing the VCS project helper for Mercurial. |
27 Class implementing the VCS project helper for Mercurial. |
27 """ |
28 """ |
28 def __init__(self, vcsObject, projectObject, parent = None, name = None): |
29 def __init__(self, vcsObject, projectObject, parent=None, name=None): |
29 """ |
30 """ |
30 Constructor |
31 Constructor |
31 |
32 |
32 @param vcsObject reference to the vcs object |
33 @param vcsObject reference to the vcs object |
33 @param projectObject reference to the project object |
34 @param projectObject reference to the project object |
162 """remote repository using the 'force' option.</p>""" |
163 """remote repository using the 'force' option.</p>""" |
163 )) |
164 )) |
164 self.hgPushForcedAct.triggered[()].connect(self.__hgPushForced) |
165 self.hgPushForcedAct.triggered[()].connect(self.__hgPushForced) |
165 self.actions.append(self.hgPushForcedAct) |
166 self.actions.append(self.hgPushForcedAct) |
166 |
167 |
167 self.vcsExportAct = E5Action(self.trUtf8('Export from repository'), |
168 self.vcsExportAct = E5Action(self.trUtf8('Export from repository'), |
168 UI.PixmapCache.getIcon("vcsExport.png"), |
169 UI.PixmapCache.getIcon("vcsExport.png"), |
169 self.trUtf8('&Export from repository...'), |
170 self.trUtf8('&Export from repository...'), |
170 0, 0, self, 'subversion_export') |
171 0, 0, self, 'subversion_export') |
171 self.vcsExportAct.setStatusTip(self.trUtf8( |
172 self.vcsExportAct.setStatusTip(self.trUtf8( |
172 'Export a project from the repository' |
173 'Export a project from the repository' |
371 """<p>This resolves all conflicts of the local project.</p>""" |
372 """<p>This resolves all conflicts of the local project.</p>""" |
372 )) |
373 )) |
373 self.vcsResolveAct.triggered[()].connect(self.__hgResolve) |
374 self.vcsResolveAct.triggered[()].connect(self.__hgResolve) |
374 self.actions.append(self.vcsResolveAct) |
375 self.actions.append(self.vcsResolveAct) |
375 |
376 |
376 self.vcsTagAct = E5Action(self.trUtf8('Tag in repository'), |
377 self.vcsTagAct = E5Action(self.trUtf8('Tag in repository'), |
377 UI.PixmapCache.getIcon("vcsTag.png"), |
378 UI.PixmapCache.getIcon("vcsTag.png"), |
378 self.trUtf8('&Tag in repository...'), |
379 self.trUtf8('&Tag in repository...'), |
379 0, 0, self, 'mercurial_tag') |
380 0, 0, self, 'mercurial_tag') |
380 self.vcsTagAct.setStatusTip(self.trUtf8( |
381 self.vcsTagAct.setStatusTip(self.trUtf8( |
381 'Tag the local project in the repository' |
382 'Tag the local project in the repository' |
385 """<p>This tags the local project in the repository.</p>""" |
386 """<p>This tags the local project in the repository.</p>""" |
386 )) |
387 )) |
387 self.vcsTagAct.triggered[()].connect(self._vcsTag) |
388 self.vcsTagAct.triggered[()].connect(self._vcsTag) |
388 self.actions.append(self.vcsTagAct) |
389 self.actions.append(self.vcsTagAct) |
389 |
390 |
390 self.hgTagListAct = E5Action(self.trUtf8('List tags'), |
391 self.hgTagListAct = E5Action(self.trUtf8('List tags'), |
391 self.trUtf8('List tags...'), |
392 self.trUtf8('List tags...'), |
392 0, 0, self, 'mercurial_list_tags') |
393 0, 0, self, 'mercurial_list_tags') |
393 self.hgTagListAct.setStatusTip(self.trUtf8( |
394 self.hgTagListAct.setStatusTip(self.trUtf8( |
394 'List tags of the project' |
395 'List tags of the project' |
395 )) |
396 )) |
398 """<p>This lists the tags of the project.</p>""" |
399 """<p>This lists the tags of the project.</p>""" |
399 )) |
400 )) |
400 self.hgTagListAct.triggered[()].connect(self.__hgTagList) |
401 self.hgTagListAct.triggered[()].connect(self.__hgTagList) |
401 self.actions.append(self.hgTagListAct) |
402 self.actions.append(self.hgTagListAct) |
402 |
403 |
403 self.hgBranchListAct = E5Action(self.trUtf8('List branches'), |
404 self.hgBranchListAct = E5Action(self.trUtf8('List branches'), |
404 self.trUtf8('List branches...'), |
405 self.trUtf8('List branches...'), |
405 0, 0, self, 'mercurial_list_branches') |
406 0, 0, self, 'mercurial_list_branches') |
406 self.hgBranchListAct.setStatusTip(self.trUtf8( |
407 self.hgBranchListAct.setStatusTip(self.trUtf8( |
407 'List branches of the project' |
408 'List branches of the project' |
408 )) |
409 )) |
411 """<p>This lists the branches of the project.</p>""" |
412 """<p>This lists the branches of the project.</p>""" |
412 )) |
413 )) |
413 self.hgBranchListAct.triggered[()].connect(self.__hgBranchList) |
414 self.hgBranchListAct.triggered[()].connect(self.__hgBranchList) |
414 self.actions.append(self.hgBranchListAct) |
415 self.actions.append(self.hgBranchListAct) |
415 |
416 |
416 self.hgBranchAct = E5Action(self.trUtf8('Create branch'), |
417 self.hgBranchAct = E5Action(self.trUtf8('Create branch'), |
417 UI.PixmapCache.getIcon("vcsBranch.png"), |
418 UI.PixmapCache.getIcon("vcsBranch.png"), |
418 self.trUtf8('Create &branch...'), |
419 self.trUtf8('Create &branch...'), |
419 0, 0, self, 'mercurial_branch') |
420 0, 0, self, 'mercurial_branch') |
420 self.hgBranchAct.setStatusTip(self.trUtf8( |
421 self.hgBranchAct.setStatusTip(self.trUtf8( |
421 'Create a new branch for the local project in the repository' |
422 'Create a new branch for the local project in the repository' |
426 """in the repository.</p>""" |
427 """in the repository.</p>""" |
427 )) |
428 )) |
428 self.hgBranchAct.triggered[()].connect(self.__hgBranch) |
429 self.hgBranchAct.triggered[()].connect(self.__hgBranch) |
429 self.actions.append(self.hgBranchAct) |
430 self.actions.append(self.hgBranchAct) |
430 |
431 |
431 self.hgCloseBranchAct = E5Action(self.trUtf8('Close branch'), |
432 self.hgCloseBranchAct = E5Action(self.trUtf8('Close branch'), |
432 self.trUtf8('Close branch'), |
433 self.trUtf8('Close branch'), |
433 0, 0, self, 'mercurial_close_branch') |
434 0, 0, self, 'mercurial_close_branch') |
434 self.hgCloseBranchAct.setStatusTip(self.trUtf8( |
435 self.hgCloseBranchAct.setStatusTip(self.trUtf8( |
435 'Close the current branch of the local project' |
436 'Close the current branch of the local project' |
436 )) |
437 )) |
439 """<p>This closes the current branch of the local project.</p>""" |
440 """<p>This closes the current branch of the local project.</p>""" |
440 )) |
441 )) |
441 self.hgCloseBranchAct.triggered[()].connect(self.__hgCloseBranch) |
442 self.hgCloseBranchAct.triggered[()].connect(self.__hgCloseBranch) |
442 self.actions.append(self.hgCloseBranchAct) |
443 self.actions.append(self.hgCloseBranchAct) |
443 |
444 |
444 self.hgShowBranchAct = E5Action(self.trUtf8('Show current branch'), |
445 self.hgShowBranchAct = E5Action(self.trUtf8('Show current branch'), |
445 self.trUtf8('Show current branch'), |
446 self.trUtf8('Show current branch'), |
446 0, 0, self, 'mercurial_show_branch') |
447 0, 0, self, 'mercurial_show_branch') |
447 self.hgShowBranchAct.setStatusTip(self.trUtf8( |
448 self.hgShowBranchAct.setStatusTip(self.trUtf8( |
448 'Show the current branch of the project' |
449 'Show the current branch of the project' |
449 )) |
450 )) |
493 )) |
494 )) |
494 self.vcsCommandAct.triggered[()].connect(self._vcsCommand) |
495 self.vcsCommandAct.triggered[()].connect(self._vcsCommand) |
495 self.actions.append(self.vcsCommandAct) |
496 self.actions.append(self.vcsCommandAct) |
496 |
497 |
497 self.vcsPropsAct = E5Action(self.trUtf8('Command options'), |
498 self.vcsPropsAct = E5Action(self.trUtf8('Command options'), |
498 self.trUtf8('Command &options...'),0,0,self, |
499 self.trUtf8('Command &options...'), 0, 0, self, |
499 'mercurial_options') |
500 'mercurial_options') |
500 self.vcsPropsAct.setStatusTip(self.trUtf8('Show the Mercurial command options')) |
501 self.vcsPropsAct.setStatusTip(self.trUtf8('Show the Mercurial command options')) |
501 self.vcsPropsAct.setWhatsThis(self.trUtf8( |
502 self.vcsPropsAct.setWhatsThis(self.trUtf8( |
502 """<b>Command options...</b>""" |
503 """<b>Command options...</b>""" |
503 """<p>This shows a dialog to edit the Mercurial command options.</p>""" |
504 """<p>This shows a dialog to edit the Mercurial command options.</p>""" |
788 bisectMenu.addAction(self.hgBisectSkipAct) |
789 bisectMenu.addAction(self.hgBisectSkipAct) |
789 bisectMenu.addAction(self.hgBisectResetAct) |
790 bisectMenu.addAction(self.hgBisectResetAct) |
790 |
791 |
791 act = menu.addAction( |
792 act = menu.addAction( |
792 UI.PixmapCache.getIcon( |
793 UI.PixmapCache.getIcon( |
793 os.path.join("VcsPlugins", "vcsMercurial", "icons", "mercurial.png")), |
794 os.path.join("VcsPlugins", "vcsMercurial", "icons", "mercurial.png")), |
794 self.vcs.vcsName(), self._vcsInfoDisplay) |
795 self.vcs.vcsName(), self._vcsInfoDisplay) |
795 font = act.font() |
796 font = act.font() |
796 font.setBold(True) |
797 font.setBold(True) |
797 act.setFont(font) |
798 act.setFont(font) |
798 menu.addSeparator() |
799 menu.addSeparator() |
884 shouldReopen = self.vcs.hgPull(self.project.ppath) |
885 shouldReopen = self.vcs.hgPull(self.project.ppath) |
885 if shouldReopen: |
886 if shouldReopen: |
886 res = E5MessageBox.yesNo(self.parent(), |
887 res = E5MessageBox.yesNo(self.parent(), |
887 self.trUtf8("Pull"), |
888 self.trUtf8("Pull"), |
888 self.trUtf8("""The project should be reread. Do this now?"""), |
889 self.trUtf8("""The project should be reread. Do this now?"""), |
889 yesDefault = True) |
890 yesDefault=True) |
890 if res: |
891 if res: |
891 self.project.reopenProject() |
892 self.project.reopenProject() |
892 |
893 |
893 def __hgPush(self): |
894 def __hgPush(self): |
894 """ |
895 """ |
899 def __hgPushForced(self): |
900 def __hgPushForced(self): |
900 """ |
901 """ |
901 Private slot used to push changes to a remote repository using |
902 Private slot used to push changes to a remote repository using |
902 the force option. |
903 the force option. |
903 """ |
904 """ |
904 self.vcs.hgPush(self.project.ppath, force = True) |
905 self.vcs.hgPush(self.project.ppath, force=True) |
905 |
906 |
906 def __hgHeads(self): |
907 def __hgHeads(self): |
907 """ |
908 """ |
908 Private slot used to show the heads of the repository. |
909 Private slot used to show the heads of the repository. |
909 """ |
910 """ |
910 self.vcs.hgInfo(self.project.ppath, mode = "heads") |
911 self.vcs.hgInfo(self.project.ppath, mode="heads") |
911 |
912 |
912 def __hgParents(self): |
913 def __hgParents(self): |
913 """ |
914 """ |
914 Private slot used to show the parents of the repository. |
915 Private slot used to show the parents of the repository. |
915 """ |
916 """ |
916 self.vcs.hgInfo(self.project.ppath, mode = "parents") |
917 self.vcs.hgInfo(self.project.ppath, mode="parents") |
917 |
918 |
918 def __hgTip(self): |
919 def __hgTip(self): |
919 """ |
920 """ |
920 Private slot used to show the tip of the repository. |
921 Private slot used to show the tip of the repository. |
921 """ |
922 """ |
922 self.vcs.hgInfo(self.project.ppath, mode = "tip") |
923 self.vcs.hgInfo(self.project.ppath, mode="tip") |
923 |
924 |
924 def __hgResolve(self): |
925 def __hgResolve(self): |
925 """ |
926 """ |
926 Private slot used to resolve conflicts of the local project. |
927 Private slot used to resolve conflicts of the local project. |
927 """ |
928 """ |
963 """ |
964 """ |
964 if Preferences.getVCS("AutoSaveProject"): |
965 if Preferences.getVCS("AutoSaveProject"): |
965 self.project.saveProject() |
966 self.project.saveProject() |
966 if Preferences.getVCS("AutoSaveFiles"): |
967 if Preferences.getVCS("AutoSaveFiles"): |
967 self.project.saveAllScripts() |
968 self.project.saveAllScripts() |
968 self.vcs.vcsCommit(self.project.ppath, '', closeBranch = True) |
969 self.vcs.vcsCommit(self.project.ppath, '', closeBranch=True) |
969 |
970 |
970 def __hgEditRepoConfig(self): |
971 def __hgEditRepoConfig(self): |
971 """ |
972 """ |
972 Protected slot used to edit the repository config file. |
973 Protected slot used to edit the repository config file. |
973 """ |
974 """ |
1005 |
1006 |
1006 def __hgCreateIgnore(self): |
1007 def __hgCreateIgnore(self): |
1007 """ |
1008 """ |
1008 Protected slot used to create a .hgignore file for the project. |
1009 Protected slot used to create a .hgignore file for the project. |
1009 """ |
1010 """ |
1010 self.vcs.hgCreateIgnoreFile(self.project.ppath, autoAdd = True) |
1011 self.vcs.hgCreateIgnoreFile(self.project.ppath, autoAdd=True) |
1011 |
1012 |
1012 def __hgBundle(self): |
1013 def __hgBundle(self): |
1013 """ |
1014 """ |
1014 Protected slot used to create a changegroup file. |
1015 Protected slot used to create a changegroup file. |
1015 """ |
1016 """ |