about summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2021-08-17T15·35-0400
committergrfn <grfn@gws.fyi>2021-08-17T19·07+0000
commitdb3fdd5ee865a292a711fdcc788943bee4fda8a2 (patch)
tree19f119656e7c744e14dff8663a57c51a4ca572ff /tools
parent206f96fbed81c3ae5d7afc72e0807a85ff1cfea2 (diff)
feat(tvl.el): Make target branch configurable r/2746
I'm using gerrit at work now, and would like to use tvl.el to interact
with it via Emacs, but we use a different default branch than "canon".
This makes it configurable, and also marks it as safe so I can configure
it in .dir-locals.el

Change-Id: I66d4c7ce94351f2df863ec49dbc3e1d1d6d1547a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3369
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'tools')
-rw-r--r--tools/emacs-pkgs/tvl/tvl.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/emacs-pkgs/tvl/tvl.el b/tools/emacs-pkgs/tvl/tvl.el
index a5630184f209..add72f533d29 100644
--- a/tools/emacs-pkgs/tvl/tvl.el
+++ b/tools/emacs-pkgs/tvl/tvl.el
@@ -29,6 +29,11 @@
   "Location at which the TVL depot is checked out."
   :group 'tvl)
 
+(defcustom tvl-target-branch "canon"
+  "Branch to use to target CLs"
+  :group 'tvl
+  :safe (lambda (_) t))
+
 (defun tvl--gerrit-ref (target-branch &optional flags)
   (let ((flag-suffix (if flags (format "%%l=%s" (s-join "," flags))
                        "")))
@@ -38,7 +43,7 @@
   "Push to Gerrit for review."
   (interactive)
   (magit-push-refspecs tvl-gerrit-remote
-                       (tvl--gerrit-ref "canon")
+                       (tvl--gerrit-ref tvl-target-branch)
                        nil))
 
 (transient-append-suffix
@@ -49,7 +54,7 @@
   "Push to Gerrit as a work-in-progress."
   (interactive)
   (magit-push-refspecs tvl-gerrit-remote
-                       (concat (tvl--gerrit-ref "canon") "%wip")
+                       (concat (tvl--gerrit-ref tvl-target-branch) "%wip")
                        nil))
 
 (transient-append-suffix
@@ -60,7 +65,7 @@
   "Push to Gerrit for review."
   (interactive)
   (magit-push-refspecs tvl-gerrit-remote
-                       (tvl--gerrit-ref "canon" '("submit"))
+                       (tvl--gerrit-ref tvl-target-branch '("submit"))
                        nil))
 
 (transient-append-suffix
@@ -74,7 +79,7 @@ rubberstamp operation is dangerous and should only be used in
 `//users'."
   (interactive)
   (magit-push-refspecs tvl-gerrit-remote
-                       (tvl--gerrit-ref "canon"
+                       (tvl--gerrit-ref tvl-target-branch
                                         '("Code-Review+2" "publish-comments"))
                        nil))