Plugins/VcsPlugins/vcsMercurial/GpgExtension/gpg.py

changeset 5506
9482a0ded319
parent 5477
fb8875e356d4
child 6048
82ad8ec9548c
equal deleted inserted replaced
5504:ba1134308a7b 5506:9482a0ded319
81 dia = HgDialog(self.tr('Verify Signatures'), self.vcs) 81 dia = HgDialog(self.tr('Verify Signatures'), self.vcs)
82 res = dia.startProcess(args, repodir) 82 res = dia.startProcess(args, repodir)
83 if res: 83 if res:
84 dia.exec_() 84 dia.exec_()
85 85
86 def hgGpgSign(self, path): 86 def hgGpgSign(self, path, revisions=None):
87 """ 87 """
88 Public method used to list the available bookmarks. 88 Public method used to list the available bookmarks.
89 89
90 @param path directory name of the project (string) 90 @param path directory name of the project
91 @type str
92 @param revisions list containing the revisions to be signed
93 @type list of str
91 """ 94 """
92 # find the root of the repo 95 # find the root of the repo
93 repodir = self.vcs.splitPath(path)[0] 96 repodir = self.vcs.splitPath(path)[0]
94 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): 97 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
95 repodir = os.path.dirname(repodir) 98 repodir = os.path.dirname(repodir)
96 if os.path.splitdrive(repodir)[1] == os.sep: 99 if os.path.splitdrive(repodir)[1] == os.sep:
97 return 100 return
98 101
99 from .HgGpgSignDialog import HgGpgSignDialog 102 if revisions is None:
100 dlg = HgGpgSignDialog(self.vcs.hgGetTagsList(repodir), 103 from .HgGpgSignDialog import HgGpgSignDialog
101 self.vcs.hgGetBranchesList(repodir), 104 dlg = HgGpgSignDialog(self.vcs.hgGetTagsList(repodir),
102 self.vcs.hgGetBookmarksList(repodir)) 105 self.vcs.hgGetBranchesList(repodir),
103 if dlg.exec_() == QDialog.Accepted: 106 self.vcs.hgGetBookmarksList(repodir))
104 revision, noCommit, message, keyId, local, force = dlg.getData() 107 if dlg.exec_() == QDialog.Accepted:
105 108 revision, noCommit, message, keyId, local, force = \
106 args = self.vcs.initCommand("sign") 109 dlg.getData()
107 if noCommit: 110 if revision:
108 args.append("--no-commit") 111 revisions = [revision]
109 if message: 112 else:
110 args.append("--message") 113 revisions = []
111 args.append(message) 114 else:
112 if keyId: 115 return
113 args.append("--key") 116 else:
114 args.append(keyId) 117 noCommit = False
115 if local: 118 message = ""
116 args.append("--local") 119 keyId = ""
117 if force: 120 local = False
118 args.append("--force") 121 force = False
119 if revision: 122
120 args.append(revision) 123 args = self.vcs.initCommand("sign")
121 124 if noCommit:
122 dia = HgDialog(self.tr('Sign Revision'), self.vcs) 125 args.append("--no-commit")
123 res = dia.startProcess(args, repodir) 126 if message:
124 if res: 127 args.append("--message")
125 dia.exec_() 128 args.append(message)
129 if keyId:
130 args.append("--key")
131 args.append(keyId)
132 if local:
133 args.append("--local")
134 if force:
135 args.append("--force")
136 for rev in revisions:
137 args.append(rev)
138
139 dia = HgDialog(self.tr('Sign Revision'), self.vcs)
140 res = dia.startProcess(args, repodir)
141 if res:
142 dia.exec_()

eric ide

mercurial