eric6/Plugins/VcsPlugins/vcsMercurial/hg.py

Sat, 17 Oct 2020 14:35:29 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 17 Oct 2020 14:35:29 +0200
changeset 7790
32b8db5a1fb4
parent 7785
9978016560ec
child 7791
f07ded9bc64d
permissions
-rw-r--r--

Editor: fixed an issue where a language change did not get propagated to the language menu and the language icon.

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
7360
9190402e4505 Updated copyright for 2020.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7257
diff changeset
3 # Copyright (c) 2010 - 2020 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
7790
32b8db5a1fb4 Editor: fixed an issue where a language change did not get propagated to the language menu and the language icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7785
diff changeset
309 # TODO: hg init has to be run with the hg command line client
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
310 args = self.initCommand("init")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311 args.append(projectDir)
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
312 # init is not possible with the command server
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
313 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
314 res = dia.startProcess(args)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
316 dia.exec()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 status = dia.normalExit()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 if status:
1906
8487f9c2533b Continued implementing support for Mercurial sub-repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1905
diff changeset
320 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
321 if not os.path.exists(ignoreName):
8487f9c2533b Continued implementing support for Mercurial sub-repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1905
diff changeset
322 status = self.hgCreateIgnoreFile(projectDir)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323
7167
b3557e77314a VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7155
diff changeset
324 if status and addAll:
3328
15aaa8d3a840 Fixed a bug in the Mercurial interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3315
diff changeset
325 args = self.initCommand("commit")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 args.append('--addremove')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 args.append('--message')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328 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
329 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
330 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
331 self)
966
890ec4c04ffe Fixed an issue with the Mercurial plug-in creating a new project with Mercurial VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 963
diff changeset
332 res = dia.startProcess(args, projectDir)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
334 dia.exec()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 status = dia.normalExit()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 return status, False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
339 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
340 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
341 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
342 (clone).
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344 @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
345 @param projectDir project directory to create (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
346 @param noDialog flag indicating quiet operations
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
347 @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
348 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349 noDialog = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
350 try:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
351 rev = vcsDataDict["revision"]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352 except KeyError:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 rev = None
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
354 vcsUrl = self.hgNormalizeURL(vcsDataDict["url"])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355
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
356 args = self.initCommand("clone")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357 if rev:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
358 args.append("--rev")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359 args.append(rev)
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3311
diff changeset
360 if vcsDataDict["largefiles"]:
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3311
diff changeset
361 args.append("--all-largefiles")
5548
95b188f96d3d Reworked the Mercurial checkout dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5514
diff changeset
362 args.append(vcsUrl)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
363 args.append(projectDir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365 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
366 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
367 return err == ""
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368 else:
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
369 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
370 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
371 self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 res = dia.startProcess(args)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
374 dia.exec()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 return dia.normalExit()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377 def vcsExport(self, vcsDataDict, projectDir):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
379 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
380
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381 @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
382 @param projectDir project directory to create (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 @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
384 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385 status = self.vcsCheckout(vcsDataDict, projectDir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386 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
387 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
388 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
389 return status
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
391 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
392 mq=False, merge=False):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
394 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
395 in the Mercurial repository.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
396
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
397 @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
398 strings)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399 @param message message for this operation (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 @param noDialog flag indicating quiet operations
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401 @keyparam closeBranch flag indicating a close branch commit (boolean)
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
402 @keyparam mq flag indicating a queue commit (boolean)
7152
a99df2004bb7 Commit Merge in Mercurial added and Cancel renamed to Abort Merge
Christos Sevastiadis <csevast@auth.gr>
parents: 7034
diff changeset
403 @keyparam 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
404 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405 msg = message
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406
7152
a99df2004bb7 Commit Merge in Mercurial added and Cancel renamed to Abort Merge
Christos Sevastiadis <csevast@auth.gr>
parents: 7034
diff changeset
407 if mq or merge:
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
408 # 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
409 noDialog = False
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
410
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
411 if not noDialog:
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 # call CommitDialog and get message from there
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 if self.__commitDialog is None:
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
414 from .HgCommitDialog import HgCommitDialog
7155
334c7d0b5036 Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7153
diff changeset
415 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
416 self.__ui)
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 417
diff changeset
417 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
418 self.__commitDialog.show()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419 self.__commitDialog.raise_()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 self.__commitDialog.activateWindow()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
421
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422 self.__commitData["name"] = name
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423 self.__commitData["msg"] = msg
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 self.__commitData["noDialog"] = noDialog
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 self.__commitData["closeBranch"] = closeBranch
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
426 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
427 self.__commitData["merge"] = merge
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
429 if noDialog:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 self.__vcsCommit_Step2()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
431
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432 def __vcsCommit_Step2(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
433 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
434 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
435 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436 name = self.__commitData["name"]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
437 msg = self.__commitData["msg"]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
438 noDialog = self.__commitData["noDialog"]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
439 closeBranch = self.__commitData["closeBranch"]
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
440 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
441 merge = self.__commitData["merge"]
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
442
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
443 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
444 # 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
445 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
446 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
447 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
448 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
449 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
450 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
451 # 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
452 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
453 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
454 if nam == project.getProjectPath():
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
455 ok &= (
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
456 project.checkAllScriptsDirty(
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
457 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
458 project.checkDirty()
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
459 )
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
460 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
461 elif os.path.isfile(nam):
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
462 editor = (
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
463 e5App().getObject("ViewManager").getOpenEditor(nam)
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
464 )
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
465 if editor:
2280
8e85ca3fabe7 Fixed a few PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2278
diff changeset
466 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
467 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
468 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
469
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 if not ok:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
471 res = E5MessageBox.yesNo(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
472 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
473 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
474 self.tr(
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
475 """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
476 """ 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
477 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
478 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
479 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
480
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
481 if isinstance(name, list):
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
482 dname, fnames = self.splitPathList(name)
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
483 else:
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
484 dname, fname = self.splitPath(name)
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
485
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
486 # find the root of the repo
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 repodir = dname
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
488 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
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
489 repodir = os.path.dirname(repodir)
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
490 if os.path.splitdrive(repodir)[1] == os.sep:
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
491 return
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
492
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
493 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
494 (msg, amend, commitSubrepositories, author,
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
495 dateTime) = self.__commitDialog.getCommitData()
2318
3a3ee7cc2ad6 Changed some signal handlings (disconnect).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
496 self.__commitDialog.deleteLater()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
497 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
498 if amend and not msg:
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
499 msg = self.__getMostRecentCommitMessage(repodir)
1855
93bf1823466a Added support for amending commits as of Mercurial 2.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1811
diff changeset
500 else:
93bf1823466a Added support for amending commits as of Mercurial 2.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1811
diff changeset
501 amend = False
1906
8487f9c2533b Continued implementing support for Mercurial sub-repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1905
diff changeset
502 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
503 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
504 dateTime = ""
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
505
1855
93bf1823466a Added support for amending commits as of Mercurial 2.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1811
diff changeset
506 if not msg and not amend:
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
507 msg = '***'
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
508
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
509 args = self.initCommand("commit")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
510 args.append("-v")
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
511 if mq:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
512 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
513 elif merge:
7153
ca02892fde13 Merged with merge changes supplied by Christos Sevastiadisi.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7152
diff changeset
514 if author:
ca02892fde13 Merged with merge changes supplied by Christos Sevastiadisi.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7152
diff changeset
515 args.append("--user")
ca02892fde13 Merged with merge changes supplied by Christos Sevastiadisi.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7152
diff changeset
516 args.append(author)
ca02892fde13 Merged with merge changes supplied by Christos Sevastiadisi.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7152
diff changeset
517 if dateTime:
ca02892fde13 Merged with merge changes supplied by Christos Sevastiadisi.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7152
diff changeset
518 args.append("--date")
ca02892fde13 Merged with merge changes supplied by Christos Sevastiadisi.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7152
diff changeset
519 args.append(dateTime)
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
520 else:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
521 if closeBranch:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
522 args.append("--close-branch")
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
523 if amend:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
524 args.append("--amend")
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
525 if commitSubrepositories:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
526 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
527 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
528 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
529 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
530 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
531 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
532 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
533 if msg:
93bf1823466a Added support for amending commits as of Mercurial 2.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1811
diff changeset
534 args.append("--message")
93bf1823466a Added support for amending commits as of Mercurial 2.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1811
diff changeset
535 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
536 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
537 self.addArguments(args, name)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
538 else:
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
539 if dname != repodir or fname != ".":
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
540 args.append(name)
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
541
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
542 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
543 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
544 self)
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
545 res = dia.startProcess(args, dname)
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
546 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
547 dia.exec()
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 417
diff changeset
548 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
549 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
550 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
551 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
552 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
553 self.__forgotNames = []
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
554 self.checkVCSStatus()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
555
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
556 def __getMostRecentCommitMessage(self, repodir):
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 """
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 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
559
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
560 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
561 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
562
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 @param repodir path containing the repository
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
564 @type 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
565 @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
566 @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
567 """
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
568 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
569 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
570 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
571 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
572 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
573
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
574 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
575
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
576 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
577
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
578 def vcsUpdate(self, name, noDialog=False, revision=None):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
579 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
580 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
581 repository.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
582
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
583 @param name file/directory name to be updated (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
584 strings)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
585 @param noDialog flag indicating quiet operations (boolean)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
586 @keyparam revision revision to update to (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
587 @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
588 or delete (boolean)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
589 """
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
590 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
591 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
592 args.append("-v")
3382
de914da071c8 Fixed a little issue in the Mercurial interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3359
diff changeset
593 if revision:
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
594 args.append("-r")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
595 args.append(revision)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
596
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
597 if isinstance(name, list):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
598 dname, fnames = self.splitPathList(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
599 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
600 dname, fname = self.splitPath(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
601
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
602 # find the root of the repo
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
603 repodir = dname
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
604 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
605 repodir = os.path.dirname(repodir)
1318
6fa303bd65d6 Fixed issues in various Mercurial files that could cause infinite loops on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1315
diff changeset
606 if os.path.splitdrive(repodir)[1] == os.sep:
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
607 return False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
608
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
609 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
610 out, err = self.__client.runcommand(args)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
611 res = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
612 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
613 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
614 '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
615 self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
616 res = dia.startProcess(args, repodir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
617 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
618 dia.exec()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
619 res = dia.hasAddOrDelete()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
620 self.checkVCSStatus()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
621 return res
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 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
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 to the Mercurial repository.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
626
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
627 @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
628 @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
629 @param noDialog flag indicating quiet operations
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
630 """
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
631 args = self.initCommand("add")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
632 args.append("-v")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
633
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
634 if isinstance(name, list):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
635 if isDir:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
636 dname, fname = os.path.split(name[0])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
637 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
638 dname, fnames = self.splitPathList(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
639 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
640 if isDir:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
641 dname, fname = os.path.split(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
642 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
643 dname, fname = self.splitPath(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
644
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
645 # find the root of the repo
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
646 repodir = dname
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
647 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
648 repodir = os.path.dirname(repodir)
1318
6fa303bd65d6 Fixed issues in various Mercurial files that could cause infinite loops on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1315
diff changeset
649 if os.path.splitdrive(repodir)[1] == os.sep:
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
650 return
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
651
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
652 if isinstance(name, list):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
653 self.addArguments(args, name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
654 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
655 args.append(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
656
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
657 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
658 out, err = self.__client.runcommand(args)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
659 else:
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 553
diff changeset
660 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
661 self.tr(
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
662 '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
663 self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
664 res = dia.startProcess(args, repodir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
665 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
666 dia.exec()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
667
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
668 def vcsAddBinary(self, name, isDir=False):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
669 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
670 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
671 Mercurial repository.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
672
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
673 @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
674 @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
675 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
676 self.vcsAdd(name, isDir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
677
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
678 def vcsAddTree(self, path):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
679 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
680 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
681 repository.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
682
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
683 @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
684 strings))
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
685 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
686 self.vcsAdd(path, isDir=False)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
687
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
688 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
689 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
690 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
691 repository.
178
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 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
694
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
695 @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
696 strings))
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
697 @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
698 (not needed)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
699 @param noDialog flag indicating quiet operations
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
700 @return flag indicating successfull operation (boolean)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
701 """
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
702 args = self.initCommand("remove")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
703 args.append("-v")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
704 if noDialog and '--force' not in args:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
705 args.append('--force')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
706
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
707 if isinstance(name, list):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
708 dname, fnames = self.splitPathList(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
709 self.addArguments(args, name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
710 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
711 dname, fname = self.splitPath(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
712 args.append(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
713
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
714 # find the root of the repo
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
715 repodir = dname
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
716 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
717 repodir = os.path.dirname(repodir)
1318
6fa303bd65d6 Fixed issues in various Mercurial files that could cause infinite loops on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1315
diff changeset
718 if os.path.splitdrive(repodir)[1] == os.sep:
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
719 return False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
720
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
721 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
722 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
723 res = err == ""
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
724 else:
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 553
diff changeset
725 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
726 self.tr(
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
727 '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
728 ' 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
729 self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
730 res = dia.startProcess(args, repodir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
731 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
732 dia.exec()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
733 res = dia.normalExitWithoutErrors()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
734
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
735 return res
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
736
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
737 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
738 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
739 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
740
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
741 @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
742 @param project reference to the project object
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
743 @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
744 @param noDialog flag indicating quiet operations
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
745 @return flag indicating successfull operation (boolean)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
746 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
747 isDir = os.path.isdir(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
748
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
749 res = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
750 if noDialog:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
751 if target is None:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
752 return False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
753 force = True
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
754 accepted = True
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
755 else:
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
756 from .HgCopyDialog import HgCopyDialog
3306
0a4e5082cbc6 Last changes to the Mercurial shelve extension interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3305
diff changeset
757 dlg = HgCopyDialog(name, None, True)
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
758 accepted = dlg.exec() == QDialog.Accepted
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
759 if accepted:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
760 target, force = dlg.getData()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
761
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
762 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
763 args = self.initCommand("rename")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
764 args.append("-v")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
765 if force:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
766 args.append('--force')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
767 args.append(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
768 args.append(target)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
769
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
770 dname, fname = self.splitPath(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
771 # find the root of the repo
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
772 repodir = dname
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
773 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
774 repodir = os.path.dirname(repodir)
1318
6fa303bd65d6 Fixed issues in various Mercurial files that could cause infinite loops on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1315
diff changeset
775 if os.path.splitdrive(repodir)[1] == os.sep:
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
776 return False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
777
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
778 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
779 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
780 res = err == ""
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
781 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
782 dia = HgDialog(self.tr('Renaming {0}').format(name), self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
783 res = dia.startProcess(args, repodir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
784 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
785 dia.exec()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
786 res = dia.normalExit()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
787 if res:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
788 if target.startswith(project.getProjectPath()):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
789 if isDir:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
790 project.moveDirectory(name, target)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
791 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
792 project.renameFileInPdata(name, target)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
793 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
794 if isDir:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
795 project.removeDirectory(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
796 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
797 project.removeFile(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
798 return res
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
799
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
800 def vcsDiff(self, name):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
801 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
802 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
803 Mercurial repository.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
804
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
805 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
806 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
807 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
808 operation may be aborted.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
809
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
810 @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
811 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
812 if isinstance(name, list):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
813 names = name[:]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
814 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
815 names = [name]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
816 for nam in names:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
817 if os.path.isfile(nam):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
818 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
819 if editor and not editor.checkDirty():
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
820 return
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
821 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
822 project = e5App().getObject("Project")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
823 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
824 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
825 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
826 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
827 self.diff = HgDiffDialog(self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
828 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
829 self.diff.raise_()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
830 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
831 self.diff.start(name, refreshable=True)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
832
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
833 def vcsStatus(self, name):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
834 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
835 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
836 Mercurial repository.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
837
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
838 @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
839 (string or list of strings)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
840 """
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
841 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
842 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
843 self.status = HgStatusDialog(self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
844 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
845 self.status.raise_()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
846 self.status.start(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
847
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3311
diff changeset
848 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
849 """
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
850 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
851 working directory state.
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
852
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
853 @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
854 @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
855 well (boolean)
2811
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
856 """
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
857 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
858 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
859 self.summary = HgSummaryDialog(self)
2811
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
860 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
861 self.summary.raise_()
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
862 self.summary.start(self.__projectHelper.getProject().getProjectPath(),
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3311
diff changeset
863 mq=mq, largefiles=largefiles)
2811
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
864
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
865 def vcsTag(self, name, revision=None, tagName=None):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
866 """
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
867 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
868
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
869 @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
870 (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
871 @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
872 @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
873 @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
874 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
875 dname, fname = self.splitPath(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
876
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
877 # find the root of the repo
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
878 repodir = dname
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
879 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
880 repodir = os.path.dirname(repodir)
1318
6fa303bd65d6 Fixed issues in various Mercurial files that could cause infinite loops on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1315
diff changeset
881 if os.path.splitdrive(repodir)[1] == os.sep:
6891
93f82da09f22 Fixed some code style issues detected by the new 'return' checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
882 return False
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
883
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
884 from .HgTagDialog import HgTagDialog
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
885 dlg = HgTagDialog(self.hgGetTagsList(repodir, withType=True),
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
886 revision, tagName)
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
887 if dlg.exec() == QDialog.Accepted:
5345
c7c3f9de2d1c Added capability to enforce a Mercurial tagging operation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5330
diff changeset
888 tag, revision, tagOp, force = dlg.getParameters()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
889 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
890 return False
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
891
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
892 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
893 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
894 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
895 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
896 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
897 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
898 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
899 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
900 args.append('--remove')
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
901 if tagOp in [HgTagDialog.CreateGlobalTag, HgTagDialog.CreateLocalTag]:
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
902 if revision:
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
903 args.append("--rev")
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
904 args.append(revision)
5345
c7c3f9de2d1c Added capability to enforce a Mercurial tagging operation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5330
diff changeset
905 if force:
c7c3f9de2d1c Added capability to enforce a Mercurial tagging operation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5330
diff changeset
906 args.append("--force")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
907 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
908 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
909 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
910 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
911 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
912 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
913 args.append(tag)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
914
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
915 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
916 self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
917 res = dia.startProcess(args, repodir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
918 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
919 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
920
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
921 return True
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
922
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
923 def hgRevert(self, name):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
924 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
925 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
926
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
927 @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
928 @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
929 or delete (boolean)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
930 """
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
931 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
932 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
933 args.append("--no-backup")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
934 args.append("-v")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
935 if isinstance(name, list):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
936 dname, fnames = self.splitPathList(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
937 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
938 names = name[:]
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
939 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
940 dname, fname = self.splitPath(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
941 args.append(name)
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
942 names = [name]
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
943
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
944 # find the root of the repo
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
945 repodir = dname
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
946 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
947 repodir = os.path.dirname(repodir)
1318
6fa303bd65d6 Fixed issues in various Mercurial files that could cause infinite loops on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1315
diff changeset
948 if os.path.splitdrive(repodir)[1] == os.sep:
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
949 return False
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
950
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
951 project = e5App().getObject("Project")
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
952 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
953 if names[0]:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
954 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
955 DeleteFilesConfirmationDialog
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
956 )
3023
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
957 dlg = DeleteFilesConfirmationDialog(
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
958 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
959 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
960 self.tr(
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
961 "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
962 " or directories?"),
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
963 names)
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
964 yes = dlg.exec() == QDialog.Accepted
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
965 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
966 yes = E5MessageBox.yesNo(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
967 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
968 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
969 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
970 """ the project?"""))
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
971 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
972 dia = HgDialog(self.tr('Reverting changes'), self)
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
973 res = dia.startProcess(args, repodir)
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
974 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
975 dia.exec()
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
976 res = dia.hasAddOrDelete()
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
977 self.checkVCSStatus()
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
978 else:
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
979 res = False
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
980
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
981 return res
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
982
5496
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
983 def vcsMerge(self, name, rev=""):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
984 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
985 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
986
5496
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
987 @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
988 @type str
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
989 @keyparam rev revision to merge with
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
990 @type str
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
991 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
992 dname, fname = self.splitPath(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
993
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
994 # find the root of the repo
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
995 repodir = dname
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
996 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
997 repodir = os.path.dirname(repodir)
1318
6fa303bd65d6 Fixed issues in various Mercurial files that could cause infinite loops on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1315
diff changeset
998 if os.path.splitdrive(repodir)[1] == os.sep:
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
999 return
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1000
5496
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
1001 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
1002 from .HgMergeDialog import HgMergeDialog
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
1003 dlg = HgMergeDialog(self.hgGetTagsList(repodir),
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
1004 self.hgGetBranchesList(repodir),
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
1005 self.hgGetBookmarksList(repodir))
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
1006 if dlg.exec() == QDialog.Accepted:
5496
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
1007 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
1008 else:
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
1009 return
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1010 else:
5496
d157a2319073 Added a 'Merge' action to the Mercurial log browser action menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
1011 force = False
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1012
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
1013 args = self.initCommand("merge")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1014 if force:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1015 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
1016 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
1017 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
1018 args.append("internal:merge")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1019 if rev:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1020 args.append("--rev")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1021 args.append(rev)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1022
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3185
diff changeset
1023 dia = HgDialog(self.tr('Merging').format(name), self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1024 res = dia.startProcess(args, repodir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1025 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7719
diff changeset
1026 dia.exec()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1027 self.checkVCSStatus()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1028
3586
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
1029 def hgReMerge(self, name):
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
1030 """
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
1031 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
1032
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
1033 @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
1034 """
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
1035 args = self.initCommand("resolve")
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
1036 if self.getPlugin().getPreferences("InternalMerge"):
6e3a6c5b58bf Added support for various Mercurial 'resolve' subcommands.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3578
diff changeset
1037 args.append("--tool")</