eric6/Plugins/VcsPlugins/vcsMercurial/hg.py

Sun, 11 Apr 2021 18:45:10 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 11 Apr 2021 18:45:10 +0200
changeset 8222
5994b80b8760
parent 8220
006ee31b4835
child 8234
fcb6b4b96274
permissions
-rw-r--r--

Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).

178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
3 # Copyright (c) 2010 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the version control systems interface to Mercurial.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import os
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 import shutil
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
13 from PyQt5.QtCore import (
7719
a20dce3647ee Mercurial interface: deleted several calls to the hg executable in favour of the Mercurial server (aka. client).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7679
diff changeset
14 pyqtSignal, QFileInfo, QFileSystemWatcher, QCoreApplication
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
15 )
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
16 from PyQt5.QtWidgets import QApplication, QDialog, QInputDialog
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 from E5Gui.E5Application import e5App
882
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
19 from E5Gui import E5MessageBox, E5FileDialog
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
189
17bb2db7a347 Added administration actions to the Mercurial plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 184
diff changeset
21 from QScintilla.MiniEditor import MiniEditor
17bb2db7a347 Added administration actions to the Mercurial plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 184
diff changeset
22
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 from VCS.VersionControl import VersionControl
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 from VCS.RepositoryInfoDialog import VcsRepositoryInfoDialog
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 from .HgDialog import HgDialog
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
27 from .HgClient import HgClient
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
28
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 import Utilities
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
31
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 class Hg(VersionControl):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 Class implementing the version control systems interface to Mercurial.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 @signal committed() emitted after the commit action has completed
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
37 @signal activeExtensionsChanged() emitted when the list of active
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
38 extensions has changed
3416
efce6439595a Fixed an issue with Mercurial not realizing some changes of the configuration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3407
diff changeset
39 @signal iniFileChanged() emitted when a Mercurial/repo configuration file
efce6439595a Fixed an issue with Mercurial not realizing some changes of the configuration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3407
diff changeset
40 has changed
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 """
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 417
diff changeset
42 committed = pyqtSignal()
1088
9c84b88cff09 Refined the Mercurial extensions code a little bit to deal with torn of menus in a better way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1085
diff changeset
43 activeExtensionsChanged = pyqtSignal()
3416
efce6439595a Fixed an issue with Mercurial not realizing some changes of the configuration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3407
diff changeset
44 iniFileChanged = pyqtSignal()
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 417
diff changeset
45
1880
dbd4d7698310 Added code to ensure, that some eric specific files and directories get ignored
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1855
diff changeset
46 IgnoreFileName = ".hgignore"
dbd4d7698310 Added code to ensure, that some eric specific files and directories get ignored
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1855
diff changeset
47
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
48 def __init__(self, plugin, parent=None, name=None):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 Constructor
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 @param plugin reference to the plugin object
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 @param parent parent widget (QWidget)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 @param name name of this object (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 VersionControl.__init__(self, parent, name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 self.defaultOptions = {
3242
a7e006073658 Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3231
diff changeset
58 'global': [''],
a7e006073658 Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3231
diff changeset
59 'commit': [''],
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
60 'checkout': [''],
3242
a7e006073658 Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3231
diff changeset
61 'update': [''],
a7e006073658 Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3231
diff changeset
62 'add': [''],
a7e006073658 Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3231
diff changeset
63 'remove': [''],
a7e006073658 Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3231
diff changeset
64 'diff': [''],
a7e006073658 Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3231
diff changeset
65 'log': [''],
a7e006073658 Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3231
diff changeset
66 'history': [''],
a7e006073658 Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3231
diff changeset
67 'status': [''],
a7e006073658 Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3231
diff changeset
68 'tag': [''],
a7e006073658 Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3231
diff changeset
69 'export': ['']
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 }
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 self.__plugin = plugin
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 self.__ui = parent
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 self.options = self.defaultOptions
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 self.tagsList = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 self.branchesList = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 self.allTagsBranchesList = []
3562
ef3f13a2c599 Moved the Mercurial bookmarks to the Mercurial core because they are no extension since Mercurial 1.8 anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
79 self.bookmarksList = []
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 self.showedTags = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 self.showedBranches = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 self.tagTypeList = [
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
84 'tags',
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
85 'branches',
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 ]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 self.commandHistory = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 if "HG_ASP_DOT_NET_HACK" in os.environ:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 self.adminDir = '_hg'
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 self.adminDir = '.hg'
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94
1018
949812411ab8 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1017
diff changeset
95 self.logBrowser = None
3283
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3277
diff changeset
96 self.logBrowserIncoming = None
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3277
diff changeset
97 self.logBrowserOutgoing = None
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 self.diff = None
2838
0f1423054184 Continued extending the Mercurial side-by-side diff support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2837
diff changeset
99 self.sbsDiff = None
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 self.status = None
2811
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
101 self.summary = None
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 self.tagbranchList = None
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 self.annotate = None
1064
10bdbb173c0f Added an entry to the Mercurial menu to edit the user configuration file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
104 self.repoEditor = None
305
5cf9e308f342 Added action to start a Mercurial server to the Mercurial plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 276
diff changeset
105 self.serveDlg = None
3562
ef3f13a2c599 Moved the Mercurial bookmarks to the Mercurial core because they are no extension since Mercurial 1.8 anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
106 self.bookmarksListDlg = None
ef3f13a2c599 Moved the Mercurial bookmarks to the Mercurial core because they are no extension since Mercurial 1.8 anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
107 self.bookmarksInOutDlg = None
3586
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
108 self.conflictsDlg = None
1064
10bdbb173c0f Added an entry to the Mercurial menu to edit the user configuration file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
109
207
3f889378dede Added some code to inspect incoming patches as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 205
diff changeset
110 self.bundleFile = None
2576
b984efd69f15 Little extension to the Mercurial plug-in to remember the path of the recently used changegroup file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2543
diff changeset
111 self.__lastChangeGroupPath = None
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 self.statusCache = {}
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 self.__commitData = {}
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 self.__commitDialog = None
216
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 213
diff changeset
117
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 213
diff changeset
118 self.__forgotNames = []
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
119
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
120 self.__activeExtensions = []
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
121
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
122 from .HgUtilities import getConfigPath
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
123 self.__iniWatcher = QFileSystemWatcher(self)
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
124 self.__iniWatcher.fileChanged.connect(self.__iniFileChanged)
1811
623b5945226e Fixed an issue in the Mercurial interface causing a warning. if no .hgrc file exists.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1767
diff changeset
125 cfgFile = getConfigPath()
623b5945226e Fixed an issue in the Mercurial interface causing a warning. if no .hgrc file exists.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1767
diff changeset
126 if os.path.exists(cfgFile):
623b5945226e Fixed an issue in the Mercurial interface causing a warning. if no .hgrc file exists.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1767
diff changeset
127 self.__iniWatcher.addPath(cfgFile)
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
128
1240
4d5fc346bd3b Started implementing an interface to the Mercurial command server (as of Mercurial >= 1.9).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1237
diff changeset
129 self.__client = None
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
130 self.__createClient()
7034
ca42317bb307 git, hg: added code to handle situations where the project helper object has not been created yet.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7010
diff changeset
131 self.__projectHelper = None
1240
4d5fc346bd3b Started implementing an interface to the Mercurial command server (as of Mercurial >= 1.9).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1237
diff changeset
132
3277
b7d9c75223e3 Made availablity of push/pull related actions dependent on configured remote repository (default/default-push in .hg/hgrc).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3276
diff changeset
133 self.__repoDir = ""
b7d9c75223e3 Made availablity of push/pull related actions dependent on configured remote repository (default/default-push in .hg/hgrc).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3276
diff changeset
134 self.__repoIniFile = ""
b7d9c75223e3 Made availablity of push/pull related actions dependent on configured remote repository (default/default-push in .hg/hgrc).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3276
diff changeset
135 self.__defaultConfigured = False
b7d9c75223e3 Made availablity of push/pull related actions dependent on configured remote repository (default/default-push in .hg/hgrc).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3276
diff changeset
136 self.__defaultPushConfigured = False
b7d9c75223e3 Made availablity of push/pull related actions dependent on configured remote repository (default/default-push in .hg/hgrc).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3276
diff changeset
137
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
138 # instantiate the extensions
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
139 from .QueuesExtension.queues import Queues
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
140 from .PurgeExtension.purge import Purge
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
141 from .GpgExtension.gpg import Gpg
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
142 from .RebaseExtension.rebase import Rebase
3290
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3283
diff changeset
143 from .ShelveExtension.shelve import Shelve
3310
a2032ed66aec Started implementing the Mercurial lfconvert functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3308
diff changeset
144 from .LargefilesExtension.largefiles import Largefiles
5268
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5262
diff changeset
145 from .StripExtension.strip import Strip
5283
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
146 from .HisteditExtension.histedit import Histedit
7010
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
147 from .CloseheadExtension.closehead import Closehead
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
148 self.__extensions = {
1061
3e21869872e3 Fixed PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
149 "mq": Queues(self),
1071
ac0f74c0b870 Added support for the Mercurial purge extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1070
diff changeset
150 "purge": Purge(self),
1075
75bfe8bd4243 Added support for the Mercurial gpg extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1071
diff changeset
151 "gpg": Gpg(self),
1093
47bc4ef30315 Added support for the Mercurial rebase extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1088
diff changeset
152 "rebase": Rebase(self),
3290
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3283
diff changeset
153 "shelve": Shelve(self),
5268
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5262
diff changeset
154 "largefiles": Largefiles(self),
748e4c50523b Added support for the Mercurial strip extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5262
diff changeset
155 "strip": Strip(self),
5283
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5268
diff changeset
156 "histedit": Histedit(self),
7010
5d6f5a69a952 Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
157 "closehead": Closehead(self),
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
158 }
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 def getPlugin(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 Public method to get a reference to the plugin object.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 @return reference to the plugin object (VcsMercurialPlugin)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 return self.__plugin
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
168 def getEncoding(self):
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
169 """
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
170 Public method to get the encoding to be used by Mercurial.
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
171
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
172 @return encoding (string)
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
173 """
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
174 return self.__plugin.getPreferences("Encoding")
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
175
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 def vcsShutdown(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 Public method used to shutdown the Mercurial interface.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 """
1018
949812411ab8 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1017
diff changeset
180 if self.logBrowser is not None:
949812411ab8 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1017
diff changeset
181 self.logBrowser.close()
3283
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3277
diff changeset
182 if self.logBrowserIncoming is not None:
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3277
diff changeset
183 self.logBrowserIncoming.close()
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3277
diff changeset
184 if self.logBrowserOutgoing is not None:
2079b76a738b Changed the Mercurial Log Browser dialog to maintain its position after being closed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3277
diff changeset
185 self.logBrowserOutgoing.close()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 if self.diff is not None:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 self.diff.close()
2838
0f1423054184 Continued extending the Mercurial side-by-side diff support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2837
diff changeset
188 if self.sbsDiff is not None:
0f1423054184 Continued extending the Mercurial side-by-side diff support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2837
diff changeset
189 self.sbsDiff.close()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 if self.status is not None:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 self.status.close()
2811
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
192 if self.summary is not None:
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
193 self.summary.close()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 if self.tagbranchList is not None:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 self.tagbranchList.close()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 if self.annotate is not None:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 self.annotate.close()
305
5cf9e308f342 Added action to start a Mercurial server to the Mercurial plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 276
diff changeset
198 if self.serveDlg is not None:
5cf9e308f342 Added action to start a Mercurial server to the Mercurial plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 276
diff changeset
199 self.serveDlg.close()
207
3f889378dede Added some code to inspect incoming patches as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 205
diff changeset
200
3562
ef3f13a2c599 Moved the Mercurial bookmarks to the Mercurial core because they are no extension since Mercurial 1.8 anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
201 if self.bookmarksListDlg is not None:
ef3f13a2c599 Moved the Mercurial bookmarks to the Mercurial core because they are no extension since Mercurial 1.8 anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
202 self.bookmarksListDlg.close()
ef3f13a2c599 Moved the Mercurial bookmarks to the Mercurial core because they are no extension since Mercurial 1.8 anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
203 if self.bookmarksInOutDlg is not None:
ef3f13a2c599 Moved the Mercurial bookmarks to the Mercurial core because they are no extension since Mercurial 1.8 anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
204 self.bookmarksInOutDlg.close()
ef3f13a2c599 Moved the Mercurial bookmarks to the Mercurial core because they are no extension since Mercurial 1.8 anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
205
3586
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
206 if self.conflictsDlg is not None:
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
207 self.conflictsDlg.close()
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
208
207
3f889378dede Added some code to inspect incoming patches as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 205
diff changeset
209 if self.bundleFile and os.path.exists(self.bundleFile):
3f889378dede Added some code to inspect incoming patches as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 205
diff changeset
210 os.remove(self.bundleFile)
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
211
1076
6fb76985422b Changed code to close torn off submenus of the Mercurial project menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1075
diff changeset
212 # shut down the project helpers
7034
ca42317bb307 git, hg: added code to handle situations where the project helper object has not been created yet.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7010
diff changeset
213 if self.__projectHelper is not None:
ca42317bb307 git, hg: added code to handle situations where the project helper object has not been created yet.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7010
diff changeset
214 self.__projectHelper.shutdown()
1076
6fb76985422b Changed code to close torn off submenus of the Mercurial project menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1075
diff changeset
215
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
216 # shut down the extensions
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
217 for extension in self.__extensions.values():
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
218 extension.shutdown()
1240
4d5fc346bd3b Started implementing an interface to the Mercurial command server (as of Mercurial >= 1.9).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1237
diff changeset
219
4d5fc346bd3b Started implementing an interface to the Mercurial command server (as of Mercurial >= 1.9).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1237
diff changeset
220 # shut down the client
4d5fc346bd3b Started implementing an interface to the Mercurial command server (as of Mercurial >= 1.9).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1237
diff changeset
221 self.__client and self.__client.stopServer()
4d5fc346bd3b Started implementing an interface to the Mercurial command server (as of Mercurial >= 1.9).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1237
diff changeset
222
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
223 def initCommand(self, command):
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
224 """
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
225 Public method to initialize a command arguments list.
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
226
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
227 @param command command name (string)
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
228 @return list of command options (list of string)
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
229 """
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
230 args = [command]
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
231 self.addArguments(args, self.__plugin.getGlobalOptions())
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
232 return args
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
233
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 def vcsExists(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 Public method used to test for the presence of the hg executable.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237
5292
ac8b476ba122 Added support for host fingerprints in the hostsecurity section of the Mercurial configuration file (as of hg 3.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5284
diff changeset
238 @return flag indicating the existence (boolean) and an error message
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
239 (string)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 """
5292
ac8b476ba122 Added support for host fingerprints in the hostsecurity section of the Mercurial configuration file (as of hg 3.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5284
diff changeset
241 from .HgUtilities import hgVersion
ac8b476ba122 Added support for host fingerprints in the hostsecurity section of the Mercurial configuration file (as of hg 3.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5284
diff changeset
242
ac8b476ba122 Added support for host fingerprints in the hostsecurity section of the Mercurial configuration file (as of hg 3.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5284
diff changeset
243 self.versionStr, self.version, errMsg = hgVersion(self.__plugin)
ac8b476ba122 Added support for host fingerprints in the hostsecurity section of the Mercurial configuration file (as of hg 3.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5284
diff changeset
244 hgExists = errMsg == ""
ac8b476ba122 Added support for host fingerprints in the hostsecurity section of the Mercurial configuration file (as of hg 3.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5284
diff changeset
245 if hgExists:
ac8b476ba122 Added support for host fingerprints in the hostsecurity section of the Mercurial configuration file (as of hg 3.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5284
diff changeset
246 self.__getExtensionsInfo()
ac8b476ba122 Added support for host fingerprints in the hostsecurity section of the Mercurial configuration file (as of hg 3.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5284
diff changeset
247 return hgExists, errMsg
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
249 def vcsInit(self, vcsDir, noDialog=False):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 Public method used to initialize the mercurial repository.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
253 The initialization is done, when a project is converted into a
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
254 Mercurial controlled project. Therefore we always return TRUE without
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
255 doing anything.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 @param vcsDir name of the VCS directory (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 @param noDialog flag indicating quiet operations (boolean)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 @return always TRUE
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 return True
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262
7167
b3557e77314a VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7155
diff changeset
263 def vcsConvertProject(self, vcsDataDict, project, addAll=True):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
265 Public method to convert an uncontrolled project to a version
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
266 controlled project.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 @param vcsDataDict dictionary of data required for the conversion
7167
b3557e77314a VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7155
diff changeset
269 @type dict
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 @param project reference to the project object
7167
b3557e77314a VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7155
diff changeset
271 @type Project
b3557e77314a VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7155
diff changeset
272 @param addAll flag indicating to add all files to the repository
b3557e77314a VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7155
diff changeset
273 @type bool
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 """
7167
b3557e77314a VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7155
diff changeset
275 success = self.vcsImport(vcsDataDict, project.ppath, addAll=addAll)[0]
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 if not success:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
277 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
278 self.__ui,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
279 self.tr("Create project repository"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
280 self.tr(
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
281 """The project repository could not be created."""))
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 pfn = project.pfile
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 if not os.path.isfile(pfn):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 pfn += "z"
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 project.closeProject()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 project.openProject(pfn)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288
7167
b3557e77314a VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7155
diff changeset
289 def vcsImport(self, vcsDataDict, projectDir, noDialog=False, addAll=True):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
291 Public method used to import the project into the Mercurial repository.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 @param vcsDataDict dictionary of data required for the import
7167
b3557e77314a VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7155
diff changeset
294 @type dict
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 @param projectDir project directory (string)
7167
b3557e77314a VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7155
diff changeset
296 @type str
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 @param noDialog flag indicating quiet operations
7167
b3557e77314a VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7155
diff changeset
298 @type bool
b3557e77314a VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7155
diff changeset
299 @param addAll flag indicating to add all files to the repository
b3557e77314a VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7155
diff changeset
300 @type bool
b3557e77314a VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7155
diff changeset
301 @return tuple containing a flag indicating an execution without errors
b3557e77314a VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7155
diff changeset
302 and a flag indicating the version controll status
b3557e77314a VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7155
diff changeset
303 @rtype tuple of (bool, bool)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 msg = vcsDataDict["message"]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 if not msg:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 msg = '***'
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
309 args = self.initCommand("init")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 args.append(projectDir)
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
311 dia = HgDialog(self.tr('Creating Mercurial repository'), self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312 res = dia.startProcess(args)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
314 dia.exec()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 status = dia.normalExit()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 if status:
7791
f07ded9bc64d Mercurial: fixed an issue causing the creation of a Mercurial controlled project to not work as expected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7790
diff changeset
318 self.stopClient()
f07ded9bc64d Mercurial: fixed an issue causing the creation of a Mercurial controlled project to not work as expected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7790
diff changeset
319 self.__repoDir = projectDir
f07ded9bc64d Mercurial: fixed an issue causing the creation of a Mercurial controlled project to not work as expected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7790
diff changeset
320
1906
8487f9c2533b Continued implementing support for Mercurial sub-repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1905
diff changeset
321 ignoreName = os.path.join(projectDir, Hg.IgnoreFileName)
8487f9c2533b Continued implementing support for Mercurial sub-repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1905
diff changeset
322 if not os.path.exists(ignoreName):
8487f9c2533b Continued implementing support for Mercurial sub-repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1905
diff changeset
323 status = self.hgCreateIgnoreFile(projectDir)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324
7167
b3557e77314a VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7155
diff changeset
325 if status and addAll:
3328
15aaa8d3a840 Fixed a bug in the Mercurial interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
326 args = self.initCommand("commit")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 args.append('--addremove')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328 args.append('--message')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 args.append(msg)
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
330 dia = HgDialog(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
331 self.tr('Initial commit to Mercurial repository'),
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
332 self)
7971
ff2971513d6d Mercurial: completed more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
333 res = dia.startProcess(args)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
335 dia.exec()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 status = dia.normalExit()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 return status, False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
340 def vcsCheckout(self, vcsDataDict, projectDir, noDialog=False):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
342 Public method used to check the project out of a Mercurial repository
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
343 (clone).
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345 @param vcsDataDict dictionary of data required for the checkout
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
346 @param projectDir project directory to create (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
347 @param noDialog flag indicating quiet operations
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348 @return flag indicating an execution without errors (boolean)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
350 noDialog = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
351 try:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352 rev = vcsDataDict["revision"]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 except KeyError:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
354 rev = None
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355 vcsUrl = self.hgNormalizeURL(vcsDataDict["url"])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
357 args = self.initCommand("clone")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
358 if rev:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359 args.append("--rev")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360 args.append(rev)
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3311
diff changeset
361 if vcsDataDict["largefiles"]:
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3311
diff changeset
362 args.append("--all-largefiles")
5548
95b188f96d3d Reworked the Mercurial checkout dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5514
diff changeset
363 args.append(vcsUrl)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364 args.append(projectDir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 if noDialog:
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
367 out, err = self.__client.runcommand(args)
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
368 return err == ""
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 else:
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
370 dia = HgDialog(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
371 self.tr('Cloning project from a Mercurial repository'),
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
372 self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373 res = dia.startProcess(args)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
375 dia.exec()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 return dia.normalExit()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 def vcsExport(self, vcsDataDict, projectDir):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
380 Public method used to export a directory from the Mercurial repository.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 @param vcsDataDict dictionary of data required for the checkout
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 @param projectDir project directory to create (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384 @return flag indicating an execution without errors (boolean)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386 status = self.vcsCheckout(vcsDataDict, projectDir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387 shutil.rmtree(os.path.join(projectDir, self.adminDir), True)
3260
37bbdfba30bc Corrected a little inaccuracy.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3256
diff changeset
388 if os.path.exists(os.path.join(projectDir, Hg.IgnoreFileName)):
37bbdfba30bc Corrected a little inaccuracy.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3256
diff changeset
389 os.remove(os.path.join(projectDir, Hg.IgnoreFileName))
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390 return status
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
392 def vcsCommit(self, name, message, noDialog=False, closeBranch=False,
7152
a99df2004bb7 Commit Merge in Mercurial added and Cancel renamed to Abort Merge
Christos Sevastiadis <csevast@auth.gr>
parents: 7034
diff changeset
393 mq=False, merge=False):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
395 Public method used to make the change of a file/directory permanent
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
396 in the Mercurial repository.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
397
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
398 @param name file/directory name to be committed (string or list of
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
399 strings)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 @param message message for this operation (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401 @param noDialog flag indicating quiet operations
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7836
diff changeset
402 @param closeBranch flag indicating a close branch commit (boolean)
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7836
diff changeset
403 @param mq flag indicating a queue commit (boolean)
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7836
diff changeset
404 @param merge flag indicating a merge commit (boolean)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406 msg = message
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407
7152
a99df2004bb7 Commit Merge in Mercurial added and Cancel renamed to Abort Merge
Christos Sevastiadis <csevast@auth.gr>
parents: 7034
diff changeset
408 if mq or merge:
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
409 # ensure dialog is shown for a queue commit
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
410 noDialog = False
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
411
3353
ddc966a494b0 Added capability to commit a new branch directly without the need to select the commit menu entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3349
diff changeset
412 if not noDialog:
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 # call CommitDialog and get message from there
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 if self.__commitDialog is None:
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
415 from .HgCommitDialog import HgCommitDialog
7155
334c7d0b5036 Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7153
diff changeset
416 self.__commitDialog = HgCommitDialog(self, msg, mq, merge,
7152
a99df2004bb7 Commit Merge in Mercurial added and Cancel renamed to Abort Merge
Christos Sevastiadis <csevast@auth.gr>
parents: 7034
diff changeset
417 self.__ui)
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 417
diff changeset
418 self.__commitDialog.accepted.connect(self.__vcsCommit_Step2)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419 self.__commitDialog.show()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 self.__commitDialog.raise_()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
421 self.__commitDialog.activateWindow()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423 self.__commitData["name"] = name
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 self.__commitData["msg"] = msg
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 self.__commitData["noDialog"] = noDialog
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426 self.__commitData["closeBranch"] = closeBranch
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
427 self.__commitData["mq"] = mq
7152
a99df2004bb7 Commit Merge in Mercurial added and Cancel renamed to Abort Merge
Christos Sevastiadis <csevast@auth.gr>
parents: 7034
diff changeset
428 self.__commitData["merge"] = merge
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
429
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 if noDialog:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
431 self.__vcsCommit_Step2()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
433 def __vcsCommit_Step2(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
434 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
435 Private slot performing the second step of the commit action.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
437 name = self.__commitData["name"]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
438 msg = self.__commitData["msg"]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
439 noDialog = self.__commitData["noDialog"]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
440 closeBranch = self.__commitData["closeBranch"]
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
441 mq = self.__commitData["mq"]
7152
a99df2004bb7 Commit Merge in Mercurial added and Cancel renamed to Abort Merge
Christos Sevastiadis <csevast@auth.gr>
parents: 7034
diff changeset
442 merge = self.__commitData["merge"]
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
443
2222
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
444 if not noDialog:
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
445 # check, if there are unsaved changes, that should be committed
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
446 if isinstance(name, list):
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
447 nameList = name
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
448 else:
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
449 nameList = [name]
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
450 ok = True
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
451 for nam in nameList:
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
452 # check for commit of the project
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
453 if os.path.isdir(nam):
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
454 project = e5App().getObject("Project")
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
455 if nam == project.getProjectPath():
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
456 ok &= (
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
457 project.checkAllScriptsDirty(
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
458 reportSyntaxErrors=True) and
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
459 project.checkDirty()
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
460 )
2222
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
461 continue
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
462 elif os.path.isfile(nam):
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
463 editor = (
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
464 e5App().getObject("ViewManager").getOpenEditor(nam)
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
465 )
2222
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
466 if editor:
2280
8e85ca3fabe7 Fixed a few PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2278
diff changeset
467 ok &= editor.checkDirty()
2222
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
468 if not ok:
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
469 break
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
470
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
471 if not ok:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
472 res = E5MessageBox.yesNo(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
473 self.__ui,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
474 self.tr("Commit Changes"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
475 self.tr(
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
476 """The commit affects files, that have unsaved"""
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
477 """ changes. Shall the commit be continued?"""),
2280
8e85ca3fabe7 Fixed a few PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2278
diff changeset
478 icon=E5MessageBox.Warning)
2222
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
479 if not res:
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
480 return
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
481
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
482 if self.__commitDialog is not None:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
483 (msg, amend, commitSubrepositories, author,
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
484 dateTime) = self.__commitDialog.getCommitData()
2318
3a3ee7cc2ad6 Changed some signal handlings (disconnect).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
485 self.__commitDialog.deleteLater()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
486 self.__commitDialog = None
4487
4ba7a8ab24f2 Fixed an issue with the Mercurial commit command when amending a commit but not given a commit message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4409
diff changeset
487 if amend and not msg:
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
488 msg = self.__getMostRecentCommitMessage()
1855
93bf1823466a Added support for amending commits as of Mercurial 2.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1811
diff changeset
489 else:
93bf1823466a Added support for amending commits as of Mercurial 2.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1811
diff changeset
490 amend = False
1906
8487f9c2533b Continued implementing support for Mercurial sub-repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1905
diff changeset
491 commitSubrepositories = False
5330
381665763704 Added possibility to enter a commit author and commit date/time to the Mercurial commit dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5329
diff changeset
492 author = ""
381665763704 Added possibility to enter a commit author and commit date/time to the Mercurial commit dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5329
diff changeset
493 dateTime = ""
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
494
1855
93bf1823466a Added support for amending commits as of Mercurial 2.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1811
diff changeset
495 if not msg and not amend:
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
496 msg = '***'
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
497
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
498 args = self.initCommand("commit")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
499 args.append("-v")
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
500 if mq:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
501 args.append("--mq")
7152
a99df2004bb7 Commit Merge in Mercurial added and Cancel renamed to Abort Merge
Christos Sevastiadis <csevast@auth.gr>
parents: 7034
diff changeset
502 elif merge:
7153
ca02892fde13 Merged with merge changes supplied by Christos Sevastiadisi.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7152
diff changeset
503 if author:
ca02892fde13 Merged with merge changes supplied by Christos Sevastiadisi.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7152
diff changeset
504 args.append("--user")
ca02892fde13 Merged with merge changes supplied by Christos Sevastiadisi.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7152
diff changeset
505 args.append(author)
ca02892fde13 Merged with merge changes supplied by Christos Sevastiadisi.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7152
diff changeset
506 if dateTime:
ca02892fde13 Merged with merge changes supplied by Christos Sevastiadisi.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7152
diff changeset
507 args.append("--date")
ca02892fde13 Merged with merge changes supplied by Christos Sevastiadisi.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7152
diff changeset
508 args.append(dateTime)
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
509 else:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
510 if closeBranch:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
511 args.append("--close-branch")
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
512 if amend:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
513 args.append("--amend")
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
514 if commitSubrepositories:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
515 args.append("--subrepos")
5330
381665763704 Added possibility to enter a commit author and commit date/time to the Mercurial commit dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5329
diff changeset
516 if author:
381665763704 Added possibility to enter a commit author and commit date/time to the Mercurial commit dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5329
diff changeset
517 args.append("--user")
381665763704 Added possibility to enter a commit author and commit date/time to the Mercurial commit dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5329
diff changeset
518 args.append(author)
381665763704 Added possibility to enter a commit author and commit date/time to the Mercurial commit dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5329
diff changeset
519 if dateTime:
381665763704 Added possibility to enter a commit author and commit date/time to the Mercurial commit dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5329
diff changeset
520 args.append("--date")
381665763704 Added possibility to enter a commit author and commit date/time to the Mercurial commit dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5329
diff changeset
521 args.append(dateTime)
1855
93bf1823466a Added support for amending commits as of Mercurial 2.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1811
diff changeset
522 if msg:
93bf1823466a Added support for amending commits as of Mercurial 2.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1811
diff changeset
523 args.append("--message")
93bf1823466a Added support for amending commits as of Mercurial 2.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1811
diff changeset
524 args.append(msg)
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
525 if isinstance(name, list):
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
526 self.addArguments(args, name)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
527 else:
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
528 args.append(name)
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
529
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
530 dia = HgDialog(
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
531 self.tr('Committing changes to Mercurial repository'),
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
532 self)
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
533 res = dia.startProcess(args)
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
534 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
535 dia.exec()
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 417
diff changeset
536 self.committed.emit()
216
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 213
diff changeset
537 if self.__forgotNames:
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 213
diff changeset
538 model = e5App().getObject("Project").getModel()
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 213
diff changeset
539 for name in self.__forgotNames:
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 213
diff changeset
540 model.updateVCSStatus(name)
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 213
diff changeset
541 self.__forgotNames = []
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
542 self.checkVCSStatus()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
543
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
544 def __getMostRecentCommitMessage(self):
4487
4ba7a8ab24f2 Fixed an issue with the Mercurial commit command when amending a commit but not given a commit message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4409
diff changeset
545 """
4ba7a8ab24f2 Fixed an issue with the Mercurial commit command when amending a commit but not given a commit message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4409
diff changeset
546 Private method to get the most recent commit message.
4ba7a8ab24f2 Fixed an issue with the Mercurial commit command when amending a commit but not given a commit message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4409
diff changeset
547
4ba7a8ab24f2 Fixed an issue with the Mercurial commit command when amending a commit but not given a commit message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4409
diff changeset
548 Note: This message is extracted from the parent commit of the
4ba7a8ab24f2 Fixed an issue with the Mercurial commit command when amending a commit but not given a commit message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4409
diff changeset
549 working directory.
4ba7a8ab24f2 Fixed an issue with the Mercurial commit command when amending a commit but not given a commit message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4409
diff changeset
550
4ba7a8ab24f2 Fixed an issue with the Mercurial commit command when amending a commit but not given a commit message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4409
diff changeset
551 @return most recent commit message
4ba7a8ab24f2 Fixed an issue with the Mercurial commit command when amending a commit but not given a commit message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4409
diff changeset
552 @rtype str
4ba7a8ab24f2 Fixed an issue with the Mercurial commit command when amending a commit but not given a commit message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4409
diff changeset
553 """
4ba7a8ab24f2 Fixed an issue with the Mercurial commit command when amending a commit but not given a commit message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4409
diff changeset
554 args = self.initCommand("log")
4ba7a8ab24f2 Fixed an issue with the Mercurial commit command when amending a commit but not given a commit message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4409
diff changeset
555 args.append("--rev")
4ba7a8ab24f2 Fixed an issue with the Mercurial commit command when amending a commit but not given a commit message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4409
diff changeset
556 args.append(".")
4ba7a8ab24f2 Fixed an issue with the Mercurial commit command when amending a commit but not given a commit message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4409
diff changeset
557 args.append('--template')
4ba7a8ab24f2 Fixed an issue with the Mercurial commit command when amending a commit but not given a commit message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4409
diff changeset
558 args.append('{desc}')
4ba7a8ab24f2 Fixed an issue with the Mercurial commit command when amending a commit but not given a commit message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4409
diff changeset
559
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
560 output, error = self.__client.runcommand(args)
4487
4ba7a8ab24f2 Fixed an issue with the Mercurial commit command when amending a commit but not given a commit message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4409
diff changeset
561
4ba7a8ab24f2 Fixed an issue with the Mercurial commit command when amending a commit but not given a commit message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4409
diff changeset
562 return output
4ba7a8ab24f2 Fixed an issue with the Mercurial commit command when amending a commit but not given a commit message.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4409
diff changeset
563
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
564 def vcsUpdate(self, name=None, noDialog=False, revision=None):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
565 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
566 Public method used to update a file/directory with the Mercurial
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
567 repository.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
568
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
569 @param name file/directory name to be updated (not used)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
570 @param noDialog flag indicating quiet operations (boolean)
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7836
diff changeset
571 @param revision revision to update to (string)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
572 @return flag indicating, that the update contained an add
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
573 or delete (boolean)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
574 """
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
575 args = self.initCommand("update")
694
d482fc1249b0 Improved the Mercurial plugi-in to better indicate a changed project file after a pull --update and update.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 660
diff changeset
576 if "-v" not in args and "--verbose" not in args:
d482fc1249b0 Improved the Mercurial plugi-in to better indicate a changed project file after a pull --update and update.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 660
diff changeset
577 args.append("-v")
3382
de914da071c8 Fixed a little issue in the Mercurial interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3359
diff changeset
578 if revision:
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
579 args.append("-r")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
580 args.append(revision)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
581
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
582 if noDialog:
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
583 out, err = self.__client.runcommand(args)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
584 res = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
585 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
586 dia = HgDialog(self.tr(
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
587 'Synchronizing with the Mercurial repository'),
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
588 self)
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
589 res = dia.startProcess(args)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
590 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
591 dia.exec()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
592 res = dia.hasAddOrDelete()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
593 self.checkVCSStatus()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
594 return res
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
595
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
596 def vcsAdd(self, name, isDir=False, noDialog=False):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
597 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
598 Public method used to add a file/directory to the Mercurial repository.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
599
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
600 @param name file/directory name to be added (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
601 @param isDir flag indicating name is a directory (boolean)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
602 @param noDialog flag indicating quiet operations
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
603 """
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
604 args = self.initCommand("add")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
605 args.append("-v")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
606
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
607 if isinstance(name, list):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
608 self.addArguments(args, name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
609 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
610 args.append(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
611
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
612 if noDialog:
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
613 out, err = self.__client.runcommand(args)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
614 else:
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 553
diff changeset
615 dia = HgDialog(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
616 self.tr(
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
617 'Adding files/directories to the Mercurial repository'),
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
618 self)
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
619 res = dia.startProcess(args)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
620 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
621 dia.exec()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
622
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
623 def vcsAddBinary(self, name, isDir=False):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
624 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
625 Public method used to add a file/directory in binary mode to the
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
626 Mercurial repository.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
627
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
628 @param name file/directory name to be added (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
629 @param isDir flag indicating name is a directory (boolean)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
630 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
631 self.vcsAdd(name, isDir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
632
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
633 def vcsAddTree(self, path):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
634 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
635 Public method to add a directory tree rooted at path to the Mercurial
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
636 repository.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
637
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
638 @param path root directory of the tree to be added (string or list of
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
639 strings))
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
640 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
641 self.vcsAdd(path, isDir=False)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
642
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
643 def vcsRemove(self, name, project=False, noDialog=False):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
644 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
645 Public method used to remove a file/directory from the Mercurial
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
646 repository.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
647
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
648 The default operation is to remove the local copy as well.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
649
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
650 @param name file/directory name to be removed (string or list of
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
651 strings))
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
652 @param project flag indicating deletion of a project tree (boolean)
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
653 (not needed)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
654 @param noDialog flag indicating quiet operations
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
655 @return flag indicating successfull operation (boolean)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
656 """
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
657 args = self.initCommand("remove")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
658 args.append("-v")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
659 if noDialog and '--force' not in args:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
660 args.append('--force')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
661
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
662 if isinstance(name, list):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
663 self.addArguments(args, name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
664 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
665 args.append(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
666
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
667 if noDialog:
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
668 out, err = self.__client.runcommand(args)
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
669 res = err == ""
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
670 else:
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 553
diff changeset
671 dia = HgDialog(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
672 self.tr(
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
673 'Removing files/directories from the Mercurial'
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
674 ' repository'),
1240
4d5fc346bd3b Started implementing an interface to the Mercurial command server (as of Mercurial >= 1.9).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1237
diff changeset
675 self)
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
676 res = dia.startProcess(args)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
677 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
678 dia.exec()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
679 res = dia.normalExitWithoutErrors()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
680
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
681 return res
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
682
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
683 def vcsMove(self, name, project, target=None, noDialog=False):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
684 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
685 Public method used to move a file/directory.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
686
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
687 @param name file/directory name to be moved (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
688 @param project reference to the project object
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
689 @param target new name of the file/directory (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
690 @param noDialog flag indicating quiet operations
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
691 @return flag indicating successfull operation (boolean)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
692 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
693 isDir = os.path.isdir(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
694
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
695 res = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
696 if noDialog:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
697 if target is None:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
698 return False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
699 force = True
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
700 accepted = True
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
701 else:
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
702 from .HgCopyDialog import HgCopyDialog
3306
0a4e5082cbc6 Last changes to the Mercurial shelve extension interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3305
diff changeset
703 dlg = HgCopyDialog(name, None, True)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8108
diff changeset
704 accepted = dlg.exec() == QDialog.DialogCode.Accepted
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
705 if accepted:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
706 target, force = dlg.getData()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
707
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
708 if accepted:
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
709 args = self.initCommand("rename")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
710 args.append("-v")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
711 if force:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
712 args.append('--force')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
713 args.append(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
714 args.append(target)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
715
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
716 if noDialog:
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
717 out, err = self.__client.runcommand(args)
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
718 res = err == ""
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
719 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
720 dia = HgDialog(self.tr('Renaming {0}').format(name), self)
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
721 res = dia.startProcess(args)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
722 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
723 dia.exec()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
724 res = dia.normalExit()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
725 if res:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
726 if target.startswith(project.getProjectPath()):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
727 if isDir:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
728 project.moveDirectory(name, target)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
729 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
730 project.renameFileInPdata(name, target)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
731 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
732 if isDir:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
733 project.removeDirectory(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
734 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
735 project.removeFile(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
736 return res
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
737
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
738 def vcsDiff(self, name):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
739 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
740 Public method used to view the difference of a file/directory to the
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
741 Mercurial repository.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
742
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
743 If name is a directory and is the project directory, all project files
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
744 are saved first. If name is a file (or list of files), which is/are
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
745 being edited and has unsaved modification, they can be saved or the
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
746 operation may be aborted.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
747
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
748 @param name file/directory name to be diffed (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
749 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
750 if isinstance(name, list):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
751 names = name[:]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
752 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
753 names = [name]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
754 for nam in names:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
755 if os.path.isfile(nam):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
756 editor = e5App().getObject("ViewManager").getOpenEditor(nam)
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
757 if editor and not editor.checkDirty():
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
758 return
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
759 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
760 project = e5App().getObject("Project")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
761 if nam == project.ppath and not project.saveAllScripts():
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
762 return
4126
c28d0cf3b639 Some changes to the various VCS interfaces to use one dialog instead of creating a new one each time.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4072
diff changeset
763 if self.diff is None:
c28d0cf3b639 Some changes to the various VCS interfaces to use one dialog instead of creating a new one each time.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4072
diff changeset
764 from .HgDiffDialog import HgDiffDialog
c28d0cf3b639 Some changes to the various VCS interfaces to use one dialog instead of creating a new one each time.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4072
diff changeset
765 self.diff = HgDiffDialog(self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
766 self.diff.show()
4126
c28d0cf3b639 Some changes to the various VCS interfaces to use one dialog instead of creating a new one each time.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4072
diff changeset
767 self.diff.raise_()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
768 QApplication.processEvents()
4072
46fb585f60f2 Extended the diff dialogs of the various VCS interfaces to allow a refresh in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
769 self.diff.start(name, refreshable=True)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
770
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
771 def vcsStatus(self, name):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
772 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
773 Public method used to view the status of files/directories in the
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
774 Mercurial repository.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
775
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
776 @param name file/directory name(s) to show the status of
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
777 (string or list of strings)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
778 """
4126
c28d0cf3b639 Some changes to the various VCS interfaces to use one dialog instead of creating a new one each time.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4072
diff changeset
779 if self.status is None:
c28d0cf3b639 Some changes to the various VCS interfaces to use one dialog instead of creating a new one each time.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4072
diff changeset
780 from .HgStatusDialog import HgStatusDialog
c28d0cf3b639 Some changes to the various VCS interfaces to use one dialog instead of creating a new one each time.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4072
diff changeset
781 self.status = HgStatusDialog(self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
782 self.status.show()
4126
c28d0cf3b639 Some changes to the various VCS interfaces to use one dialog instead of creating a new one each time.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4072
diff changeset
783 self.status.raise_()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
784 self.status.start(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
785
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3311
diff changeset
786 def hgSummary(self, mq=False, largefiles=False):
2811
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
787 """
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
788 Public method used to show some summary information of the
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
789 working directory state.
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
790
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
791 @param mq flag indicating to show the queue status as well (boolean)
3359
6b6c224d67d6 Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3353
diff changeset
792 @param largefiles flag indicating to show the largefiles status as
6b6c224d67d6 Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3353
diff changeset
793 well (boolean)
2811
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
794 """
4126
c28d0cf3b639 Some changes to the various VCS interfaces to use one dialog instead of creating a new one each time.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4072
diff changeset
795 if self.summary is None:
c28d0cf3b639 Some changes to the various VCS interfaces to use one dialog instead of creating a new one each time.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4072
diff changeset
796 from .HgSummaryDialog import HgSummaryDialog
c28d0cf3b639 Some changes to the various VCS interfaces to use one dialog instead of creating a new one each time.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4072
diff changeset
797 self.summary = HgSummaryDialog(self)
2811
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
798 self.summary.show()
4126
c28d0cf3b639 Some changes to the various VCS interfaces to use one dialog instead of creating a new one each time.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4072
diff changeset
799 self.summary.raise_()
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
800 self.summary.start(mq=mq, largefiles=largefiles)
2811
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
801
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
802 def vcsTag(self, name=None, revision=None, tagName=None):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
803 """
3185
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
804 Public method used to set/remove a tag in the Mercurial repository.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
805
3185
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
806 @param name file/directory name to determine the repo root from
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
807 (string)
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
808 @param revision revision to set tag for (string)
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
809 @param tagName name of the tag (string)
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
810 @return flag indicating a performed tag action (boolean)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
811 """
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
812 from .HgTagDialog import HgTagDialog
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
813 dlg = HgTagDialog(self.hgGetTagsList(withType=True),
3185
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
814 revision, tagName)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8108
diff changeset
815 if dlg.exec() == QDialog.DialogCode.Accepted:
5345
c7c3f9de2d1c Added capability to enforce a Mercurial tagging operation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5330
diff changeset
816 tag, revision, tagOp, force = dlg.getParameters()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
817 else:
3185
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
818 return False
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
819
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
820 args = self.initCommand("tag")
3185
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
821 msgPart = ""
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
822 if tagOp in [HgTagDialog.CreateLocalTag, HgTagDialog.DeleteLocalTag]:
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
823 args.append('--local')
3185
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
824 msgPart = "local "
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
825 else:
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
826 msgPart = "global "
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
827 if tagOp in [HgTagDialog.DeleteGlobalTag, HgTagDialog.DeleteLocalTag]:
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
828 args.append('--remove')
8222
5994b80b8760 Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8220
diff changeset
829 if (
5994b80b8760 Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8220
diff changeset
830 tagOp in [
5994b80b8760 Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8220
diff changeset
831 HgTagDialog.CreateGlobalTag, HgTagDialog.CreateLocalTag] and
5994b80b8760 Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8220
diff changeset
832 revision
5994b80b8760 Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8220
diff changeset
833 ):
5994b80b8760 Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8220
diff changeset
834 args.append("--rev")
5994b80b8760 Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8220
diff changeset
835 args.append(revision)
5345
c7c3f9de2d1c Added capability to enforce a Mercurial tagging operation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5330
diff changeset
836 if force:
c7c3f9de2d1c Added capability to enforce a Mercurial tagging operation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5330
diff changeset
837 args.append("--force")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
838 args.append('--message')
3185
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
839 if tagOp in [HgTagDialog.CreateGlobalTag, HgTagDialog.CreateLocalTag]:
182
5fb26c972892 Changed tagging and branching to not allow spaces in tag/branch name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 181
diff changeset
840 tag = tag.strip().replace(" ", "_")
3185
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
841 args.append("Created {1}tag <{0}>.".format(tag, msgPart))
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
842 else:
3185
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
843 args.append("Removed {1}tag <{0}>.".format(tag, msgPart))
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
844 args.append(tag)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
845
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
846 dia = HgDialog(self.tr('Tagging in the Mercurial repository'),
3185
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
847 self)
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
848 res = dia.startProcess(args)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
849 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
850 dia.exec()
3185
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
851
d4fa462547bc Enhanced the Mercurial tag dialog and extended the Mercurial log browser to allow tagging of a specific revision
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
852 return True
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
853
1311
95685f9ad9f8 Added support for importing patches to the Mercurial interface and made it's revert action check, if the project should be reread.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1307
diff changeset
854 def hgRevert(self, name):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
855 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
856 Public method used to revert changes made to a file/directory.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
857
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
858 @param name file/directory name to be reverted (string)
1311
95685f9ad9f8 Added support for importing patches to the Mercurial interface and made it's revert action check, if the project should be reread.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1307
diff changeset
859 @return flag indicating, that the update contained an add
95685f9ad9f8 Added support for importing patches to the Mercurial interface and made it's revert action check, if the project should be reread.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1307
diff changeset
860 or delete (boolean)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
861 """
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
862 args = self.initCommand("revert")
1312
12506dba74dc Added configuration option to create backup files when reverting changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1311
diff changeset
863 if not self.getPlugin().getPreferences("CreateBackup"):
12506dba74dc Added configuration option to create backup files when reverting changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1311
diff changeset
864 args.append("--no-backup")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
865 args.append("-v")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
866 if isinstance(name, list):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
867 self.addArguments(args, name)
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
868 names = name[:]
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
869 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
870 args.append(name)
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
871 names = [name]
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
872
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
873 project = e5App().getObject("Project")
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
874 names = [project.getRelativePath(nam) for nam in names]
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
875 if names[0]:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
876 from UI.DeleteFilesConfirmationDialog import (
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
877 DeleteFilesConfirmationDialog
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
878 )
3023
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
879 dlg = DeleteFilesConfirmationDialog(
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
880 self.parent(),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
881 self.tr("Revert changes"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
882 self.tr(
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
883 "Do you really want to revert all changes to these files"
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
884 " or directories?"),
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
885 names)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8108
diff changeset
886 yes = dlg.exec() == QDialog.DialogCode.Accepted
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
887 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
888 yes = E5MessageBox.yesNo(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
889 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
890 self.tr("Revert changes"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
891 self.tr("""Do you really want to revert all changes of"""
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
892 """ the project?"""))
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
893 if yes:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
894 dia = HgDialog(self.tr('Reverting changes'), self)
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
895 res = dia.startProcess(args)
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
896 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
897 dia.exec()
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
898 res = dia.hasAddOrDelete()
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
899 self.checkVCSStatus()
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
900 else:
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
901 res = False
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
902
1311
95685f9ad9f8 Added support for importing patches to the Mercurial interface and made it's revert action check, if the project should be reread.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1307
diff changeset
903 return res
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
904
5496
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
905 def vcsMerge(self, name, rev=""):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
906 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
907 Public method used to merge a URL/revision into the local project.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
908
5496
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
909 @param name file/directory name to be merged
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
910 @type str
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7836
diff changeset
911 @param rev revision to merge with
5496
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
912 @type str
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
913 """
5496
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
914 if not rev:
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
915 from .HgMergeDialog import HgMergeDialog
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
916 dlg = HgMergeDialog(self.hgGetTagsList(),
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
917 self.hgGetBranchesList(),
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
918 self.hgGetBookmarksList())
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8108
diff changeset
919 if dlg.exec() == QDialog.DialogCode.Accepted:
5496
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
920 rev, force = dlg.getParameters()
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
921 else:
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
922 return
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
923 else:
5496
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
924 force = False
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
925
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
926 args = self.initCommand("merge")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
927 if force:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
928 args.append("--force")
3256
1a43351889d5 Aded a configuration option to enforce the useage of the internal merge tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3242
diff changeset
929 if self.getPlugin().getPreferences("InternalMerge"):
1a43351889d5 Aded a configuration option to enforce the useage of the internal merge tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3242
diff changeset
930 args.append("--tool")
1a43351889d5 Aded a configuration option to enforce the useage of the internal merge tool.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3242
diff changeset
931 args.append("internal:merge")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
932 if rev:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
933 args.append("--rev")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
934 args.append(rev)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
935
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
936 dia = HgDialog(self.tr('Merging'), self)
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
937 res = dia.startProcess(args)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
938 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
939 dia.exec()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
940 self.checkVCSStatus()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
941
3586
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
942 def hgReMerge(self, name):
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
943 """
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
944 Public method used to merge a URL/revision into the local project.
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
945
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
946 @param name file/directory name to be merged (string)
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
947 """
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
948 args = self.initCommand("resolve")
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
949 if self.getPlugin().getPreferences("InternalMerge"):
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
950 args.append("--tool")
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
951 args.append("internal:merge")
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
952 if isinstance(name, list):
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
953 self.addArguments(args, name)
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
954 names = name[:]
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
955 else:
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
956 args.append(name)
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
957 names = [name]
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
958
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
959 project = e5App().getObject("Project")
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
960 names = [project.getRelativePath(nam) for nam in names]
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
961 if names[0]:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
962 from UI.DeleteFilesConfirmationDialog import (
3586
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
963 DeleteFilesConfirmationDialog
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
964 )
3586
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
965 dlg = DeleteFilesConfirmationDialog(
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
966 self.parent(),
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
967 self.tr("Re-Merge"),
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
968 self.tr(
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
969 "Do you really want to re-merge these files"
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
970 " or directories?"),
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
971 names)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8108
diff changeset
972 yes = dlg.exec() == QDialog.DialogCode.Accepted
3586
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
973 else:
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
974 yes = E5MessageBox.yesNo(
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
975 None,
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
976 self.tr("Re-Merge"),
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
977 self.tr("""Do you really want to re-merge the project?"""))
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
978 if yes:
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
979 dia = HgDialog(self.tr('Re-Merging').format(name), self)
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
980 res = dia.startProcess(args)
3586
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
981 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
982 dia.exec()
3586
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
983 self.checkVCSStatus()
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
984
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
985 def vcsSwitch(self, name):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
986 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
987 Public method used to switch a working directory to a different
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
988 revision.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
989
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
990 @param name directory name to be switched (string)
1083
dc680a0ce221 Extended the code logic for the switch command of the various version control interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1078
diff changeset
991 @return flag indicating, that the switch contained an add
dc680a0ce221 Extended the code logic for the switch command of the various version control interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1078
diff changeset
992 or delete (boolean)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
993 """
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
994 from .HgRevisionSelectionDialog import HgRevisionSelectionDialog
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
995 dlg = HgRevisionSelectionDialog(self.hgGetTagsList(),
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
996 self.hgGetBranchesList(),
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
997 self.hgGetBookmarksList(),
3407
07966c6b5565 Changed a few Mercurial dialogs asking the user for the selection of a revision to be more accurate.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3382
diff changeset
998 self.tr("Current branch tip"))
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8108
diff changeset
999 if dlg.exec() == QDialog.DialogCode.Accepted:
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1000 rev = dlg.getRevision()
1083
dc680a0ce221 Extended the code logic for the switch command of the various version control interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1078
diff changeset
1001 return self.vcsUpdate(name, revision=rev)
dc680a0ce221 Extended the code logic for the switch command of the various version control interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1078
diff changeset
1002
dc680a0ce221 Extended the code logic for the switch command of the various version control interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1078
diff changeset
1003 return False
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1004
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1005 def vcsRegisteredState(self, name):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1006 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1007 Public method used to get the registered state of a file in the vcs.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1008
7979
54b73174ab61 Mercurial: fixed a few issues introduced during the recent code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
1009 @param name file or directory name to check
54b73174ab61 Mercurial: fixed a few issues introduced during the recent code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
1010 @type str
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1011 @return a combination of canBeCommited and canBeAdded
7979
54b73174ab61 Mercurial: fixed a few issues introduced during the recent code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
1012 @rtype int
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1013 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1014 if name.endswith(os.sep):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1015 name = name[:-1]
240
b0d829cf4234 Fixed an issue with determining the Mercurial status on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 219
diff changeset
1016 name = os.path.normcase(name)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1017
7979
54b73174ab61 Mercurial: fixed a few issues introduced during the recent code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
1018 if (
54b73174ab61 Mercurial: fixed a few issues introduced during the recent code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
1019 os.path.isdir(name) and
54b73174ab61 Mercurial: fixed a few issues introduced during the recent code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
1020 os.path.isdir(os.path.join(name, self.adminDir))
54b73174ab61 Mercurial: fixed a few issues introduced during the recent code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
1021 ):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1022 return self.canBeCommitted
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1023
194
4820fc69705c Improved speed loading projects (with Mercurial).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 192
diff changeset
1024 if name in self.statusCache:
4820fc69705c Improved speed loading projects (with Mercurial).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 192
diff changeset
1025 return self.statusCache[name]
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
1026 args = self.initCommand("status")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1027 args.append('--all')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1028 args.append('--noninteractive')
1240
4d5fc346bd3b Started implementing an interface to the Mercurial command server (as of Mercurial >= 1.9).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1237
diff changeset
1029
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1030 output, error = self.__client.runcommand(args)
1240
4d5fc346bd3b Started implementing an interface to the Mercurial command server (as of Mercurial >= 1.9).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1237
diff changeset
1031
4d5fc346bd3b Started implementing an interface to the Mercurial command server (as of Mercurial >= 1.9).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1237
diff changeset
1032 if output:
7979
54b73174ab61 Mercurial: fixed a few issues introduced during the recent code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7971
diff changeset
1033 repodir = self.getClient().getRepository()
1240
4d5fc346bd3b Started implementing an interface to the Mercurial command server (as of Mercurial >= 1.9).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1237
diff changeset
1034 for line in output.splitlines():
6021
49bd9194e2ea Fixed a little issue in the Mercurial plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: