From 688616db5254127567e51bc93cdec62f39e8dc08 Mon Sep 17 00:00:00 2001 From: larpi <33772093+larpios@users.noreply.github.com> Date: Wed, 3 Jun 2026 16:21:10 +0900 Subject: [PATCH] feat(push): add the `deleted` option for the push operation (#117) --- lua/jj/cmd/init.lua | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/lua/jj/cmd/init.lua b/lua/jj/cmd/init.lua index 9213055..b39f0a1 100644 --- a/lua/jj/cmd/init.lua +++ b/lua/jj/cmd/init.lua @@ -120,6 +120,7 @@ local split_module = require("jj.cmd.split") --- @class jj.cmd.push_opts --- @field bookmark? string Specific bookmark to push (default: all) +--- @field deleted? boolean Push deleted revisions --- @class jj.cmd.open_pr_opts --- @field list_bookmarks? boolean Whether to select from all bookmarks instead of current revision @@ -750,6 +751,9 @@ function M.push(opts) if opts.bookmark then utils.notify(string.format("Pushing `%s` bookmark ...", opts.bookmark), vim.log.levels.INFO, 1000) cmd = string.format("%s --bookmark %s", cmd, opts.bookmark) + elseif opts.deleted then + utils.notify("Pushing deleted bookmarks...", vim.log.levels.INFO, 1000) + cmd = cmd .. " --deleted" else utils.notify(string.format("Pushing `ALL` bookmarks...", opts.bookmark), vim.log.levels.INFO, 1000) end @@ -1286,11 +1290,20 @@ function M.j(args) M.abandon() end, push = function() - if #remaining_args > 0 then - M.push({ bookmark = remaining_args[1] }) - else - M.push() + local opts = {} + for _, arg in ipairs(remaining_args) do + if arg == "--deleted" then + opts.deleted = true + else + opts.bookmark = arg + end end + + if opts.deleted and opts.bookmark then + utils.notify("Cannot specify both --deleted and --bookmark", vim.log.levels.ERROR) + return + end + M.push(opts) end, fetch = function() M.fetch()