eric6/Plugins/VcsPlugins/vcsMercurial/GpgExtension/gpg.py

changeset 7970
c4ee8a81584c
parent 7923
91e843545d9a
child 7971
ff2971513d6d
equal deleted inserted replaced
7969:62eff8b34a8d 7970:c4ee8a81584c
35 Public method used to shutdown the gpg interface. 35 Public method used to shutdown the gpg interface.
36 """ 36 """
37 if self.gpgSignaturesDialog is not None: 37 if self.gpgSignaturesDialog is not None:
38 self.gpgSignaturesDialog.close() 38 self.gpgSignaturesDialog.close()
39 39
40 def hgGpgSignatures(self, path): 40 def hgGpgSignatures(self):
41 """ 41 """
42 Public method used to list all signed changesets. 42 Public method used to list all signed changesets.
43
44 @param path directory name of the project (string)
45 """ 43 """
46 from .HgGpgSignaturesDialog import HgGpgSignaturesDialog 44 from .HgGpgSignaturesDialog import HgGpgSignaturesDialog
47 self.gpgSignaturesDialog = HgGpgSignaturesDialog(self.vcs) 45 self.gpgSignaturesDialog = HgGpgSignaturesDialog(self.vcs)
48 self.gpgSignaturesDialog.show() 46 self.gpgSignaturesDialog.show()
49 self.gpgSignaturesDialog.start(path) 47 self.gpgSignaturesDialog.start()
50 48
51 def hgGpgVerifySignatures(self, path, rev=None): 49 def hgGpgVerifySignatures(self, rev=None):
52 """ 50 """
53 Public method used to verify the signatures of a revision. 51 Public method used to verify the signatures of a revision.
54 52
55 @param path directory name of the project (string)
56 @param rev revision to check (string) 53 @param rev revision to check (string)
57 """ 54 """
58 # find the root of the repo
59 repodir = self.vcs.splitPath(path)[0]
60 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
61 repodir = os.path.dirname(repodir)
62 if os.path.splitdrive(repodir)[1] == os.sep:
63 return
64
65 if rev is None: 55 if rev is None:
66 dlg = HgRevisionSelectionDialog( 56 dlg = HgRevisionSelectionDialog(
67 self.vcs.hgGetTagsList(repodir), 57 self.vcs.hgGetTagsList(),
68 self.vcs.hgGetBranchesList(repodir), 58 self.vcs.hgGetBranchesList(),
69 self.vcs.hgGetBookmarksList(repodir)) 59 self.vcs.hgGetBookmarksList())
70 if dlg.exec() == QDialog.Accepted: 60 if dlg.exec() == QDialog.Accepted:
71 rev = dlg.getRevision(revset=False) 61 rev = dlg.getRevision(revset=False)
72 62
73 if rev is not None: 63 if rev is not None:
74 if rev == "": 64 if rev == "":
75 rev = "tip" 65 rev = "tip"
76 args = self.vcs.initCommand("sigcheck") 66 args = self.vcs.initCommand("sigcheck")
77 args.append(rev) 67 args.append(rev)
78 68
79 dia = HgDialog(self.tr('Verify Signatures'), self.vcs) 69 dia = HgDialog(self.tr('Verify Signatures'), self.vcs)
80 res = dia.startProcess(args, repodir) 70 res = dia.startProcess(args)
81 if res: 71 if res:
82 dia.exec() 72 dia.exec()
83 73
84 def hgGpgSign(self, path, revisions=None): 74 def hgGpgSign(self, revisions=None):
85 """ 75 """
86 Public method used to list the available bookmarks. 76 Public method used to list the available bookmarks.
87 77
88 @param path directory name of the project
89 @type str
90 @param revisions list containing the revisions to be signed 78 @param revisions list containing the revisions to be signed
91 @type list of str 79 @type list of str
92 """ 80 """
93 # find the root of the repo
94 repodir = self.vcs.splitPath(path)[0]
95 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
96 repodir = os.path.dirname(repodir)
97 if os.path.splitdrive(repodir)[1] == os.sep:
98 return
99
100 if revisions is None: 81 if revisions is None:
101 from .HgGpgSignDialog import HgGpgSignDialog 82 from .HgGpgSignDialog import HgGpgSignDialog
102 dlg = HgGpgSignDialog(self.vcs.hgGetTagsList(repodir), 83 dlg = HgGpgSignDialog(self.vcs.hgGetTagsList(),
103 self.vcs.hgGetBranchesList(repodir), 84 self.vcs.hgGetBranchesList(),
104 self.vcs.hgGetBookmarksList(repodir)) 85 self.vcs.hgGetBookmarksList())
105 if dlg.exec() == QDialog.Accepted: 86 if dlg.exec() == QDialog.Accepted:
106 revision, noCommit, message, keyId, local, force = ( 87 revision, noCommit, message, keyId, local, force = (
107 dlg.getData() 88 dlg.getData()
108 ) 89 )
109 if revision: 90 if revision:
134 args.append("--force") 115 args.append("--force")
135 for rev in revisions: 116 for rev in revisions:
136 args.append(rev) 117 args.append(rev)
137 118
138 dia = HgDialog(self.tr('Sign Revision'), self.vcs) 119 dia = HgDialog(self.tr('Sign Revision'), self.vcs)
139 res = dia.startProcess(args, repodir) 120 res = dia.startProcess(args)
140 if res: 121 if res:
141 dia.exec() 122 dia.exec()

eric ide

mercurial