60
60
(" Your turn" . " attention:self" )
61
61
(" Work in progress" . " is:open owner:self is:wip" )
62
62
(" Outgoing reviews" . " is:open owner:self -is:wip -is:ignored" )
63
- (" Incoming reviews" . " is:open -owner:self -is:wip -is:ignored (reviewer:self OR assignee:self )" )
63
+ (" Incoming reviews" . " is:open -owner:self -is:wip -is:ignored (reviewer:self)" )
64
64
(" CCed on" . " is:open -is:ignored cc:self" )
65
65
(" Recently closed" . " is:closed -is:ignored (-is:wip OR owner:self) (owner:self OR reviewer:self OR assignee:self OR cc:self) limit:15" ))
66
66
" Query search string that is used for the data shown in the `gerrit-dashboard' ." )
@@ -107,18 +107,6 @@ user names."
107
107
(seq-map (lambda (account-entry ) (alist-get 'username (cdr account-entry)))
108
108
(gerrit-get-accounts-alist)))
109
109
110
- (defun gerrit--read-assignee ()
111
- " Ask for the name of an assignee."
112
- (completing-read
113
- " Assignee: "
114
- (gerrit-get-usernames)
115
- nil ; ; predicate
116
- t ; ; require match
117
- nil ; ; initial
118
- nil ; ; hist (output only?)
119
- ; ; def
120
- nil ))
121
-
122
110
(defun gerrit--get-protocol ()
123
111
(if gerrit-use-ssl
124
112
" https://"
@@ -343,45 +331,6 @@ This refspec is a string of the form \='refs/changes/xx/xx/x\='."
343
331
(concat (gerrit--get-protocol) gerrit-host " /tools/hooks/commit-msg" ) hook-file)
344
332
(set-file-modes hook-file #o755 ))))
345
333
346
- (defun gerrit-push-and-assign (assignee &rest push-args )
347
- " Execute Git push with PUSH-ARGS and assign changes to ASSIGNEE.
348
-
349
- A section in the respective process buffer is created."
350
- (interactive )
351
- (progn
352
- (apply #'magit-run-git-async " push" push-args)
353
- (set-process-sentinel
354
- magit-this-process
355
- (lambda (process event )
356
- (when (memq (process-status process) '(exit signal))
357
- (when (buffer-live-p (process-buffer process))
358
- (with-current-buffer (process-buffer process)
359
- (when-let* ((section (get-text-property (point ) 'magit-section ))
360
- (output (buffer-substring-no-properties
361
- (oref section content)
362
- (oref section end))))
363
- (if (not (zerop (process-exit-status process)))
364
- ; ; error
365
- (magit-process-sentinel process event)
366
-
367
- ; ; success
368
- (process-put process 'inhibit-refresh t )
369
-
370
- ; ; parse the output of "git push" and extract the change numbers. This
371
- ; ; information is used for setting the specified assignee
372
- ; ; Alternatively we could perform a gerrit query with owner:me and set the
373
- ; ; assignee for the latest change(s).
374
- (when assignee
375
- (if-let* ((matched-changes (s-match-strings-all " /\\ +/[0-9]+" output)))
376
- (seq-do (lambda (x ) (let ((changenr (s-chop-prefix " /+/" (car x))))
377
- (message " Setting assignee of %s to %s " changenr assignee)
378
- (gerrit-rest-change-set-assignee changenr assignee)
379
- (gerrit-magit-process-buffer-add-item
380
- (format " Assignee of change %s was set to %s " changenr assignee)
381
- " set-assignee" changenr)))
382
- matched-changes)))
383
- (magit-process-sentinel process event))))))))))
384
-
385
334
(defun gerrit-upload--get-refspec ()
386
335
(concat " refs/for/" (gerrit-get-upstream-branch)))
387
336
@@ -411,8 +360,7 @@ A section in the respective process buffer is created."
411
360
(gerrit--ensure-commit-msg-hook-exists)
412
361
; ; TODO check that all to-be-uploaded commits have a changeid line
413
362
414
- (let (assignee
415
- push-opts
363
+ (let (push-opts
416
364
no-verify
417
365
(remote (gerrit-get-remote))
418
366
(refspec (gerrit-upload--get-refspec)))
@@ -429,8 +377,6 @@ A section in the respective process buffer is created."
429
377
; ; TODO check that reviewers are valid (by checking that all
430
378
; ; reviewers don't contain a white-space)
431
379
(push (concat " r=" reviewer) push-opts)))
432
- ((s-starts-with? " assignee=" arg)
433
- (setq assignee (s-chop-prefix " assignee=" arg)))
434
380
((s-starts-with? " topic=" arg)
435
381
(push arg push-opts))
436
382
((string= " ready" arg)
@@ -450,8 +396,9 @@ A section in the respective process buffer is created."
450
396
(push " --no-verify" push-args))
451
397
(push remote push-args)
452
398
(push (concat " HEAD:" refspec) push-args)
453
- (apply #'gerrit-push-and-assign
454
- assignee
399
+
400
+ (apply #'magit-run-git-async
401
+ " push"
455
402
; ; don't error when encountering local tags, which
456
403
; ; are absent from gerrit.
457
404
" --no-follow-tags"
@@ -461,7 +408,6 @@ A section in the respective process buffer is created."
461
408
" Transient used for uploading changes to gerrit"
462
409
[" Arguments"
463
410
(gerrit-upload:--reviewers)
464
- (gerrit-upload:--assignee)
465
411
(" w" " Work in Progress" " wip" )
466
412
(" v" " Ready for Review" " ready" )
467
413
(gerrit-upload:--topic)
@@ -502,35 +448,13 @@ which is not the same as nil."
502
448
nil
503
449
nil ))
504
450
505
- (transient-define-argument gerrit-upload:--assignee ()
506
- :description " Assignee"
507
- :class 'transient-option
508
- :key " a"
509
- :argument " assignee="
510
- :reader 'gerrit-upload:--read-assignee )
511
-
512
451
(transient-define-argument gerrit-upload:--topic ()
513
452
:description " Topic"
514
453
:class 'transient-option
515
454
:key " t"
516
455
:argument " topic="
517
456
:reader 'gerrit-upload:--read-topic )
518
457
519
- (defun gerrit-upload:--read-assignee (prompt _initial-input history )
520
- ; ; (gerrit--read-assignee) this doesn't update the history
521
-
522
- ; ; using the history here doesn't have an effect (maybe it does, but for
523
- ; ; ivy-completing-read it doesn't)
524
- (completing-read
525
- prompt
526
- (gerrit-get-usernames)
527
- nil ; ; predicate
528
- t ; ; require match
529
- nil ; ; initial ;; Maybe it makes sense to use the last/first history element here
530
- history ; ; hist (output only?)
531
- ; ; def
532
- nil ))
533
-
534
458
(defun gerrit-upload:--read-topic (prompt _initial-input history )
535
459
(completing-read
536
460
prompt
@@ -836,9 +760,6 @@ shown in the section buffer."
836
760
(" Subject" 55 t )
837
761
(" Status" 10 t )
838
762
(" Owner" 15 t )
839
- ; ; TODO remove this entry at runtime if the gerrit version > 3.4
840
- ; ; and the legacy assignee support is disabled
841
- ; ; ("Assignee" 15 t)
842
763
(" Reviewers" 25 nil )
843
764
; ; ("CC" 15 nil)
844
765
(" Repo" 24 t )
@@ -902,7 +823,6 @@ alist."
902
823
(status . ,(alist-get 'status change)) ; ; string
903
824
; ; alist-get 'owner => (_account_id . 1017133)
904
825
(owner . ,(gerrit--alist-get-recursive 'owner '_account_id change))
905
- (assignee . ,(cdr (car (alist-get 'assignee change)))) ; ; optional string
906
826
907
827
; ; all account-ids of all users in the attention set
908
828
(attention-set . ,(seq-map (lambda (attention-entry )
@@ -951,10 +871,6 @@ alist."
951
871
; ; displayed inside the dashboard
952
872
(gerrit-rest-change-patch (button-get button 'change-id )))
953
873
954
- (defun gerrit-dashboard--button-open-assignee-query (&optional button )
955
- (interactive )
956
- (gerrit-query (concat " assignee:" (button-get button 'assignee ))))
957
-
958
874
(defun gerrit-dashboard--button-open-owner-query (&optional button )
959
875
(interactive )
960
876
(gerrit-query (concat " owner:" (button-get button 'owner ))))
@@ -1003,15 +919,6 @@ alist."
1003
919
action gerrit-dashboard--button-open-owner-query)
1004
920
; ; empty owner
1005
921
" " )))
1006
- (" Assignee" (if-let* ((assignee
1007
- (alist-get (alist-get 'assignee change-metadata)
1008
- (gerrit-get-accounts-alist))))
1009
- `(,(propertize (alist-get 'name assignee) 'face 'magit-log-author )
1010
- assignee ,(alist-get 'username assignee)
1011
- follow-link t
1012
- action gerrit-dashboard--button-open-assignee-query)
1013
- ; ; empty assignee (not clickable)
1014
- " " ))
1015
922
(" Reviewers" (let ((attention-set (alist-get 'attention-set change-metadata))
1016
923
(owner-account-id (alist-get 'owner change-metadata)))
1017
924
; ; TODO exclude the owner from the reviewers
@@ -1143,23 +1050,6 @@ locally and is referenced in
1143
1050
; ; TODO interactively ask for vote + message
1144
1051
(gerrit-rest-topic-set-cr-vote (gerrit-dashboard--topic) " +2" " " ))
1145
1052
1146
- (defun gerrit-dashboard-assign-change ()
1147
- " Set assignee of the change under point."
1148
- (interactive )
1149
- (let ((change-number (gerrit-dashboard--entry-number))
1150
- (assignee (gerrit--read-assignee)))
1151
- (message " setting assignee of change %s to %s " change-number assignee)
1152
- (gerrit-rest-change-set-assignee change-number assignee)
1153
- ; ; refresh dashboard
1154
- (gerrit-dashboard--refresh--and-point-restore)))
1155
-
1156
- (defun gerrit-dashboard-assign-change-to-me ()
1157
- " Set assignee of the change under point."
1158
- (interactive )
1159
- (gerrit-rest-change-set-assignee (gerrit-dashboard--entry-number) " self" )
1160
- ; ; refresh dashboard
1161
- (gerrit-dashboard--refresh--and-point-restore))
1162
-
1163
1053
(defun gerrit-dashboard--get-list-entries ()
1164
1054
" Get the all entries used for \" tabulated-list-entries\" ."
1165
1055
(seq-reduce (lambda (acc conscell )
0 commit comments