Skip to content

Commit a3e6f8a

Browse files
committed
forge-list-labeled-{pullreqs,issues}: New commands
1 parent 70e8246 commit a3e6f8a

File tree

3 files changed

+70
-4
lines changed

3 files changed

+70
-4
lines changed

docs/forge.org

+12-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#+TEXINFO_DIR_CATEGORY: Emacs
99
#+TEXINFO_DIR_TITLE: Forge: (forge).
1010
#+TEXINFO_DIR_DESC: Access Git Forges from Magit
11-
#+SUBTITLE: for version 0.2.1 (v0.2.1-17-gcf455507+1)
11+
#+SUBTITLE: for version 0.2.1 (v0.2.1-18-g70e8246b+1)
1212

1313
#+TEXINFO_DEFFN: t
1414
#+OPTIONS: H:4 num:4 toc:2
@@ -20,7 +20,7 @@ Forge allows you to work with Git forges, such as Github and Gitlab,
2020
from the comfort of Magit and the rest of Emacs.
2121

2222
#+TEXINFO: @noindent
23-
This manual is for Forge version 0.2.1 (v0.2.1-17-gcf455507+1).
23+
This manual is for Forge version 0.2.1 (v0.2.1-18-g70e8246b+1).
2424

2525
#+BEGIN_QUOTE
2626
Copyright (C) 2018-2021 Jonas Bernoulli <[email protected]>
@@ -689,6 +689,16 @@ dedicated buffers:
689689
This command lists the current repository's issues in a separate
690690
buffer.
691691

692+
- Command: forge-list-labeled-pullreqs
693+
694+
This command lists the current repository's open pull-requests that
695+
are labeled with a label read from the user.
696+
697+
- Command: forge-list-labeled-issues
698+
699+
This command lists the current repository's open issues that are
700+
labeled with a label read from the user.
701+
692702
- Command: forge-list-assigned-pullreqs
693703

694704
This command lists the current repository's open pull-requests that

docs/forge.texi

+16-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ General Public License for more details.
3131
@finalout
3232
@titlepage
3333
@title Forge User and Developer Manual
34-
@subtitle for version 0.2.1 (v0.2.1-17-gcf455507+1)
34+
@subtitle for version 0.2.1 (v0.2.1-18-g70e8246b+1)
3535
@author Jonas Bernoulli
3636
@page
3737
@vskip 0pt plus 1filll
@@ -48,7 +48,7 @@ Forge allows you to work with Git forges, such as Github and Gitlab,
4848
from the comfort of Magit and the rest of Emacs.
4949

5050
@noindent
51-
This manual is for Forge version 0.2.1 (v0.2.1-17-gcf455507+1).
51+
This manual is for Forge version 0.2.1 (v0.2.1-18-g70e8246b+1).
5252

5353
@quotation
5454
Copyright (C) 2018-2021 Jonas Bernoulli <jonas@@bernoul.li>
@@ -971,6 +971,20 @@ buffer.
971971

972972
@end table
973973

974+
@cindex forge-list-labeled-pullreqs
975+
@deffn Command forge-list-labeled-pullreqs
976+
977+
This command lists the current repository's open pull-requests that
978+
are labeled with a label read from the user.
979+
@end deffn
980+
981+
@cindex forge-list-labeled-issues
982+
@deffn Command forge-list-labeled-issues
983+
984+
This command lists the current repository's open issues that are
985+
labeled with a label read from the user.
986+
@end deffn
987+
974988
@cindex forge-list-assigned-pullreqs
975989
@deffn Command forge-list-assigned-pullreqs
976990

lisp/forge-list.el

+42
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,27 @@ This is a list of package names. Used by the commands
234234
(forge--tablist-columns-vector)
235235
id))))
236236

237+
;;;###autoload
238+
(defun forge-list-labeled-issues (id label)
239+
"List issues of the current repository that have LABEL.
240+
List them in a separate buffer."
241+
(interactive (list (oref (forge-get-repository t) id)
242+
(magit-completing-read-multiple*
243+
"Label: "
244+
(mapcar #'cadr (oref (forge-get-repository t) labels))
245+
nil t)))
246+
(forge-topic-list-setup #'forge-issue-list-mode id nil nil
247+
(lambda ()
248+
(forge-sql [:select $i1 :from [issue issue_label label]
249+
:where (and (= issue_label:issue issue:id)
250+
(= issue_label:id label:id)
251+
(= issue:repository $s2)
252+
(= label:name $s3)
253+
(isnull issue:closed))
254+
:order-by [(desc updated)]]
255+
(forge--tablist-columns-vector 'issue)
256+
id label))))
257+
237258
;;;###autoload
238259
(defun forge-list-assigned-issues (id)
239260
"List issues of the current repository that are assigned to you.
@@ -285,6 +306,27 @@ Only Github is supported for now."
285306
(forge--tablist-columns-vector)
286307
id))))
287308

309+
;;;###autoload
310+
(defun forge-list-labeled-pullreqs (id label)
311+
"List pull-requests of the current repository that have LABEL.
312+
List them in a separate buffer."
313+
(interactive (list (oref (forge-get-repository t) id)
314+
(magit-completing-read-multiple*
315+
"Label: "
316+
(mapcar #'cadr (oref (forge-get-repository t) labels))
317+
nil t)))
318+
(forge-topic-list-setup #'forge-pullreq-list-mode id nil nil
319+
(lambda ()
320+
(forge-sql [:select $i1 :from [pullreq pullreq_label label]
321+
:where (and (= pullreq_label:pullreq pullreq:id)
322+
(= pullreq_label:id label:id)
323+
(= pullreq:repository $s2)
324+
(= label:name $s3)
325+
(isnull pullreq:closed))
326+
:order-by [(desc updated)]]
327+
(forge--tablist-columns-vector 'pullreq)
328+
id label))))
329+
288330
;;;###autoload
289331
(defun forge-list-assigned-pullreqs (id)
290332
"List pull-requests of the current repository that are assigned to you.

0 commit comments

Comments
 (0)