Plugins/VcsPlugins/vcsMercurial/hg.py

Sat, 05 Jul 2014 12:23:15 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 05 Jul 2014 12:23:15 +0200
branch
5_4_x
changeset 3672
01e4aee3c3ee
parent 3437
478c6fa42557
permissions
-rw-r--r--

Fixed an issue in the Mercurial plug-in parsing the status data.
(grafted from e8a37c412d287aab9f5c36de313f00da9b8cf7ae)

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
3160
209a07d7e401 Updated copyright for 2014.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3036
diff changeset
3 # Copyright (c) 2010 - 2014 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
1263
1b6054a9b668 Fixed the treatment of the Mercurial version number.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1252
diff changeset
12 import re
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
13 import urllib.parse
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
15 from PyQt4.QtCore import QProcess, pyqtSignal, QFileInfo, QFileSystemWatcher
882
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 880
diff changeset
16 from PyQt4.QtGui 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
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
27
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 import Preferences
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
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 """
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 417
diff changeset
40 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
41 activeExtensionsChanged = pyqtSignal()
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 417
diff changeset
42
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
43 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
44
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
45 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
46 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 Constructor
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 @param plugin reference to the plugin object
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 @param parent parent widget (QWidget)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 @param name name of this object (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 VersionControl.__init__(self, parent, name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 self.defaultOptions = {
3245
48311fa7c52c Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
55 'global': [''],
48311fa7c52c Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
56 '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
57 'checkout': [''],
3245
48311fa7c52c Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
58 'update': [''],
48311fa7c52c Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
59 'add': [''],
48311fa7c52c Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
60 'remove': [''],
48311fa7c52c Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
61 'diff': [''],
48311fa7c52c Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
62 'log': [''],
48311fa7c52c Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
63 'history': [''],
48311fa7c52c Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
64 'status': [''],
48311fa7c52c Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
65 'tag': [''],
48311fa7c52c Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
66 'export': ['']
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 }
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 self.__plugin = plugin
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 self.__ui = parent
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.options = self.defaultOptions
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 self.tagsList = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 self.branchesList = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 self.allTagsBranchesList = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 self.showedTags = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 self.showedBranches = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 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
80 'tags',
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
81 'branches',
178
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
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 self.commandHistory = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 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
87 self.adminDir = '_hg'
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 self.adminDir = '.hg'
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 self.log = None
1018
949812411ab8 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1017
diff changeset
92 self.logBrowser = None
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 self.diff = None
2838
0f1423054184 Continued extending the Mercurial side-by-side diff support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2837
diff changeset
94 self.sbsDiff = None
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 self.status = None
2811
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
96 self.summary = None
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 self.tagbranchList = None
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 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
99 self.repoEditor = None
10bdbb173c0f Added an entry to the Mercurial menu to edit the user configuration file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
100 self.userEditor = 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
101 self.serveDlg = 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
102
207
3f889378dede Added some code to inspect incoming patches as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 205
diff changeset
103 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
104 self.__lastChangeGroupPath = None
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 self.statusCache = {}
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 self.__commitData = {}
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 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
110
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
111 self.__forgotNames = []
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
112
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
113 self.__activeExtensions = []
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
114
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
115 from .HgUtilities import getConfigPath
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
116 self.__iniWatcher = QFileSystemWatcher(self)
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
117 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
118 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
119 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
120 self.__iniWatcher.addPath(cfgFile)
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
121
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
122 self.__client = None
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
123
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
124 # instantiate the extensions
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
125 from .BookmarksExtension.bookmarks import Bookmarks
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
126 from .QueuesExtension.queues import Queues
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
127 from .FetchExtension.fetch import Fetch
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
128 from .PurgeExtension.purge import Purge
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
129 from .GpgExtension.gpg import Gpg
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
130 from .TransplantExtension.transplant import Transplant
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
131 from .RebaseExtension.rebase import Rebase
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
132 self.__extensions = {
1061
3e21869872e3 Fixed PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
133 "bookmarks": Bookmarks(self),
3e21869872e3 Fixed PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
134 "mq": Queues(self),
1066
a3dd41fd9ea8 Added support for the Mercurial fetch extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1064
diff changeset
135 "fetch": Fetch(self),
1071
ac0f74c0b870 Added support for the Mercurial purge extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1070
diff changeset
136 "purge": Purge(self),
1075
75bfe8bd4243 Added support for the Mercurial gpg extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1071
diff changeset
137 "gpg": Gpg(self),
1078
aeee8401e2ce Added support for the Mercurial transplant extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1076
diff changeset
138 "transplant": Transplant(self),
1093
47bc4ef30315 Added support for the Mercurial rebase extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1088
diff changeset
139 "rebase": Rebase(self),
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
140 }
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 def getPlugin(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 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
145
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 @return reference to the plugin object (VcsMercurialPlugin)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 return self.__plugin
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 def vcsShutdown(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 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
153 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 if self.log is not None:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 self.log.close()
1018
949812411ab8 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1017
diff changeset
156 if self.logBrowser is not None:
949812411ab8 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1017
diff changeset
157 self.logBrowser.close()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 if self.diff is not None:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 self.diff.close()
2838
0f1423054184 Continued extending the Mercurial side-by-side diff support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2837
diff changeset
160 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
161 self.sbsDiff.close()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 if self.status is not None:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 self.status.close()
2811
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
164 if self.summary is not None:
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
165 self.summary.close()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 if self.tagbranchList is not None:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 self.tagbranchList.close()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 if self.annotate is not None:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 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
170 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
171 self.serveDlg.close()
207
3f889378dede Added some code to inspect incoming patches as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 205
diff changeset
172
3f889378dede Added some code to inspect incoming patches as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 205
diff changeset
173 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
174 os.remove(self.bundleFile)
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
175
1076
6fb76985422b Changed code to close torn off submenus of the Mercurial project menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1075
diff changeset
176 # shut down the project helpers
6fb76985422b Changed code to close torn off submenus of the Mercurial project menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1075
diff changeset
177 self.__projectHelper.shutdown()
6fb76985422b Changed code to close torn off submenus of the Mercurial project menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1075
diff changeset
178
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
179 # shut down the extensions
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
180 for extension in self.__extensions.values():
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
181 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
182
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
183 # 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
184 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
185
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
186 def getClient(self):
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
187 """
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
188 Public method to get a reference to the command server interface.
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
189
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
190 @return reference to the client (HgClient)
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
191 """
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
192 return self.__client
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 def vcsExists(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 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
197
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
198 @return flag indicating the existance (boolean) and an error message
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
199 (string)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 self.versionStr = ''
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 errMsg = ""
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 ioEncoding = Preferences.getSystem("IOEncoding")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 process = QProcess()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 process.start('hg', ['version'])
2771
281c9b30dd91 Changed all QProcess.waitForStarted() calls to use a 5s timeout (except the debugger interfaces, which have a 10s timeout).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2718
diff changeset
207 procStarted = process.waitForStarted(5000)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 if procStarted:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 finished = process.waitForFinished(30000)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 if finished and process.exitCode() == 0:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 output = \
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 str(process.readAllStandardOutput(), ioEncoding, 'replace')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 self.versionStr = output.splitlines()[0].split()[-1][0:-1]
1263
1b6054a9b668 Fixed the treatment of the Mercurial version number.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1252
diff changeset
214 v = list(re.match(r'.*?(\d+)\.(\d+)\.?(\d+)?(\+[0-9a-f-]+)?',
1b6054a9b668 Fixed the treatment of the Mercurial version number.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1252
diff changeset
215 self.versionStr).groups())
1b6054a9b668 Fixed the treatment of the Mercurial version number.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1252
diff changeset
216 for i in range(3):
1b6054a9b668 Fixed the treatment of the Mercurial version number.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1252
diff changeset
217 try:
1b6054a9b668 Fixed the treatment of the Mercurial version number.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1252
diff changeset
218 v[i] = int(v[i])
1b6054a9b668 Fixed the treatment of the Mercurial version number.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1252
diff changeset
219 except TypeError:
1b6054a9b668 Fixed the treatment of the Mercurial version number.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1252
diff changeset
220 v[i] = 0
1b6054a9b668 Fixed the treatment of the Mercurial version number.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1252
diff changeset
221 except IndexError:
1b6054a9b668 Fixed the treatment of the Mercurial version number.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1252
diff changeset
222 v.append(0)
1b6054a9b668 Fixed the treatment of the Mercurial version number.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1252
diff changeset
223 self.version = tuple(v)
1011
0b118aefae5b Started implementing the Mercurial bookmarks support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1005
diff changeset
224 self.__getExtensionsInfo()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225 return True, errMsg
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 if finished:
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
228 errMsg = self.trUtf8(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
229 "The hg process finished with the exit code {0}")\
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230 .format(process.exitCode())
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 else:
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
232 errMsg = self.trUtf8(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
233 "The hg process did not finish within 30s.")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 errMsg = self.trUtf8("Could not start the hg executable.")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 return False, errMsg
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
239 def vcsInit(self, vcsDir, noDialog=False):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241 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
242
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
243 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
244 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
245 doing anything.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 @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
248 @param noDialog flag indicating quiet operations (boolean)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 @return always TRUE
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 return True
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 def vcsConvertProject(self, vcsDataDict, project):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
255 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
256 controlled project.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 @param vcsDataDict dictionary of data required for the conversion
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 @param project reference to the project object
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 success = self.vcsImport(vcsDataDict, project.ppath)[0]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 if not success:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
263 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
264 self.__ui,
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 self.trUtf8("Create project repository"),
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
266 self.trUtf8(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
267 """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
268 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 pfn = project.pfile
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 if not os.path.isfile(pfn):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 pfn += "z"
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272 project.closeProject()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 project.openProject(pfn)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
275 def vcsImport(self, vcsDataDict, projectDir, noDialog=False):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
277 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
278
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 @param vcsDataDict dictionary of data required for the import
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 @param projectDir project directory (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 @param noDialog flag indicating quiet operations
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 @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
283 and a flag indicating the version controll status (boolean)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 msg = vcsDataDict["message"]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 if not msg:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 msg = '***'
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 args = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 args.append('init')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291 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
292 # init is not possible with the command server
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
293 dia = HgDialog(self.trUtf8('Creating Mercurial repository'), self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 res = dia.startProcess(args)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 if res:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 dia.exec_()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 status = dia.normalExit()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299 if status:
1906
8487f9c2533b Continued implementing support for Mercurial sub-repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1905
diff changeset
300 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
301 if not os.path.exists(ignoreName):
8487f9c2533b Continued implementing support for Mercurial sub-repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1905
diff changeset
302 status = self.hgCreateIgnoreFile(projectDir)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304 if status:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 args = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 args.append('commit')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 args.append('--addremove')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 args.append('--message')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 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
310 dia = HgDialog(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
311 self.trUtf8('Initial commit to Mercurial repository'),
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
312 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
313 res = dia.startProcess(args, projectDir)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 if res:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 dia.exec_()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 status = dia.normalExit()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 return status, False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
320 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
321 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
322 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
323 (clone).
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 @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
326 @param projectDir project directory to create (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 @param noDialog flag indicating quiet operations
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328 @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
329 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 noDialog = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 try:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 rev = vcsDataDict["revision"]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 except KeyError:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 rev = None
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 vcsUrl = self.hgNormalizeURL(vcsDataDict["url"])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 if vcsUrl.startswith('/'):
417
459855d3066e Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 347
diff changeset
337 vcsUrl = 'file://{0}'.format(vcsUrl)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 elif vcsUrl[1] in ['|', ':']:
417
459855d3066e Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 347
diff changeset
339 vcsUrl = 'file:///{0}'.format(vcsUrl)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341 args = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
342 args.append('clone')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343 self.addArguments(args, self.options['global'])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344 self.addArguments(args, self.options['checkout'])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345 if rev:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
346 args.append("--rev")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
347 args.append(rev)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348 args.append(self.__hgURL(vcsUrl))
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349 args.append(projectDir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
350
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
351 if noDialog:
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
352 if self.__client is None:
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
353 return self.startSynchronizedProcess(QProcess(), 'hg', args)
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
354 else:
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
355 out, err = self.__client.runcommand(args)
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
356 return err == ""
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357 else:
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
358 dia = HgDialog(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
359 self.trUtf8('Cloning project from a Mercurial repository'),
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
360 self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361 res = dia.startProcess(args)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362 if res:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
363 dia.exec_()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364 return dia.normalExit()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 def vcsExport(self, vcsDataDict, projectDir):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
368 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
369
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370 @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
371 @param projectDir project directory to create (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 @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
373 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374 status = self.vcsCheckout(vcsDataDict, projectDir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 shutil.rmtree(os.path.join(projectDir, self.adminDir), True)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 if os.path.exists(os.path.join(projectDir, '.hgignore')):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377 os.remove(os.path.join(projectDir, '.hgignore'))
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 return status
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
380 def vcsCommit(self, name, message, noDialog=False, closeBranch=False,
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
381 mq=False):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
383 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
384 in the Mercurial repository.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
386 @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
387 strings)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
388 @param message message for this operation (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389 @param noDialog flag indicating quiet operations
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390 @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
391 @keyparam mq flag indicating a queue commit (boolean)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 msg = message
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
395 if mq:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
396 # 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
397 noDialog = False
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
398
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399 if not noDialog and not msg:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 # call CommitDialog and get message from there
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401 if self.__commitDialog is None:
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
402 from .HgCommitDialog import HgCommitDialog
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
403 self.__commitDialog = HgCommitDialog(self, mq, self.__ui)
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 417
diff changeset
404 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
405 self.__commitDialog.show()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406 self.__commitDialog.raise_()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 self.__commitDialog.activateWindow()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 self.__commitData["name"] = name
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410 self.__commitData["msg"] = msg
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411 self.__commitData["noDialog"] = noDialog
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 self.__commitData["closeBranch"] = closeBranch
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
413 self.__commitData["mq"] = mq
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415 if noDialog:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 self.__vcsCommit_Step2()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 def __vcsCommit_Step2(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 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
421 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422 name = self.__commitData["name"]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423 msg = self.__commitData["msg"]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 noDialog = self.__commitData["noDialog"]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 closeBranch = self.__commitData["closeBranch"]
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
426 mq = self.__commitData["mq"]
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
427
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
428 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
429 # 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
430 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
431 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
432 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
433 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
434 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
435 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
436 # 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
437 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
438 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
439 if nam == project.getProjectPath():
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
440 ok &= \
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
441 project.checkAllScriptsDirty(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
442 reportSyntaxErrors=True) and \
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
443 project.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
444 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
445 elif os.path.isfile(nam):
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
446 editor = \
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
447 e5App().getObject("ViewManager").getOpenEditor(nam)
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
448 if editor:
2280
8e85ca3fabe7 Fixed a few PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2278
diff changeset
449 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
450 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
451 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
452
105f425944a2 Extended the commit of all supported version control system interfaces to check for unsaved changes, that would otherwise be forgotten.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1990
diff changeset
453 if not ok:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
454 res = E5MessageBox.yesNo(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
455 self.__ui,
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
456 self.trUtf8("Commit Changes"),
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
457 self.trUtf8(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
458 """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
459 """ 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
460 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
461 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
462 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
463
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
464 if self.__commitDialog is not None:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
465 msg = self.__commitDialog.logMessage()
1855
93bf1823466a Added support for amending commits as of Mercurial 2.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1811
diff changeset
466 amend = self.__commitDialog.amend()
1906
8487f9c2533b Continued implementing support for Mercurial sub-repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1905
diff changeset
467 commitSubrepositories = self.__commitDialog.commitSubrepositories()
2318
3a3ee7cc2ad6 Changed some signal handlings (disconnect).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
468 self.__commitDialog.deleteLater()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
469 self.__commitDialog = None
1855
93bf1823466a Added support for amending commits as of Mercurial 2.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1811
diff changeset
470 else:
93bf1823466a Added support for amending commits as of Mercurial 2.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1811
diff changeset
471 amend = False
1906
8487f9c2533b Continued implementing support for Mercurial sub-repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1905
diff changeset
472 commitSubrepositories = False
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
473
1855
93bf1823466a Added support for amending commits as of Mercurial 2.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1811
diff changeset
474 if not msg and not amend:
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
475 msg = '***'
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
476
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
477 args = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
478 args.append('commit')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
479 self.addArguments(args, self.options['global'])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
480 self.addArguments(args, self.options['commit'])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
481 args.append("-v")
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
482 if mq:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
483 args.append("--mq")
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
484 else:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
485 if closeBranch:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
486 args.append("--close-branch")
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
487 if amend:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
488 args.append("--amend")
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
489 if commitSubrepositories:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2811
diff changeset
490 args.append("--subrepos")
1855
93bf1823466a Added support for amending commits as of Mercurial 2.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1811
diff changeset
491 if msg:
93bf1823466a Added support for amending commits as of Mercurial 2.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1811
diff changeset
492 args.append("--message")
93bf1823466a Added support for amending commits as of Mercurial 2.2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1811
diff changeset
493 args.append(msg)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
494 if isinstance(name, list):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
495 dname, fnames = self.splitPathList(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
496 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
497 dname, fname = self.splitPath(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
498
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
499 # find the root of the repo
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
500 repodir = dname
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
501 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
502 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
503 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
504 return
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
505
1243
d68d8b2a37b3 Fixed an issue in hg.py causing single file commits to fail.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1240
diff changeset
506 if self.__client:
d68d8b2a37b3 Fixed an issue in hg.py causing single file commits to fail.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1240
diff changeset
507 if isinstance(name, list):
d68d8b2a37b3 Fixed an issue in hg.py causing single file commits to fail.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1240
diff changeset
508 self.addArguments(args, name)
d68d8b2a37b3 Fixed an issue in hg.py causing single file commits to fail.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1240
diff changeset
509 else:
1378
f18a99689f2a Fixed an issue in the Mercurial command line server interface code of commit causing a commit of a merge to fail.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1318
diff changeset
510 if dname != repodir or fname != ".":
f18a99689f2a Fixed an issue in the Mercurial command line server interface code of commit causing a commit of a merge to fail.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1318
diff changeset
511 args.append(name)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
512 else:
1243
d68d8b2a37b3 Fixed an issue in hg.py causing single file commits to fail.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1240
diff changeset
513 if isinstance(name, list):
d68d8b2a37b3 Fixed an issue in hg.py causing single file commits to fail.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1240
diff changeset
514 self.addArguments(args, fnames)
d68d8b2a37b3 Fixed an issue in hg.py causing single file commits to fail.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1240
diff changeset
515 else:
d68d8b2a37b3 Fixed an issue in hg.py causing single file commits to fail.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1240
diff changeset
516 if dname != repodir or fname != ".":
d68d8b2a37b3 Fixed an issue in hg.py causing single file commits to fail.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1240
diff changeset
517 args.append(fname)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
518
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
519 if noDialog:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
520 self.startSynchronizedProcess(QProcess(), "hg", args, dname)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
521 else:
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
522 dia = HgDialog(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
523 self.trUtf8('Committing changes to Mercurial repository'),
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
524 self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
525 res = dia.startProcess(args, dname)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
526 if res:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
527 dia.exec_()
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 417
diff changeset
528 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
529 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
530 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
531 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
532 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
533 self.__forgotNames = []
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
534 self.checkVCSStatus()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
535
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
536 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
537 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
538 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
539 repository.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
540
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
541 @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
542 strings)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
543 @param noDialog flag indicating quiet operations (boolean)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
544 @keyparam revision revision to update to (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
545 @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
546 or delete (boolean)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
547 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
548 args = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
549 args.append('update')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
550 self.addArguments(args, self.options['global'])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
551 self.addArguments(args, self.options['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
552 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
553 args.append("-v")
3384
4908a9d74fb5 Fixed a little issue in the Mercurial interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3303
diff changeset
554 if revision:
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
555 args.append("-r")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
556 args.append(revision)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558 if isinstance(name, list):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
559 dname, fnames = self.splitPathList(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
560 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
561 dname, fname = self.splitPath(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
562
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
563 # find the root of the repo
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
564 repodir = dname
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
565 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
566 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
567 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
568 return False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
569
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
570 if noDialog:
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
571 if self.__client is None:
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
572 self.startSynchronizedProcess(QProcess(), 'hg', args, repodir)
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
573 else:
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
574 out, err = self.__client.runcommand(args)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
575 res = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
576 else:
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
577 dia = HgDialog(self.trUtf8(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
578 '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
579 self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
580 res = dia.startProcess(args, repodir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
581 if res:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
582 dia.exec_()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
583 res = dia.hasAddOrDelete()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
584 self.checkVCSStatus()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
585 return res
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
586
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
587 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
588 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
589 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
590
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
591 @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
592 @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
593 @param noDialog flag indicating quiet operations
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
594 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
595 args = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
596 args.append('add')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
597 self.addArguments(args, self.options['global'])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
598 self.addArguments(args, self.options['add'])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
599 args.append("-v")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
600
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
601 if isinstance(name, list):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
602 if isDir:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
603 dname, fname = os.path.split(name[0])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
604 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
605 dname, fnames = self.splitPathList(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
606 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
607 if isDir:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
608 dname, fname = os.path.split(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
609 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
610 dname, fname = self.splitPath(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
611
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
612 # find the root of the repo
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
613 repodir = dname
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
614 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
615 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
616 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
617 return
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
618
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
619 if isinstance(name, list):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
620 self.addArguments(args, name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
621 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
622 args.append(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
623
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
624 if noDialog:
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
625 if self.__client is None:
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
626 self.startSynchronizedProcess(QProcess(), 'hg', args, repodir)
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
627 else:
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
628 out, err = self.__client.runcommand(args)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
629 else:
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 553
diff changeset
630 dia = HgDialog(
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
631 self.trUtf8(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
632 '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
633 self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
634 res = dia.startProcess(args, repodir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
635 if res:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
636 dia.exec_()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
637
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
638 def vcsAddBinary(self, name, isDir=False):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
639 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
640 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
641 Mercurial repository.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
642
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
643 @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
644 @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
645 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
646 self.vcsAdd(name, isDir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
647
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
648 def vcsAddTree(self, path):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
649 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
650 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
651 repository.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
652
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
653 @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
654 strings))
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
655 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
656 self.vcsAdd(path, isDir=False)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
657
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
658 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
659 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
660 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
661 repository.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
662
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
663 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
664
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
665 @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
666 strings))
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
667 @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
668 (not needed)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
669 @param noDialog flag indicating quiet operations
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
670 @return flag indicating successfull operation (boolean)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
671 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
672 args = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
673 args.append('remove')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
674 self.addArguments(args, self.options['global'])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
675 self.addArguments(args, self.options['remove'])
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
676 args.append("-v")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
677 if noDialog and '--force' not in args:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
678 args.append('--force')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
679
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
680 if isinstance(name, list):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
681 dname, fnames = self.splitPathList(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
682 self.addArguments(args, name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
683 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
684 dname, fname = self.splitPath(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
685 args.append(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
686
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
687 # find the root of the repo
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
688 repodir = dname
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
689 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
690 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
691 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
692 return False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
693
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
694 if noDialog:
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
695 if self.__client is None:
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
696 res = self.startSynchronizedProcess(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
697 QProcess(), 'hg', args, repodir)
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
698 else:
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
699 out, err = self.__client.runcommand(args)
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
700 res = err == ""
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
701 else:
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 553
diff changeset
702 dia = HgDialog(
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
703 self.trUtf8(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
704 '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
705 ' 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
706 self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
707 res = dia.startProcess(args, repodir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
708 if res:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
709 dia.exec_()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
710 res = dia.normalExitWithoutErrors()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
711
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
712 return res
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
713
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
714 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
715 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
716 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
717
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
718 @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
719 @param project reference to the project object
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
720 @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
721 @param noDialog flag indicating quiet operations
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
722 @return flag indicating successfull operation (boolean)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
723 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
724 isDir = os.path.isdir(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
725 opts = self.options['global'][:]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
726 force = '--force' in opts
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
727 if force:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
728 opts.remove('--force')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
729
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
730 res = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
731 if noDialog:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
732 if target is None:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
733 return False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
734 force = True
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
735 accepted = True
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
736 else:
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
737 from .HgCopyDialog import HgCopyDialog
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
738 dlg = HgCopyDialog(name, None, True, force)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
739 accepted = dlg.exec_() == QDialog.Accepted
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
740 if accepted:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
741 target, force = dlg.getData()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
742
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
743 if accepted:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
744 args = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
745 args.append('rename')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
746 self.addArguments(args, opts)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
747 args.append("-v")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
748 if force:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
749 args.append('--force')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
750 args.append(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
751 args.append(target)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
752
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
753 dname, fname = self.splitPath(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
754 # find the root of the repo
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
755 repodir = dname
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
756 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
757 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
758 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
759 return False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
760
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
761 if noDialog:
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
762 if self.__client is None:
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
763 res = self.startSynchronizedProcess(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
764 QProcess(), 'hg', args, repodir)
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
765 else:
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
766 out, err = self.__client.runcommand(args)
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
767 res = err == ""
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
768 else:
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
769 dia = HgDialog(self.trUtf8('Renaming {0}').format(name), self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
770 res = dia.startProcess(args, repodir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
771 if res:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
772 dia.exec_()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
773 res = dia.normalExit()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
774 if res:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
775 if target.startswith(project.getProjectPath()):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
776 if isDir:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
777 project.moveDirectory(name, target)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
778 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
779 project.renameFileInPdata(name, target)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
780 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
781 if isDir:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
782 project.removeDirectory(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
783 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
784 project.removeFile(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
785 return res
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
786
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
787 def vcsLog(self, name):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
788 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
789 Public method used to view the log of a file/directory from the
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
790 Mercurial repository.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
791
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
792 @param name file/directory name to show the log of (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
793 """
1274
442c748018c5 Added code to the Mercurial plug-in to support multiple revisions where appropriate.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1267
diff changeset
794 dname, fname = self.splitPath(name)
2841
1f79e88f18b7 Added side-by-side capability to the Mercurial log dialog and log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
795 isFile = os.path.isfile(name)
1274
442c748018c5 Added code to the Mercurial plug-in to support multiple revisions where appropriate.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1267
diff changeset
796
442c748018c5 Added code to the Mercurial plug-in to support multiple revisions where appropriate.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1267
diff changeset
797 # find the root of the repo
442c748018c5 Added code to the Mercurial plug-in to support multiple revisions where appropriate.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1267
diff changeset
798 repodir = dname
442c748018c5 Added code to the Mercurial plug-in to support multiple revisions where appropriate.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1267
diff changeset
799 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
442c748018c5 Added code to the Mercurial plug-in to support multiple revisions where appropriate.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1267
diff changeset
800 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
801 if os.path.splitdrive(repodir)[1] == os.sep:
1274
442c748018c5 Added code to the Mercurial plug-in to support multiple revisions where appropriate.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1267
diff changeset
802 return
442c748018c5 Added code to the Mercurial plug-in to support multiple revisions where appropriate.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1267
diff changeset
803
442c748018c5 Added code to the Mercurial plug-in to support multiple revisions where appropriate.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1267
diff changeset
804 if self.isExtensionActive("bookmarks"):
442c748018c5 Added code to the Mercurial plug-in to support multiple revisions where appropriate.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1267
diff changeset
805 bookmarksList = \
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
806 self.getExtensionObject("bookmarks")\
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
807 .hgGetBookmarksList(repodir)
1274
442c748018c5 Added code to the Mercurial plug-in to support multiple revisions where appropriate.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1267
diff changeset
808 else:
442c748018c5 Added code to the Mercurial plug-in to support multiple revisions where appropriate.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1267
diff changeset
809 bookmarksList = None
442c748018c5 Added code to the Mercurial plug-in to support multiple revisions where appropriate.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1267
diff changeset
810
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
811 from .HgMultiRevisionSelectionDialog import \
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
812 HgMultiRevisionSelectionDialog
1274
442c748018c5 Added code to the Mercurial plug-in to support multiple revisions where appropriate.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1267
diff changeset
813 dlg = HgMultiRevisionSelectionDialog(
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
814 self.hgGetTagsList(repodir),
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
815 self.hgGetBranchesList(repodir),
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
816 bookmarksList,
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
817 emptyRevsOk=True,
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
818 showLimit=True,
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
819 limitDefault=self.getPlugin().getPreferences("LogLimit"))
1274
442c748018c5 Added code to the Mercurial plug-in to support multiple revisions where appropriate.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1267
diff changeset
820 if dlg.exec_() == QDialog.Accepted:
442c748018c5 Added code to the Mercurial plug-in to support multiple revisions where appropriate.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1267
diff changeset
821 revs, noEntries = dlg.getRevisions()
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
822 from .HgLogDialog import HgLogDialog
2841
1f79e88f18b7 Added side-by-side capability to the Mercurial log dialog and log browser dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
823 self.log = HgLogDialog(self, isFile=isFile)
1267
5eddb59304c7 Made "Show Log" behave like "Show Limited Log" and removed the later.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1263
diff changeset
824 self.log.show()
1274
442c748018c5 Added code to the Mercurial plug-in to support multiple revisions where appropriate.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1267
diff changeset
825 self.log.start(name, noEntries=noEntries, revisions=revs)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
826
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
827 def vcsDiff(self, name):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
828 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
829 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
830 Mercurial repository.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
831
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
832 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
833 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
834 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
835 operation may be aborted.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
836
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
837 @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
838 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
839 if isinstance(name, list):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
840 names = name[:]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
841 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
842 names = [name]
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
843 for nam in names:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
844 if os.path.isfile(nam):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
845 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
846 if editor and not editor.checkDirty():
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
847 return
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
848 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
849 project = e5App().getObject("Project")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
850 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
851 return
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
852 from .HgDiffDialog import HgDiffDialog
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
853 self.diff = HgDiffDialog(self)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
854 self.diff.show()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
855 QApplication.processEvents()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
856 self.diff.start(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
857
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
858 def vcsStatus(self, name):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
859 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
860 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
861 Mercurial repository.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
862
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
863 @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
864 (string or list of strings)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
865 """
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
866 from .HgStatusDialog import HgStatusDialog
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
867 self.status = HgStatusDialog(self)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
868 self.status.show()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
869 self.status.start(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
870
2811
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
871 def hgSummary(self, mq=False):
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
872 """
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
873 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
874 working directory state.
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
875
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
876 @param mq flag indicating to show the queue status as well (boolean)
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
877 """
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
878 from .HgSummaryDialog import HgSummaryDialog
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
879 self.summary = HgSummaryDialog(self)
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
880 self.summary.show()
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
881 self.summary.start(self.__projectHelper.getProject().getProjectPath(),
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
882 mq=mq)
2811
7b2ec3af3505 Added support for the Mercurial 'summary' command.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
883
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
884 def vcsTag(self, name):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
885 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
886 Public method used to set the tag in the Mercurial repository.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
887
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
888 @param name file/directory name to be tagged (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
889 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
890 dname, fname = self.splitPath(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
891
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
892 # find the root of the repo
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
893 repodir = dname
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
894 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
895 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
896 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
897 return
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
898
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
899 from .HgTagDialog import HgTagDialog
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
900 dlg = HgTagDialog(self.hgGetTagsList(repodir))
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
901 if dlg.exec_() == QDialog.Accepted:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
902 tag, tagOp = dlg.getParameters()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
903 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
904 return
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
905
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
906 args = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
907 args.append('tag')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
908 if tagOp == HgTagDialog.CreateLocalTag:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
909 args.append('--local')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
910 elif tagOp == HgTagDialog.DeleteTag:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
911 args.append('--remove')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
912 args.append('--message')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
913 if tagOp != HgTagDialog.DeleteTag:
182
5fb26c972892 Changed tagging and branching to not allow spaces in tag/branch name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 181
diff changeset
914 tag = tag.strip().replace(" ", "_")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
915 args.append("Created tag <{0}>.".format(tag))
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
916 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
917 args.append("Removed tag <{0}>.".format(tag))
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
918 args.append(tag)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
919
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
920 dia = HgDialog(self.trUtf8('Taging in the Mercurial repository'), self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
921 res = dia.startProcess(args, repodir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
922 if res:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
923 dia.exec_()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
924
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
925 def hgRevert(self, name):
178
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 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
928
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
929 @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
930 @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
931 or delete (boolean)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
932 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
933 args = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
934 args.append('revert')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
935 self.addArguments(args, self.options['global'])
1312
12506dba74dc Added configuration option to create backup files when reverting changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1311
diff changeset
936 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
937 args.append("--no-backup")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
938 args.append("-v")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
939 if isinstance(name, list):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
940 dname, fnames = self.splitPathList(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
941 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
942 names = name[:]
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
943 else:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
944 dname, fname = self.splitPath(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
945 args.append(name)
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
946 names = [name]
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
947
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
948 # find the root of the repo
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
949 repodir = dname
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
950 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
951 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
952 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
953 return False
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
954
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
955 project = e5App().getObject("Project")
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
956 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
957 if names[0]:
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
958 from UI.DeleteFilesConfirmationDialog import \
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
959 DeleteFilesConfirmationDialog
3023
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
960 dlg = DeleteFilesConfirmationDialog(
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
961 self.parent(),
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
962 self.trUtf8("Revert changes"),
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
963 self.trUtf8(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
964 "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
965 " or directories?"),
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
966 names)
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
967 yes = dlg.exec_() == QDialog.Accepted
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
968 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
969 yes = E5MessageBox.yesNo(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
970 None,
2352
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
971 self.trUtf8("Revert changes"),
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
972 self.trUtf8("""Do you really want to revert all changes of"""
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
973 """ the project?"""))
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
974 if yes:
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
975 dia = HgDialog(self.trUtf8('Reverting changes'), self)
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
976 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
977 if res:
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
978 dia.exec_()
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
979 res = dia.hasAddOrDelete()
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
980 self.checkVCSStatus()
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
981 else:
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
982 res = False
21971ebfaaef Added a confirmation dialog to the 'revert' VCS actions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2318
diff changeset
983
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
984 return res
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
985
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
986 def vcsMerge(self, name):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
987 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
988 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
989
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
990 @param name file/directory name to be merged (string)
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
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1001 opts = self.options['global'][:]
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1002 force = '--force' in opts
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1003 if force:
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1004 del opts[opts.index('--force')]
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1005
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1006 if self.isExtensionActive("bookmarks"):
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1007 bookmarksList = \
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
1008 self.getExtensionObject("bookmarks")\
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
1009 .hgGetBookmarksList(repodir)
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1010 else:
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1011 bookmarksList = None
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
1012 from .HgMergeDialog import HgMergeDialog
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1013 dlg = HgMergeDialog(force, self.hgGetTagsList(repodir),
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1014 self.hgGetBranchesList(repodir),
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1015 bookmarksList)
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1016 if dlg.exec_() == QDialog.Accepted:
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1017 rev, force = dlg.getParameters()
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1018 else:
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1019 return
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1020
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1021 args = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1022 args.append('merge')
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1023 self.addArguments(args, opts)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1024 if force:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1025 args.append("--force")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1026 if rev:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1027 args.append("--rev")
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1028 args.append(rev)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1029
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
1030 dia = HgDialog(self.trUtf8('Merging').format(name), self)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1031 res = dia.startProcess(args, repodir)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1032 if res:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1033 dia.exec_()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1034 self.checkVCSStatus()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1035
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1036 def vcsSwitch(self, name):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1037 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
1038 Public method used to switch a working directory to a different
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
1039 revision.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1040
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1041 @param name directory name to be switched (string)
1083
dc680a0ce221 Extended the code logic for the switch command of the various version control interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1078
diff changeset
1042 @return flag indicating, that the switch contained an add
dc680a0ce221 Extended the code logic for the switch command of the various version control interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1078
diff changeset
1043 or delete (boolean)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1044 """
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1045 dname, fname = self.splitPath(name)
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1046
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1047 # find the root of the repo
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1048 repodir = dname
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1049 while not os.path.isdir(os.path.join(repodir, self.adminDir)):
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1050 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
1051 if os.path.splitdrive(repodir)[1] == os.sep:
1083
dc680a0ce221 Extended the code logic for the switch command of the various version control interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1078
diff changeset
1052 return False
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1053
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1054 if self.isExtensionActive("bookmarks"):
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1055 bookmarksList = \
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
1056 self.getExtensionObject("bookmarks")\
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2974
diff changeset
1057 .hgGetBookmarksList(repodir)
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1058 else:
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1059 bookmarksList = None
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2352
diff changeset
1060 from .HgRevisionSelectionDialog import HgRevisionSelectionDialog
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1061 dlg = HgRevisionSelectionDialog(self.hgGetTagsList(repodir),
1061
3e21869872e3 Fixed PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
1062 self.hgGetBranchesList(repodir),
1017
919147f2b518 Continued with Mercurial bookmark support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1011
diff changeset
1063 bookmarksList)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff