branch: externals/vc-jj
commit 73101190f2e12b8de9c91427f67fef164317bb32
Author: Kristoffer Balintona <krisbalint...@gmail.com>
Commit: Rudi Schlatte <r...@noreply.codeberg.org>

    Implement create-tag function
    
    Define new function `vc-jj-create-tag`.  With `vc-jj-create-tag`,
    functions that use `vc-create-tag` now work with vc-jj, like
    `vc-create-branch`.  However, since jujutsu does not support adding
    tags, only calls to the function with a non-nil BRANCHP argument have
    an effect (e.g., the `vc-create-tag` command has no effect).
---
 vc-jj.el | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/vc-jj.el b/vc-jj.el
index 4ee003b96a..e918126ccd 100644
--- a/vc-jj.el
+++ b/vc-jj.el
@@ -460,6 +460,17 @@ parents.map(|c| concat(
       (insert revision)))
   buffer)
 
+(defun vc-jj-create-tag (_dir name branchp)
+  "Attach tag named NAME to the current revision.
+When BRANCHP is non-nil, a bookmark named NAME is created at the current
+revision.
+
+Since jujutsu does not support tagging revisions, a nil value of BRANCHP
+has no effect."
+  (if branchp
+      (vc-jj--command-dispatched nil 0 nil "bookmark" "create" name "--quiet")
+    (user-error "Setting tags is not supported by jujutsu")))
+
 (defun vc-jj-checkout (file &optional rev)
   "Restore the contents of FILE to be the same as in change REV.
 If REV is not specified, revert the file as with `vc-jj-revert'."

Reply via email to