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: |