Plugins/VcsPlugins/vcsMercurial/GpgExtension/gpg.py

changeset 5506
9482a0ded319
parent 5477
fb8875e356d4
child 6048
82ad8ec9548c
--- a/Plugins/VcsPlugins/vcsMercurial/GpgExtension/gpg.py	Sat Feb 11 10:57:25 2017 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/GpgExtension/gpg.py	Sat Feb 11 15:35:07 2017 +0100
@@ -83,11 +83,14 @@
             if res:
                 dia.exec_()
     
-    def hgGpgSign(self, path):
+    def hgGpgSign(self, path, revisions=None):
         """
         Public method used to list the available bookmarks.
         
-        @param path directory name of the project (string)
+        @param path directory name of the project
+        @type str
+        @param revisions list containing the revisions to be signed
+        @type list of str
         """
         # find the root of the repo
         repodir = self.vcs.splitPath(path)[0]
@@ -96,30 +99,44 @@
             if os.path.splitdrive(repodir)[1] == os.sep:
                 return
         
-        from .HgGpgSignDialog import HgGpgSignDialog
-        dlg = HgGpgSignDialog(self.vcs.hgGetTagsList(repodir),
-                              self.vcs.hgGetBranchesList(repodir),
-                              self.vcs.hgGetBookmarksList(repodir))
-        if dlg.exec_() == QDialog.Accepted:
-            revision, noCommit, message, keyId, local, force = dlg.getData()
-            
-            args = self.vcs.initCommand("sign")
-            if noCommit:
-                args.append("--no-commit")
-            if message:
-                args.append("--message")
-                args.append(message)
-            if keyId:
-                args.append("--key")
-                args.append(keyId)
-            if local:
-                args.append("--local")
-            if force:
-                args.append("--force")
-            if revision:
-                args.append(revision)
-            
-            dia = HgDialog(self.tr('Sign Revision'), self.vcs)
-            res = dia.startProcess(args, repodir)
-            if res:
-                dia.exec_()
+        if revisions is None:
+            from .HgGpgSignDialog import HgGpgSignDialog
+            dlg = HgGpgSignDialog(self.vcs.hgGetTagsList(repodir),
+                                  self.vcs.hgGetBranchesList(repodir),
+                                  self.vcs.hgGetBookmarksList(repodir))
+            if dlg.exec_() == QDialog.Accepted:
+                revision, noCommit, message, keyId, local, force = \
+                    dlg.getData()
+                if revision:
+                    revisions = [revision]
+                else:
+                    revisions = []
+            else:
+                return
+        else:
+            noCommit = False
+            message = ""
+            keyId = ""
+            local = False
+            force = False
+        
+        args = self.vcs.initCommand("sign")
+        if noCommit:
+            args.append("--no-commit")
+        if message:
+            args.append("--message")
+            args.append(message)
+        if keyId:
+            args.append("--key")
+            args.append(keyId)
+        if local:
+            args.append("--local")
+        if force:
+            args.append("--force")
+        for rev in revisions:
+            args.append(rev)
+        
+        dia = HgDialog(self.tr('Sign Revision'), self.vcs)
+        res = dia.startProcess(args, repodir)
+        if res:
+            dia.exec_()

eric ide

mercurial