Skip to content

Commit

Permalink
Merge pull request #22 from thisch/simpledownloadtrans
Browse files Browse the repository at this point in the history
Add gerrit-download-transient
  • Loading branch information
twmr authored Oct 2, 2021
2 parents 75ec3df + 58cbd71 commit 28df91e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ Now you can list the secrets using `secrets-show-secrets`.

**TODO** extend/finalize this documentation.

## News

October 2021:

* Add a new transient called `gerrit-download-transient`, which will replace
the `gerrit-download` function in the future.

## Screenshots

![gerrit-dashboard](https://user-images.githubusercontent.com/206581/88588506-f8048780-d057-11ea-9c57-ac2a58aadd58.png)
Expand Down
40 changes: 40 additions & 0 deletions gerrit.el
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,46 @@ gerrit-upload: (current cmd: %(concat (gerrit-upload-create-git-review-cmd)))
(changenr (car (s-split " " (s-trim selected-line)))))
changenr))

(transient-define-argument gerrit-download:--branch ()
:description "Branch"
:class 'transient-option
:key "b"
:argument "branch=")

(defun gerrit-download:--in-current-repo (changenr)
"Download a gerrit change CHANGENR for the current project into the current workspace."
(interactive
(list
(gerrit--select-change-from-matching-changes
;; create a filter that matches only changes for the current project
;; and for the selected (if any) branch
(concat "status:open"
" project:" (gerrit-get-current-project)
(car (cl-loop for arg in (transient-args 'gerrit-download-transient) collect
(cond ((s-starts-with? "branch=" arg)
(concat " branch:" (s-chop-prefix "branch=" arg)))
;; TODO add support for other filter options
(t
nil))))))))
(gerrit-download--new changenr))

(transient-define-prefix gerrit-download-transient ()
"Transient used for downloading changes"
;; download in current repo (key c: current)
;; TODO download in all known projects (key o: all/other)
;; download specific branch (depends on project!)

["Arguments"
(gerrit-download:--branch)
]
["Actions"
;; TODO display somewhere the name of the current repo (not sure if
;; emacs-transient supports this)
("c" "In current repo" gerrit-download:--in-current-repo)
;; ("k" "In known repo" gerrit-download:--in-known-repo)
])

;; deprecated
(defun gerrit-download (changenr)
"Download change with CHANGENR from the gerrit server."
(interactive
Expand Down

0 comments on commit 28df91e

Please sign in to comment.