Skip to content

Commit

Permalink
forge-list-labeled-{pullreqs,issues}: New commands
Browse files Browse the repository at this point in the history
  • Loading branch information
tarsius committed Aug 22, 2021
1 parent 70e8246 commit a3e6f8a
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 4 deletions.
14 changes: 12 additions & 2 deletions docs/forge.org
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#+TEXINFO_DIR_CATEGORY: Emacs
#+TEXINFO_DIR_TITLE: Forge: (forge).
#+TEXINFO_DIR_DESC: Access Git Forges from Magit
#+SUBTITLE: for version 0.2.1 (v0.2.1-17-gcf455507+1)
#+SUBTITLE: for version 0.2.1 (v0.2.1-18-g70e8246b+1)

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

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

#+BEGIN_QUOTE
Copyright (C) 2018-2021 Jonas Bernoulli <jonas@bernoul.li>
Expand Down Expand Up @@ -689,6 +689,16 @@ dedicated buffers:
This command lists the current repository's issues in a separate
buffer.

- Command: forge-list-labeled-pullreqs

This command lists the current repository's open pull-requests that
are labeled with a label read from the user.

- Command: forge-list-labeled-issues

This command lists the current repository's open issues that are
labeled with a label read from the user.

- Command: forge-list-assigned-pullreqs

This command lists the current repository's open pull-requests that
Expand Down
18 changes: 16 additions & 2 deletions docs/forge.texi
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ General Public License for more details.
@finalout
@titlepage
@title Forge User and Developer Manual
@subtitle for version 0.2.1 (v0.2.1-17-gcf455507+1)
@subtitle for version 0.2.1 (v0.2.1-18-g70e8246b+1)
@author Jonas Bernoulli
@page
@vskip 0pt plus 1filll
Expand All @@ -48,7 +48,7 @@ Forge allows you to work with Git forges, such as Github and Gitlab,
from the comfort of Magit and the rest of Emacs.

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

@quotation
Copyright (C) 2018-2021 Jonas Bernoulli <jonas@@bernoul.li>
Expand Down Expand Up @@ -971,6 +971,20 @@ buffer.

@end table

@cindex forge-list-labeled-pullreqs
@deffn Command forge-list-labeled-pullreqs

This command lists the current repository's open pull-requests that
are labeled with a label read from the user.
@end deffn

@cindex forge-list-labeled-issues
@deffn Command forge-list-labeled-issues

This command lists the current repository's open issues that are
labeled with a label read from the user.
@end deffn

@cindex forge-list-assigned-pullreqs
@deffn Command forge-list-assigned-pullreqs

Expand Down
42 changes: 42 additions & 0 deletions lisp/forge-list.el
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,27 @@ This is a list of package names. Used by the commands
(forge--tablist-columns-vector)
id))))

;;;###autoload
(defun forge-list-labeled-issues (id label)
"List issues of the current repository that have LABEL.
List them in a separate buffer."
(interactive (list (oref (forge-get-repository t) id)
(magit-completing-read-multiple*
"Label: "
(mapcar #'cadr (oref (forge-get-repository t) labels))
nil t)))
(forge-topic-list-setup #'forge-issue-list-mode id nil nil
(lambda ()
(forge-sql [:select $i1 :from [issue issue_label label]
:where (and (= issue_label:issue issue:id)
(= issue_label:id label:id)
(= issue:repository $s2)
(= label:name $s3)
(isnull issue:closed))
:order-by [(desc updated)]]
(forge--tablist-columns-vector 'issue)
id label))))

;;;###autoload
(defun forge-list-assigned-issues (id)
"List issues of the current repository that are assigned to you.
Expand Down Expand Up @@ -285,6 +306,27 @@ Only Github is supported for now."
(forge--tablist-columns-vector)
id))))

;;;###autoload
(defun forge-list-labeled-pullreqs (id label)
"List pull-requests of the current repository that have LABEL.
List them in a separate buffer."
(interactive (list (oref (forge-get-repository t) id)
(magit-completing-read-multiple*
"Label: "
(mapcar #'cadr (oref (forge-get-repository t) labels))
nil t)))
(forge-topic-list-setup #'forge-pullreq-list-mode id nil nil
(lambda ()
(forge-sql [:select $i1 :from [pullreq pullreq_label label]
:where (and (= pullreq_label:pullreq pullreq:id)
(= pullreq_label:id label:id)
(= pullreq:repository $s2)
(= label:name $s3)
(isnull pullreq:closed))
:order-by [(desc updated)]]
(forge--tablist-columns-vector 'pullreq)
id label))))

;;;###autoload
(defun forge-list-assigned-pullreqs (id)
"List pull-requests of the current repository that are assigned to you.
Expand Down

0 comments on commit a3e6f8a

Please sign in to comment.