src/eric7/Plugins/VcsPlugins/vcsMercurial/GpgExtension/gpg.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9473
3f23dbf37dbe
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
16 16
17 class Gpg(HgExtension): 17 class Gpg(HgExtension):
18 """ 18 """
19 Class implementing the gpg extension interface. 19 Class implementing the gpg extension interface.
20 """ 20 """
21
21 def __init__(self, vcs): 22 def __init__(self, vcs):
22 """ 23 """
23 Constructor 24 Constructor
24 25
25 @param vcs reference to the Mercurial vcs object 26 @param vcs reference to the Mercurial vcs object
26 """ 27 """
27 super().__init__(vcs) 28 super().__init__(vcs)
28 29
29 self.gpgSignaturesDialog = None 30 self.gpgSignaturesDialog = None
30 31
31 def shutdown(self): 32 def shutdown(self):
32 """ 33 """
33 Public method used to shutdown the gpg interface. 34 Public method used to shutdown the gpg interface.
34 """ 35 """
35 if self.gpgSignaturesDialog is not None: 36 if self.gpgSignaturesDialog is not None:
36 self.gpgSignaturesDialog.close() 37 self.gpgSignaturesDialog.close()
37 38
38 def hgGpgSignatures(self): 39 def hgGpgSignatures(self):
39 """ 40 """
40 Public method used to list all signed changesets. 41 Public method used to list all signed changesets.
41 """ 42 """
42 from .HgGpgSignaturesDialog import HgGpgSignaturesDialog 43 from .HgGpgSignaturesDialog import HgGpgSignaturesDialog
44
43 self.gpgSignaturesDialog = HgGpgSignaturesDialog(self.vcs) 45 self.gpgSignaturesDialog = HgGpgSignaturesDialog(self.vcs)
44 self.gpgSignaturesDialog.show() 46 self.gpgSignaturesDialog.show()
45 self.gpgSignaturesDialog.start() 47 self.gpgSignaturesDialog.start()
46 48
47 def hgGpgVerifySignatures(self, rev=None): 49 def hgGpgVerifySignatures(self, rev=None):
48 """ 50 """
49 Public method used to verify the signatures of a revision. 51 Public method used to verify the signatures of a revision.
50 52
51 @param rev revision to check (string) 53 @param rev revision to check (string)
52 """ 54 """
53 if rev is None: 55 if rev is None:
54 dlg = HgRevisionSelectionDialog( 56 dlg = HgRevisionSelectionDialog(
55 self.vcs.hgGetTagsList(), 57 self.vcs.hgGetTagsList(),
56 self.vcs.hgGetBranchesList(), 58 self.vcs.hgGetBranchesList(),
57 bookmarksList=self.vcs.hgGetBookmarksList(), 59 bookmarksList=self.vcs.hgGetBookmarksList(),
58 revset=False 60 revset=False,
59 ) 61 )
60 if dlg.exec() == QDialog.DialogCode.Accepted: 62 if dlg.exec() == QDialog.DialogCode.Accepted:
61 rev = dlg.getRevision() 63 rev = dlg.getRevision()
62 64
63 if rev is not None: 65 if rev is not None:
64 if rev == "": 66 if rev == "":
65 rev = "tip" 67 rev = "tip"
66 args = self.vcs.initCommand("sigcheck") 68 args = self.vcs.initCommand("sigcheck")
67 args.append(rev) 69 args.append(rev)
68 70
69 dia = HgDialog(self.tr('Verify Signatures'), self.vcs) 71 dia = HgDialog(self.tr("Verify Signatures"), self.vcs)
70 res = dia.startProcess(args) 72 res = dia.startProcess(args)
71 if res: 73 if res:
72 dia.exec() 74 dia.exec()
73 75
74 def hgGpgSign(self, revisions=None): 76 def hgGpgSign(self, revisions=None):
75 """ 77 """
76 Public method used to list the available bookmarks. 78 Public method used to list the available bookmarks.
77 79
78 @param revisions list containing the revisions to be signed 80 @param revisions list containing the revisions to be signed
79 @type list of str 81 @type list of str
80 """ 82 """
81 if revisions is None: 83 if revisions is None:
82 from .HgGpgSignDialog import HgGpgSignDialog 84 from .HgGpgSignDialog import HgGpgSignDialog
83 dlg = HgGpgSignDialog(self.vcs.hgGetTagsList(), 85
84 self.vcs.hgGetBranchesList(), 86 dlg = HgGpgSignDialog(
85 self.vcs.hgGetBookmarksList()) 87 self.vcs.hgGetTagsList(),
88 self.vcs.hgGetBranchesList(),
89 self.vcs.hgGetBookmarksList(),
90 )
86 if dlg.exec() == QDialog.DialogCode.Accepted: 91 if dlg.exec() == QDialog.DialogCode.Accepted:
87 revision, noCommit, message, keyId, local, force = ( 92 revision, noCommit, message, keyId, local, force = dlg.getData()
88 dlg.getData()
89 )
90 if revision: 93 if revision:
91 revisions = [revision] 94 revisions = [revision]
92 else: 95 else:
93 revisions = [] 96 revisions = []
94 else: 97 else:
97 noCommit = False 100 noCommit = False
98 message = "" 101 message = ""
99 keyId = "" 102 keyId = ""
100 local = False 103 local = False
101 force = False 104 force = False
102 105
103 args = self.vcs.initCommand("sign") 106 args = self.vcs.initCommand("sign")
104 if noCommit: 107 if noCommit:
105 args.append("--no-commit") 108 args.append("--no-commit")
106 if message: 109 if message:
107 args.append("--message") 110 args.append("--message")
113 args.append("--local") 116 args.append("--local")
114 if force: 117 if force:
115 args.append("--force") 118 args.append("--force")
116 for rev in revisions: 119 for rev in revisions:
117 args.append(rev) 120 args.append(rev)
118 121
119 dia = HgDialog(self.tr('Sign Revision'), self.vcs) 122 dia = HgDialog(self.tr("Sign Revision"), self.vcs)
120 res = dia.startProcess(args) 123 res = dia.startProcess(args)
121 if res: 124 if res:
122 dia.exec() 125 dia.exec()

eric ide

mercurial