[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vc-got 686eac9 026/145: implemented vc-got-push
From: |
ELPA Syncer |
Subject: |
[elpa] externals/vc-got 686eac9 026/145: implemented vc-got-push |
Date: |
Thu, 9 Sep 2021 15:58:26 -0400 (EDT) |
branch: externals/vc-got
commit 686eac9a1fae366933598d31881b2684f69dbeaa
Author: Omar Polo <op@omarpolo.com>
Commit: Omar Polo <op@omarpolo.com>
implemented vc-got-push
---
vc-got.el | 36 +++++++++++++++++++++++++++++-------
1 file changed, 29 insertions(+), 7 deletions(-)
diff --git a/vc-got.el b/vc-got.el
index 3af9891..32c1b2a 100755
--- a/vc-got.el
+++ b/vc-got.el
@@ -66,6 +66,8 @@
;; - merge-branch DONE
;; - merge-news NOT IMPLEMENTED
;; - pull DONE
+;; - push DONE
+;; uses git
;; - steal-lock NOT IMPLEMENTED
;; - modify-change-comment NOT IMPLEMENTED
;; can be implemented via histedit, if I understood correctly
@@ -121,6 +123,14 @@
`(when-let (default-directory (vc-got-root ,file))
,@body))
+(defun vc-got--repo-root ()
+ "Return the path to the repository root.
+Assume `default-directory' is inside a got worktree."
+ (vc-got-with-worktree default-directory
+ (with-temp-buffer
+ (insert-file-contents ".got/repository")
+ (string-trim (buffer-string) nil "\n"))))
+
(defun vc-got--call (&rest args)
"Call `vc-got-cmd' in the `default-directory' with ARGS and put the output
in the current buffer."
(apply #'process-file vc-got-cmd nil (current-buffer) nil args))
@@ -424,16 +434,28 @@ DIR-OR-FILE."
(when branch
(vc-got--integrate branch))))
-(defun vc-got-pull (prompt)
- "Execute got pull, prompting the user for the full command if PROMPT is not
nil."
- (let* ((root (vc-got-root default-directory))
- (buffer (format "*vc-got : %s*" (expand-file-name root))))
+(defun vc-got--push-pull (cmd op prompt root)
+ "Execute CMD OP, or prompt the user if PROMPT is non-nil.
+ROOT is the worktree root."
+ (let ((buffer (format "*vc-got : %s*" (expand-file-name root))))
(when-let (cmd (if prompt
(split-string
- (read-shell-command "Got pull command: " "got fetch")
+ (read-shell-command (format "%s %s command: " cmd op)
+ (format "%s %s" cmd op))
" " t)
- '("got" "fetch")))
- (apply #'vc-do-command buffer 0 vc-got-cmd nil (cdr cmd)))))
+ (list cmd op)))
+ (apply #'vc-do-command buffer 0 (car cmd) nil (cdr cmd)))))
+
+(defun vc-got-pull (prompt)
+ "Execute got pull, prompting the user for the full command if PROMPT is not
nil."
+ (vc-got--push-pull vc-got-cmd "fetch" prompt (vc-got-root
default-directory)))
+
+(defun vc-got-push (prompt)
+ "Run git push (not got!) in the repository dir.
+If PROMPT is non-nil, prompt for the git command to run."
+ (let* ((root (vc-got-root default-directory))
+ (default-directory (vc-got--repo-root)))
+ (vc-got--push-pull "git" "push" prompt root)))
(defun vc-got-print-log (files buffer &optional _shortlog start-revision limit)
"Insert the revision log for FILES into BUFFER.
- [elpa] externals/vc-got 08ca3c5 007/145: added readme, (continued)
- [elpa] externals/vc-got 08ca3c5 007/145: added readme, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got c0c9a33 009/145: docs improvement, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 518ede1 010/145: augment vc-got--log, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got eb85ad2 011/145: implemented remaninig state-changing and some history functions, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 4571b1f 013/145: Summary: got log expects a relative path, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 30dcede 015/145: remove ``Summary'' from the commit, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 694534b 017/145: implemented vc-got-mode-line-string, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 345290b 020/145: improve vc-got–diff and vc-got-diff, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 52a1813 021/145: add-to-list is better at strings than cl-pushnew, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got f2e1ddb 028/145: document vc-got-stage-mode, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 686eac9 026/145: implemented vc-got-push,
ELPA Syncer <=
- [elpa] externals/vc-got a8466f0 022/145: implement dir-extra-headers, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 9ad1eb5 025/145: implemented vc-got-log-outgoing, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got a5e9be3 029/145: fix table, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got cdd3e16 030/145: use vc-find-root instead of vc-got-root, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 6eda2f1 035/145: vc-got-log-incoming, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 986bd9a 038/145: fix diff on multiple files, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 0e25fbe 039/145: expand the vc function status list, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got e79563b 044/145: make got program customizable, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 45b0e76 023/145: typo in vc-got-pull, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 5dec261 033/145: kill got stage/unstage buffer after utilisation and introduce unstage-all, ELPA Syncer, 2021/09/09