eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/queues.py

Wed, 30 Dec 2020 11:00:44 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Dec 2020 11:00:44 +0100
branch
maintenance
changeset 7924
8a96736d465e
parent 7759
51aa6c6b66f7
child 8043
0acf98cd089a
permissions
-rw-r--r--

Updated copyright for 2021.

1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7924
8a96736d465e Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
3 # Copyright (c) 2011 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the queues extension interface.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
1066
a3dd41fd9ea8 Added support for the Mercurial fetch extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
9
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import os
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
12 from PyQt5.QtWidgets import QDialog, QApplication, QInputDialog
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 from E5Gui import E5MessageBox
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
1087
fb8cd56819a9 Changed the Mercurial extension interface code to use custom base classes instead of inheriting QObject directly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1068
diff changeset
16 from ..HgExtension import HgExtension
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 from ..HgDialog import HgDialog
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
1087
fb8cd56819a9 Changed the Mercurial extension interface code to use custom base classes instead of inheriting QObject directly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1068
diff changeset
20 class Queues(HgExtension):
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 Class implementing the queues extension interface.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 APPLIED_LIST = 0
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 UNAPPLIED_LIST = 1
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 SERIES_LIST = 2
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
28 POP = 0
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
29 PUSH = 1
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
30 GOTO = 2
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
31
1053
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
32 QUEUE_DELETE = 0
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
33 QUEUE_PURGE = 1
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
34 QUEUE_ACTIVATE = 2
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
35
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 def __init__(self, vcs):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 Constructor
1066
a3dd41fd9ea8 Added support for the Mercurial fetch extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
39
a3dd41fd9ea8 Added support for the Mercurial fetch extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1061
diff changeset
40 @param vcs reference to the Mercurial vcs object
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2405
diff changeset
42 super(Queues, self).__init__(vcs)
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 self.qdiffDialog = None
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
45 self.qheaderDialog = None
1046
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
46 self.queuesListDialog = None
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
47 self.queuesListGuardsDialog = None
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
48 self.queuesListAllGuardsDialog = None
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
49 self.queuesDefineGuardsDialog = None
1053
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
50 self.queuesListQueuesDialog = None
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
51 self.queueStatusDialog = None
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 def shutdown(self):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 Public method used to shutdown the queues interface.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 if self.qdiffDialog is not None:
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 self.qdiffDialog.close()
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
59 if self.qheaderDialog is not None:
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
60 self.qheaderDialog.close()
1046
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
61 if self.queuesListDialog is not None:
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
62 self.queuesListDialog.close()
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
63 if self.queuesListGuardsDialog is not None:
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
64 self.queuesListGuardsDialog.close()
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
65 if self.queuesListAllGuardsDialog is not None:
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
66 self.queuesListAllGuardsDialog.close()
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
67 if self.queuesDefineGuardsDialog is not None:
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
68 self.queuesDefineGuardsDialog.close()
1053
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
69 if self.queuesListQueuesDialog is not None:
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
70 self.queuesListQueuesDialog.close()
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
71 if self.queueStatusDialog is not None:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
72 self.queueStatusDialog.close()
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
73
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
74 def __getPatchesList(self, repodir, listType, withSummary=False):
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
75 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
76 Private method to get a list of patches of a given type.
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
77
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
78 @param repodir directory name of the repository (string)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
79 @param listType type of patches list to get
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
80 (Queues.APPLIED_LIST, Queues.UNAPPLIED_LIST, Queues.SERIES_LIST)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
81 @param withSummary flag indicating to get a summary as well (boolean)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
82 @return list of patches (list of string)
2962
d6c9d1ca2da4 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2815
diff changeset
83 @exception ValueError raised to indicate an invalid patch list type
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
84 """
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
85 patchesList = []
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
86
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
87 if listType == Queues.APPLIED_LIST:
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
88 args = self.vcs.initCommand("qapplied")
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
89 elif listType == Queues.UNAPPLIED_LIST:
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
90 args = self.vcs.initCommand("qunapplied")
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
91 elif listType == Queues.SERIES_LIST:
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
92 args = self.vcs.initCommand("qseries")
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
93 else:
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
94 raise ValueError("illegal value for listType")
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
95 if withSummary:
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
96 args.append("--summary")
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
97
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
98 client = self.vcs.getClient()
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
99 output = client.runcommand(args)[0]
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
100
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
101 for line in output.splitlines():
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
102 if withSummary:
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
103 li = line.strip().split(": ")
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
104 if len(li) == 1:
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
105 patch, summary = li[0][:-1], ""
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
106 else:
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
107 patch, summary = li[0], li[1]
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
108 patchesList.append("{0}@@{1}".format(patch, summary))
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
109 else:
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
110 patchesList.append(line.strip())
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
111
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
112 return patchesList
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
113
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
114 def __getCurrentPatch(self, repodir):
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
115 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
116 Private method to get the name of the current patch.
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
117
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
118 @param repodir directory name of the repository (string)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
119 @return name of the current patch (string)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
120 """
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
121 currentPatch = ""
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
122
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
123 args = self.vcs.initCommand("qtop")
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
124
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
125 client = self.vcs.getClient()
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
126 currentPatch = client.runcommand(args)[0].strip()
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
127
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
128 return currentPatch
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
129
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
130 def __getCommitMessage(self, repodir):
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
131 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
132 Private method to get the commit message of the current patch.
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
133
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
134 @param repodir directory name of the repository (string)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
135 @return name of the current patch (string)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
136 """
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
137 message = ""
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
138
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
139 args = self.vcs.initCommand("qheader")
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
140
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
141 client = self.vcs.getClient()
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
142 message = client.runcommand(args)[0]
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
143
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
144 return message
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
146 def getGuardsList(self, repodir, allGuards=True):
1047
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
147 """
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
148 Public method to get a list of all guards defined.
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
149
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
150 @param repodir directory name of the repository (string)
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
151 @param allGuards flag indicating to get all guards (boolean)
1047
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
152 @return sorted list of guards (list of strings)
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
153 """
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
154 guardsList = []
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
155
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
156 args = self.vcs.initCommand("qselect")
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
157 if allGuards:
1047
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
158 args.append("--series")
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
159
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
160 client = self.vcs.getClient()
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
161 output = client.runcommand(args)[0]
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
162
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
163 for guard in output.splitlines():
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
164 guard = guard.strip()
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
165 if allGuards:
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
166 guard = guard[1:]
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
167 if guard not in guardsList:
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
168 guardsList.append(guard)
1047
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
169
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
170 return sorted(guardsList)
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
171
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 def hgQueueNewPatch(self, name):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 Public method to create a new named patch.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 @param name file/directory name (string)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 # find the root of the repo
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 repodir = self.vcs.splitPath(name)[0]
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 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: 1255
diff changeset
182 if os.path.splitdrive(repodir)[1] == os.sep:
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 return
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
185 from .HgQueuesNewPatchDialog import HgQueuesNewPatchDialog
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
186 dlg = HgQueuesNewPatchDialog(HgQueuesNewPatchDialog.NEW_MODE)
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7370
diff changeset
187 if dlg.exec() == QDialog.Accepted:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
188 (name, message,
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
189 (userData, currentUser, userName),
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
190 (dateData, currentDate, dateStr)) = dlg.getData()
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
192 args = self.vcs.initCommand("qnew")
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 if message != "":
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 args.append("--message")
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 args.append(message)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 if userData:
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 if currentUser:
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198 args.append("--currentuser")
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 else:
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 args.append("--user")
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 args.append(userName)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 if dateData:
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 if currentDate:
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 args.append("--currentdate")
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 else:
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 args.append("--date")
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 args.append(dateStr)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 args.append(name)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
210 dia = HgDialog(self.tr('New Patch'), self.vcs)
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 res = dia.startProcess(args, repodir)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7370
diff changeset
213 dia.exec()
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 self.vcs.checkVCSStatus()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
216 def hgQueueRefreshPatch(self, name, editMessage=False):
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 """
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
218 Public method to refresh the current patch.
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 @param name file/directory name (string)
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
221 @param editMessage flag indicating to edit the current
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
222 commit message (boolean)
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 # find the root of the repo
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225 repodir = self.vcs.splitPath(name)[0]
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 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: 1255
diff changeset
228 if os.path.splitdrive(repodir)[1] == os.sep:
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 return
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
231 args = self.vcs.initCommand("qrefresh")
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
233 if editMessage:
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
234 currentMessage = self.__getCommitMessage(repodir)
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
235 from .HgQueuesNewPatchDialog import HgQueuesNewPatchDialog
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
236 dlg = HgQueuesNewPatchDialog(HgQueuesNewPatchDialog.REFRESH_MODE,
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
237 currentMessage)
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7370
diff changeset
238 if dlg.exec() == QDialog.Accepted:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
239 (name, message,
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
240 (userData, currentUser, userName),
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
241 (dateData, currentDate, dateStr)) = dlg.getData()
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
242 if message != "" and message != currentMessage:
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
243 args.append("--message")
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
244 args.append(message)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
245 if userData:
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
246 if currentUser:
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
247 args.append("--currentuser")
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
248 else:
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
249 args.append("--user")
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
250 args.append(userName)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
251 if dateData:
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
252 if currentDate:
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
253 args.append("--currentdate")
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
254 else:
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
255 args.append("--date")
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
256 args.append(dateStr)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
257 else:
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
258 return
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
259
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
260 dia = HgDialog(self.tr('Update Current Patch'), self.vcs)
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 res = dia.startProcess(args, repodir)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7370
diff changeset
263 dia.exec()
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 self.vcs.checkVCSStatus()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 def hgQueueShowPatch(self, name):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 """
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
268 Public method to show the contents of the current patch.
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 @param name file/directory name (string)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 """
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
272 from ..HgDiffDialog import HgDiffDialog
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 self.qdiffDialog = HgDiffDialog(self.vcs)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 self.qdiffDialog.show()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 QApplication.processEvents()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 self.qdiffDialog.start(name, qdiff=True)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
278 def hgQueueShowHeader(self, name):
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
279 """
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
280 Public method to show the commit message of the current patch.
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
281
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
282 @param name file/directory name (string)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
283 """
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
284 from .HgQueuesHeaderDialog import HgQueuesHeaderDialog
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
285 self.qheaderDialog = HgQueuesHeaderDialog(self.vcs)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
286 self.qheaderDialog.show()
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
287 QApplication.processEvents()
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
288 self.qheaderDialog.start(name)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
289
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
290 def hgQueuePushPopPatches(self, name, operation, doAll=False, named=False,
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
291 force=False):
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
293 Public method to push patches onto the stack or pop patches off the
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
294 stack.
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 @param name file/directory name (string)
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
297 @param operation operation type to be performed (Queues.POP,
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
298 Queues.PUSH, Queues.GOTO)
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
299 @keyparam doAll flag indicating to push/pop all (boolean)
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 @keyparam named flag indicating to push/pop until a named patch
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 is at the top of the stack (boolean)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 @keyparam force flag indicating a forceful pop (boolean)
1068
090e5be55051 Change qpush/qpop/qgoto code to be able to detect changes of the project file (in case MQ will report the changed files one day).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1066
diff changeset
303 @return flag indicating that the project should be reread (boolean)
2962
d6c9d1ca2da4 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2815
diff changeset
304 @exception ValueError raised to indicate an invalid operation
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 # find the root of the repo
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 repodir = self.vcs.splitPath(name)[0]
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 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: 1255
diff changeset
310 if os.path.splitdrive(repodir)[1] == os.sep:
1068
090e5be55051 Change qpush/qpop/qgoto code to be able to detect changes of the project file (in case MQ will report the changed files one day).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1066
diff changeset
311 return False
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
313 if operation == Queues.POP:
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
314 args = self.vcs.initCommand("qpop")
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
315 title = self.tr("Pop Patches")
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 listType = Queues.APPLIED_LIST
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
317 elif operation == Queues.PUSH:
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
318 args = self.vcs.initCommand("qpush")
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
319 title = self.tr("Push Patches")
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 listType = Queues.UNAPPLIED_LIST
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
321 elif operation == Queues.GOTO:
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
322 args = self.vcs.initCommand("qgoto")
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
323 title = self.tr("Go to Patch")
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
324 listType = Queues.SERIES_LIST
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
325 else:
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
326 raise ValueError("illegal value for operation")
1068
090e5be55051 Change qpush/qpop/qgoto code to be able to detect changes of the project file (in case MQ will report the changed files one day).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1066
diff changeset
327 args.append("-v")
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328 if force:
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 args.append("--force")
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
330 if doAll and operation in (Queues.POP, Queues.PUSH):
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 args.append("--all")
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
332 elif named or operation == Queues.GOTO:
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
333 patchnames = self.__getPatchesList(repodir, listType)
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 if patchnames:
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 patch, ok = QInputDialog.getItem(
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
337 self.tr("Select Patch"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
338 self.tr("Select the target patch name:"),
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339 patchnames,
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340 0, False)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341 if ok and patch:
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
342 args.append(patch)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343 else:
1068
090e5be55051 Change qpush/qpop/qgoto code to be able to detect changes of the project file (in case MQ will report the changed files one day).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1066
diff changeset
344 return False
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
346 E5MessageBox.information(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
347 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
348 self.tr("Select Patch"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
349 self.tr("""No patches to select from."""))
1068
090e5be55051 Change qpush/qpop/qgoto code to be able to detect changes of the project file (in case MQ will report the changed files one day).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1066
diff changeset
350 return False
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
351
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
352 dia = HgDialog(title, self.vcs)
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 res = dia.startProcess(args, repodir)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
354 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7370
diff changeset
355 dia.exec()
1068
090e5be55051 Change qpush/qpop/qgoto code to be able to detect changes of the project file (in case MQ will report the changed files one day).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1066
diff changeset
356 res = dia.hasAddOrDelete()
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357 self.vcs.checkVCSStatus()
1068
090e5be55051 Change qpush/qpop/qgoto code to be able to detect changes of the project file (in case MQ will report the changed files one day).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1066
diff changeset
358 return res
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360 def hgQueueListPatches(self, name):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361 """
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
362 Public method to show a list of all patches.
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
363
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364 @param name file/directory name (string)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365 """
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
366 from .HgQueuesListDialog import HgQueuesListDialog
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367 self.queuesListDialog = HgQueuesListDialog(self.vcs)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368 self.queuesListDialog.show()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 self.queuesListDialog.start(name)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371 def hgQueueFinishAppliedPatches(self, name):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 """
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
373 Public method to finish all applied patches.
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 @param name file/directory name (string)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377 # find the root of the repo
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 repodir = self.vcs.splitPath(name)[0]
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380 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: 1255
diff changeset
381 if os.path.splitdrive(repodir)[1] == os.sep:
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 return
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
384 args = self.vcs.initCommand("qfinish")
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385 args.append("--applied")
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
387 dia = HgDialog(self.tr('Finish Applied Patches'), self.vcs)
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
388 res = dia.startProcess(args, repodir)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7370
diff changeset
390 dia.exec()
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391 self.vcs.checkVCSStatus()
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
392
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
393 def hgQueueRenamePatch(self, name):
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
394 """
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
395 Public method to rename the current or a selected patch.
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
396
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
397 @param name file/directory name (string)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
398 """
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
399 # find the root of the repo
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
400 repodir = self.vcs.splitPath(name)[0]
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
401 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
402 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: 1255
diff changeset
403 if os.path.splitdrive(repodir)[1] == os.sep:
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
404 return
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
405
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
406 args = self.vcs.initCommand("qrename")
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
407 patchnames = sorted(self.__getPatchesList(repodir, Queues.SERIES_LIST))
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
408 if patchnames:
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
409 currentPatch = self.__getCurrentPatch(repodir)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
410 if currentPatch:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
411 from .HgQueuesRenamePatchDialog import (
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
412 HgQueuesRenamePatchDialog
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
413 )
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
414 dlg = HgQueuesRenamePatchDialog(currentPatch, patchnames)
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7370
diff changeset
415 if dlg.exec() == QDialog.Accepted:
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
416 newName, selectedPatch = dlg.getData()
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
417 if selectedPatch:
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
418 args.append(selectedPatch)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
419 args.append(newName)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
420
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
421 dia = HgDialog(self.tr("Rename Patch"), self.vcs)
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
422 res = dia.startProcess(args, repodir)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
423 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7370
diff changeset
424 dia.exec()
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
425
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
426 def hgQueueDeletePatch(self, name):
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
427 """
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
428 Public method to delete a selected unapplied patch.
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
429
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
430 @param name file/directory name (string)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
431 """
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
432 # find the root of the repo
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
433 repodir = self.vcs.splitPath(name)[0]
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
434 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
435 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: 1255
diff changeset
436 if os.path.splitdrive(repodir)[1] == os.sep:
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
437 return
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
438
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
439 args = self.vcs.initCommand("qdelete")
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
440 patchnames = sorted(self.__getPatchesList(repodir,
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
441 Queues.UNAPPLIED_LIST))
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
442 if patchnames:
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
443 patch, ok = QInputDialog.getItem(
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
444 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
445 self.tr("Select Patch"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
446 self.tr("Select the patch to be deleted:"),
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
447 patchnames,
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
448 0, False)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
449 if ok and patch:
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
450 args.append(patch)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
451
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
452 dia = HgDialog(self.tr("Delete Patch"), self.vcs)
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
453 res = dia.startProcess(args, repodir)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
454 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7370
diff changeset
455 dia.exec()
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
456 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
457 E5MessageBox.information(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
458 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
459 self.tr("Select Patch"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
460 self.tr("""No patches to select from."""))
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
461
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
462 def hgQueueFoldUnappliedPatches(self, name):
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
463 """
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
464 Public method to fold patches into the current patch.
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
465
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
466 @param name file/directory name (string)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
467 """
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
468 # find the root of the repo
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
469 repodir = self.vcs.splitPath(name)[0]
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
470 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
471 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: 1255
diff changeset
472 if os.path.splitdrive(repodir)[1] == os.sep:
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
473 return
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
474
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
475 args = self.vcs.initCommand("qfold")
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
476 patchnames = sorted(
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
477 self.__getPatchesList(repodir, Queues.UNAPPLIED_LIST,
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
478 withSummary=True))
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
479 if patchnames:
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
480 from .HgQueuesFoldDialog import HgQueuesFoldDialog
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
481 dlg = HgQueuesFoldDialog(patchnames)
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7370
diff changeset
482 if dlg.exec() == QDialog.Accepted:
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
483 message, patchesList = dlg.getData()
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
484 if message:
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
485 args.append("--message")
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
486 args.append(message)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
487 if patchesList:
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
488 args.extend(patchesList)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
489
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
490 dia = HgDialog(self.tr("Fold Patches"), self.vcs)
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
491 res = dia.startProcess(args, repodir)
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
492 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7370
diff changeset
493 dia.exec()
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
494 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
495 E5MessageBox.information(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
496 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
497 self.tr("Fold Patches"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
498 self.tr("""No patches selected."""))
1035
2cd7817ac659 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
499 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
500 E5MessageBox.information(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
501 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
502 self.tr("Fold Patches"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
503 self.tr("""No patches available to be folded."""))
1046
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
504
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
505 def hgQueueGuardsList(self, name):
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
506 """
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
507 Public method to list the guards for the current or a named patch.
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
508
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
509 @param name file/directory name (string)
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
510 """
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
511 # find the root of the repo
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
512 repodir = self.vcs.splitPath(name)[0]
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
513 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
514 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: 1255
diff changeset
515 if os.path.splitdrive(repodir)[1] == os.sep:
1046
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
516 return
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
517
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
518 patchnames = sorted(
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
519 self.__getPatchesList(repodir, Queues.SERIES_LIST))
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
520 if patchnames:
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
521 from .HgQueuesListGuardsDialog import HgQueuesListGuardsDialog
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
522 self.queuesListGuardsDialog = HgQueuesListGuardsDialog(
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
523 self.vcs, patchnames)
1046
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
524 self.queuesListGuardsDialog.show()
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
525 self.queuesListGuardsDialog.start(name)
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
526 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
527 E5MessageBox.information(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
528 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
529 self.tr("List Guards"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
530 self.tr("""No patches available to list guards for."""))
1046
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
531
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
532 def hgQueueGuardsListAll(self, name):
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
533 """
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
534 Public method to list all guards of all patches.
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
535
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
536 @param name file/directory name (string)
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
537 """
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
538 from .HgQueuesListAllGuardsDialog import HgQueuesListAllGuardsDialog
1046
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
539 self.queuesListAllGuardsDialog = HgQueuesListAllGuardsDialog(self.vcs)
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
540 self.queuesListAllGuardsDialog.show()
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
541 self.queuesListAllGuardsDialog.start(name)
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
542
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
543 def hgQueueGuardsDefine(self, name):
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
544 """
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
545 Public method to define guards for the current or a named patch.
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
546
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
547 @param name file/directory name (string)
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
548 """
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
549 # find the root of the repo
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
550 repodir = self.vcs.splitPath(name)[0]
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
551 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
552 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: 1255
diff changeset
553 if os.path.splitdrive(repodir)[1] == os.sep:
1046
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
554 return
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
555
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
556 patchnames = sorted(
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
557 self.__getPatchesList(repodir, Queues.SERIES_LIST))
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
558 if patchnames:
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
559 from .HgQueuesDefineGuardsDialog import HgQueuesDefineGuardsDialog
1046
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
560 self.queuesDefineGuardsDialog = HgQueuesDefineGuardsDialog(
1047
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
561 self.vcs, self, patchnames)
1046
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
562 self.queuesDefineGuardsDialog.show()
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
563 self.queuesDefineGuardsDialog.start(name)
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
564 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
565 E5MessageBox.information(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
566 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
567 self.tr("Define Guards"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
568 self.tr("""No patches available to define guards for."""))
1046
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
569
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
570 def hgQueueGuardsDropAll(self, name):
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
571 """
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
572 Public method to drop all guards of the current or a named patch.
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
573
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
574 @param name file/directory name (string)
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
575 """
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
576 # find the root of the repo
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
577 repodir = self.vcs.splitPath(name)[0]
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
578 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
579 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: 1255
diff changeset
580 if os.path.splitdrive(repodir)[1] == os.sep:
1046
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
581 return
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
582
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
583 patchnames = sorted(
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
584 self.__getPatchesList(repodir, Queues.SERIES_LIST))
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
585 if patchnames:
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
586 patch, ok = QInputDialog.getItem(
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
587 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
588 self.tr("Drop All Guards"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
589 self.tr("Select the patch to drop guards for"
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
590 " (leave empty for the current patch):"),
1046
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
591 [""] + patchnames,
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
592 0, False)
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
593 if ok:
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
594 args = self.vcs.initCommand("qguard")
1046
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
595 if patch:
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
596 args.append(patch)
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
597 args.append("--none")
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
598
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
599 client = self.vcs.getClient()
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
600 client.runcommand(args)
1046
5dd14be5d6a1 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1035
diff changeset
601 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
602 E5MessageBox.information(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
603 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
604 self.tr("Drop All Guards"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
605 self.tr("""No patches available to define guards for."""))
1047
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
606
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
607 def hgQueueGuardsSetActive(self, name):
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
608 """
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
609 Public method to set the active guards.
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
610
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
611 @param name file/directory name (string)
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
612 """
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
613 # find the root of the repo
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
614 repodir = self.vcs.splitPath(name)[0]
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
615 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
616 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: 1255
diff changeset
617 if os.path.splitdrive(repodir)[1] == os.sep:
1047
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
618 return
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
619
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
620 guardsList = self.getGuardsList(repodir)
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
621 if guardsList:
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
622 activeGuardsList = self.getGuardsList(repodir, allGuards=False)
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
623 from .HgQueuesGuardsSelectionDialog import (
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
624 HgQueuesGuardsSelectionDialog
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
625 )
1047
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
626 dlg = HgQueuesGuardsSelectionDialog(
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
627 guardsList, activeGuards=activeGuardsList, listOnly=False)
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7370
diff changeset
628 if dlg.exec() == QDialog.Accepted:
1047
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
629 guards = dlg.getData()
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
630 if guards:
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
631 args = self.vcs.initCommand("qselect")
1047
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
632 args.extend(guards)
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
633
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
634 dia = HgDialog(self.tr('Set Active Guards'), self.vcs)
1047
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
635 res = dia.startProcess(args, repodir)
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
636 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7370
diff changeset
637 dia.exec()
1047
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
638 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
639 E5MessageBox.information(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
640 None,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
641 self.tr("Set Active Guards"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
642 self.tr("""No guards available to select from."""))
1047
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
643 return
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
644
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
645 def hgQueueGuardsDeactivate(self, name):
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
646 """
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
647 Public method to deactivate all active guards.
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
648
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
649 @param name file/directory name (string)
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
650 """
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
651 # find the root of the repo
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
652 repodir = self.vcs.splitPath(name)[0]
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
653 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
654 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: 1255
diff changeset
655 if os.path.splitdrive(repodir)[1] == os.sep:
1047
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
656 return
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
657
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
658 args = self.vcs.initCommand("qselect")
1047
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
659 args.append("--none")
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
660
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
661 dia = HgDialog(self.tr('Deactivate Guards'), self.vcs)
1047
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
662 res = dia.startProcess(args, repodir)
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
663 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7370
diff changeset
664 dia.exec()
1047
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
665
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
666 def hgQueueGuardsIdentifyActive(self, name):
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
667 """
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
668 Public method to list all active guards.
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
669
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
670 @param name file/directory name (string)
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
671 """
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
672 # find the root of the repo
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
673 repodir = self.vcs.splitPath(name)[0]
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
674 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
675 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: 1255
diff changeset
676 if os.path.splitdrive(repodir)[1] == os.sep:
1047
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
677 return
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
678
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
679 guardsList = self.getGuardsList(repodir, allGuards=False)
1047
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
680 if guardsList:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
681 from .HgQueuesGuardsSelectionDialog import (
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
682 HgQueuesGuardsSelectionDialog
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
683 )
1047
b41a36b201e4 Continued with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1046
diff changeset
684 dlg = HgQueuesGuardsSelectionDialog(guardsList, listOnly=True)
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7370
diff changeset
685 dlg.exec()
1053
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
686
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
687 def hgQueueCreateRenameQueue(self, name, isCreate):
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
688 """
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
689 Public method to create a new queue or rename the active queue.
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
690
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
691 @param name file/directory name (string)
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
692 @param isCreate flag indicating to create a new queue (boolean)
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
693 """
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
694 # find the root of the repo
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
695 repodir = self.vcs.splitPath(name)[0]
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
696 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
697 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: 1255
diff changeset
698 if os.path.splitdrive(repodir)[1] == os.sep:
1053
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
699 return
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
700
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
701 if isCreate:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
702 title = self.tr("Create New Queue")
1053
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
703 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
704 title = self.tr("Rename Active Queue")
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
705 from .HgQueuesQueueManagementDialog import (
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
706 HgQueuesQueueManagementDialog
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
707 )
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
708 dlg = HgQueuesQueueManagementDialog(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
709 HgQueuesQueueManagementDialog.NAME_INPUT,
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1254
diff changeset
710 title, False, repodir, self.vcs)
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7370
diff changeset
711 if dlg.exec() == QDialog.Accepted:
1053
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
712 queueName = dlg.getData()
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
713 if queueName:
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
714 args = self.vcs.initCommand("qqueue")
1053
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
715 if isCreate:
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
716 args.append("--create")
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
717 else:
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
718 args.append("--rename")
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
719 args.append(queueName)
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
720
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
721 client = self.vcs.getClient()
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
722 error = client.runcommand(args)[1]
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
723
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
724 if error:
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
725 if isCreate:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
726 errMsg = self.tr(
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
727 "Error while creating a new queue.")
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
728 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
729 errMsg = self.tr(
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
730 "Error while renaming the active queue.")
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
731 E5MessageBox.warning(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
732 None,
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
733 title,
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
734 """<p>{0}</p><p>{1}</p>""".format(errMsg, error))
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
735 else:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
736 if (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
737 self.queuesListQueuesDialog is not None and
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
738 self.queuesListQueuesDialog.isVisible()
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
739 ):
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
740 self.queuesListQueuesDialog.refresh()
1053
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
741
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
742 def hgQueueDeletePurgeActivateQueue(self, name, operation):
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
743 """
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
744 Public method to delete the reference to a queue and optionally
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
745 remove the patch directory or set the active queue.
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
746
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
747 @param name file/directory name (string)
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
748 @param operation operation to be performed (Queues.QUEUE_DELETE,
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
749 Queues.QUEUE_PURGE, Queues.QUEUE_ACTIVATE)
2962
d6c9d1ca2da4 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2815
diff changeset
750 @exception ValueError raised to indicate an invalid operation
1053
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
751 """
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
752 # find the root of the repo
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
753 repodir = self.vcs.splitPath(name)[0]
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
754 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
755 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: 1255
diff changeset
756 if os.path.splitdrive(repodir)[1] == os.sep:
1053
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
757 return
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
758
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
759 if operation == Queues.QUEUE_PURGE:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
760 title = self.tr("Purge Queue")
1053
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
761 elif operation == Queues.QUEUE_DELETE:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
762 title = self.tr("Delete Queue")
1053
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
763 elif operation == Queues.QUEUE_ACTIVATE:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
764 title = self.tr("Activate Queue")
1053
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
765 else:
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
766 raise ValueError("illegal value for operation")
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
767
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
768 from .HgQueuesQueueManagementDialog import (
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
769 HgQueuesQueueManagementDialog
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
770 )
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
771 dlg = HgQueuesQueueManagementDialog(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
772 HgQueuesQueueManagementDialog.QUEUE_INPUT,
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1254
diff changeset
773 title, True, repodir, self.vcs)
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7370
diff changeset
774 if dlg.exec() == QDialog.Accepted:
1053
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
775 queueName = dlg.getData()
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
776 if queueName:
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
777 args = self.vcs.initCommand("qqueue")
1053
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
778 if operation == Queues.QUEUE_PURGE:
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
779 args.append("--purge")
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
780 elif operation == Queues.QUEUE_DELETE:
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
781 args.append("--delete")
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
782 args.append(queueName)
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
783
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
784 client = self.vcs.getClient()
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
785 error = client.runcommand(args)[1]
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
786
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
787 if error:
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
788 if operation == Queues.QUEUE_PURGE:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
789 errMsg = self.tr("Error while purging the queue.")
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
790 elif operation == Queues.QUEUE_DELETE:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
791 errMsg = self.tr("Error while deleting the queue.")
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
792 elif operation == Queues.QUEUE_ACTIVATE:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
793 errMsg = self.tr(
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
794 "Error while setting the active queue.")
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
795 E5MessageBox.warning(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
796 None,
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
797 title,
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
798 """<p>{0}</p><p>{1}</p>""".format(errMsg, error))
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
799 else:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
800 if (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
801 self.queuesListQueuesDialog is not None and
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
802 self.queuesListQueuesDialog.isVisible()
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
803 ):
1254
c077fa008aae Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1087
diff changeset
804 self.queuesListQueuesDialog.refresh()
1053
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
805
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
806 def hgQueueListQueues(self, name):
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
807 """
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
808 Public method to list available queues.
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
809
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
810 @param name file/directory name (string)
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
811 """
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
812 # find the root of the repo
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
813 repodir = self.vcs.splitPath(name)[0]
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
814 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
815 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: 1255
diff changeset
816 if os.path.splitdrive(repodir)[1] == os.sep:
1053
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
817 return
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
818
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
819 from .HgQueuesQueueManagementDialog import (
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
820 HgQueuesQueueManagementDialog
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
821 )
1053
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
822 self.queuesListQueuesDialog = HgQueuesQueueManagementDialog(
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
823 HgQueuesQueueManagementDialog.NO_INPUT,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
824 self.tr("Available Queues"),
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1254
diff changeset
825 False, repodir, self.vcs)
1053
c54aa980ea8e Added an interface to the Mercurial patch queue management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1047
diff changeset
826 self.queuesListQueuesDialog.show()
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
827
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
828 def hgQueueInit(self, name):
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
829 """
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
830 Public method to initialize a new queue repository.
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
831
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
832 @param name directory name (string)
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
833 """
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
834 # find the root of the repo
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
835 repodir = self.vcs.splitPath(name)[0]
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
836 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
837 repodir = os.path.dirname(repodir)
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
838 if os.path.splitdrive(repodir)[1] == os.sep:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
839 return
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
840
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
841 args = self.vcs.initCommand("init")
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
842 args.append('--mq')
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
843 args.append(repodir)
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
844 # init is not possible with the command server
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2962
diff changeset
845 dia = HgDialog(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
846 self.tr('Initializing new queue repository'), self.vcs)
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
847 res = dia.startProcess(args)
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
848 if res:
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7370
diff changeset
849 dia.exec()
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
850
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
851 def hgQueueStatus(self, name):
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
852 """
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
853 Public method used to view the status of a queue repository.
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
854
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
855 @param name directory name (string)
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
856 """
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
857 from ..HgStatusDialog import HgStatusDialog
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
858 self.queueStatusDialog = HgStatusDialog(self.vcs, mq=True)
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
859 self.queueStatusDialog.show()
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
860 self.queueStatusDialog.start(name)

eric ide

mercurial