[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/vc-fossil e0d3521 085/111: Enforced double-dash internal f
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/vc-fossil e0d3521 085/111: Enforced double-dash internal function convention. |
Date: |
Wed, 29 Sep 2021 08:59:26 -0400 (EDT) |
branch: elpa/vc-fossil
commit e0d3521e64abcc6c6b250ceafdae26763ae190e2
Author: pdo <pdo>
Commit: pdo <pdo>
Enforced double-dash internal function convention.
---
vc/el/vc-fossil.el | 138 ++++++++++++++++++++++++++++-------------------------
1 file changed, 74 insertions(+), 64 deletions(-)
diff --git a/vc/el/vc-fossil.el b/vc/el/vc-fossil.el
index 1f293be..83bf040 100644
--- a/vc/el/vc-fossil.el
+++ b/vc/el/vc-fossil.el
@@ -38,6 +38,7 @@
;; * workfile-version (file)
;; * checkout-model (file)
;; - workfile-unchanged-p (file)
+;; - root (file)
;; STATE-CHANGING FUNCTIONS
;; * register (file &optional rev comment)
;; * checkin (file comment &optional rev)
@@ -45,6 +46,7 @@
;; * checkout (file &optional editable rev)
;; * revert (file &optional contents-done)
;; * pull (prompt)
+;; - push (prompt)
;; - responsible-p (file)
;; HISTORY FUNCTIONS
;; * print-log (file &optional buffer)
@@ -107,22 +109,45 @@ If nil, use the value of `vc-diff-switches'. If t, use
no switches."
(unless (apply #'vc-fossil--out-ok args)
(throw 'bail nil))))))
-(defun vc-fossil-root (file)
- (or (vc-find-root file ".fslckout")
- (vc-find-root file "_FOSSIL_")))
-
-(defun vc-fossil-command (buffer okstatus file-or-list &rest flags)
+(defun vc-fossil--command (buffer okstatus file-or-list &rest flags)
"A wrapper around `vc-do-command' for use in vc-fossil.el.
The difference to vc-do-command is that this function always invokes
`fossil'."
(apply #'vc-do-command (or buffer "*vc*") okstatus "fossil" file-or-list
flags))
-(defun vc-fossil-get-id (dir)
+(defun vc-fossil--get-id (dir)
(let* ((default-directory dir)
(info (vc-fossil--run "info"))
(pos (string-match "checkout: *\\([0-9a-fA-F]+\\)" info))
(uid (match-string 1 info))
)
- (substring uid 0 9)))
+ (substring uid 0 10)))
+
+(defun vc-fossil--get-repository (dir)
+ (let* ((default-directory dir)
+ (info (vc-fossil--run "info")))
+ (string-match "repository: *\\(.*\\)$" info)
+ (match-string 1 info)))
+
+(defun vc-fossil--do-async-prompted-command (command &optional prompt hist-var)
+ "Run a fossil command asynchronously.
+Allow user to edit command in minibuffer if PROMPT is non-nil."
+ (let* ((root (vc-fossil-root default-directory))
+ (buffer (format "*vc-fossil : %s*" (expand-file-name root)))
+ (fossil-program "fossil")
+ (args '()))
+ (when prompt
+ (setq args (split-string
+ (read-shell-command "Run Fossil (like this): "
+ (concat fossil-program " " command)
+ (or hist-var 'vc-fossil-history))
+ " " t))
+ (setq fossil-program (car args)
+ command (cadr args)
+ args (cddr args)))
+ (apply 'vc-do-async-command buffer root fossil-program command args)
+ (with-current-buffer buffer
+ (vc-run-delayed (vc-compilation-mode 'Fossil)))
+ (vc-set-async-update buffer)))
;;; STATE-QUERYING FUNCTIONS
@@ -173,6 +198,10 @@ If nil, use the value of `vc-diff-switches'. If t, use no
switches."
(defun vc-fossil-workfile-unchanged-p (file)
(eq 'up-to-date (vc-fossil-state file)))
+(defun vc-fossil-root (file)
+ (or (vc-find-root file ".fslckout")
+ (vc-find-root file "_FOSSIL_")))
+
;; TODO: mode-line-string
;; TODO: dir-printer
@@ -180,7 +209,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no
switches."
"Get fossil status for all files in a directory"
(vc-fossil-dir-status-files-i dir nil update-function))
-(defun vc-fossil-dir-status-files-i (dir files update-function)
+(defun vc-fossil--dir-status-files (dir files update-function)
"Get fossil status for all specified files in a directory.
If `files` is nil return the status for all files."
(insert (apply 'vc-fossil--run "update" "-n" "-v" "current"
@@ -218,13 +247,13 @@ If `files` is nil return the status for all files."
(if (>= emacs-major-version 25)
(defun vc-fossil-dir-status-files (dir files update-function)
- (vc-fossil-dir-status-files-i dir files update-function))
+ (vc-fossil--dir-status-files dir files update-function))
(defun vc-fossil-dir-status-files (dir files default-state update-function)
- (vc-fossil-dir-status-files-i dir files update-function)))
+ (vc-fossil--dir-status-files dir files update-function)))
(defun vc-fossil-checkout-model (files) 'implicit)
-(defun vc-fossil-propertize-header-line (name value)
+(defun vc-fossil--propertize-header-line (name value)
(concat (propertize name 'face 'font-lock-type-face)
(propertize value 'face 'font-lock-variable-name-face)))
@@ -238,18 +267,18 @@ If `files` is nil return the status for all files."
(cond ((eql field :repository)
(string-match "repository: *\\(.*\\)$" info)
(let ((repo (match-string 1 info)))
- (push (vc-fossil-propertize-header-line "Repository : " repo)
lines)))
+ (push (vc-fossil--propertize-header-line "Repository : " repo)
lines)))
((eql field :remote-url)
(let ((remote-url (car (split-string (vc-fossil--run
"remote-url")))))
- (push (vc-fossil-propertize-header-line "Remote URL : "
remote-url) lines)))
+ (push (vc-fossil--propertize-header-line "Remote URL : "
remote-url) lines)))
((eql field :synchro)
(let* ((as-match (string-match "^autosync.+\\([[:digit:]]\\)$"
settings))
(autosync (if as-match (match-string 1 settings) "0"))
(dp-match (string-match "^dont-push.+\\([[:digit:]]\\)$"
settings))
(dontpush (if dp-match (match-string 1 settings) "0")))
- (push (vc-fossil-propertize-header-line "Synchro : "
- (concat "autosync="
autosync
- " dont-push="
dontpush))
+ (push (vc-fossil--propertize-header-line "Synchro : "
+ (concat "autosync="
autosync
+ " dont-push="
dontpush))
lines)))
((eql field :checkout)
(let* ((posco (string-match "checkout: *\\([0-9a-fA-F]+\\)
\\([-0-9: ]+ UTC\\)" info))
@@ -258,41 +287,41 @@ If `files` is nil return the status for all files."
(safe-date-to-time (match-string
2 info))))
(child-match (string-match "child: *\\(.*\\)$" info))
(leaf (if child-match "NON-LEAF" "leaf")))
- (push (vc-fossil-propertize-header-line "Checkout : "
- (concat coid " " cots
- (concat " ("
leaf ")")))
+ (push (vc-fossil--propertize-header-line "Checkout : "
+ (concat coid " " cots
+ (concat " ("
leaf ")")))
lines)))
((eql field :comment)
(string-match "comment: *\\(.*\\)$" info)
(let ((msg (match-string 1 info)))
- (push (vc-fossil-propertize-header-line "Comment : " msg)
lines)))
+ (push (vc-fossil--propertize-header-line "Comment : " msg)
lines)))
((eql field :tags)
(string-match "tags: *\\(.*\\)" info)
(let ((tags (match-string 1 info)))
- (push (vc-fossil-propertize-header-line "Tags : " tags)
lines)))))
+ (push (vc-fossil--propertize-header-line "Tags : " tags)
lines)))))
(apply #'concat (nreverse lines))))
;;; STATE-CHANGING FUNCTIONS
(defun vc-fossil-create-repo ()
"Create a new Fossil Repository."
- (vc-fossil-command nil 0 nil "new"))
+ (vc-fossil--command nil 0 nil "new"))
;; We ignore the comment. There's no comment on add.
(defun vc-fossil-register (files &optional rev comment)
"Register FILE into the fossil version-control system."
- (vc-fossil-command nil 0 files "add"))
+ (vc-fossil--command nil 0 files "add"))
(defun vc-fossil-responsible-p (file)
(vc-fossil-root file))
(defun vc-fossil-unregister (file)
- (vc-fossil-command nil 0 file "rm"))
+ (vc-fossil--command nil 0 file "rm"))
(declare-function log-edit-extract-headers "log-edit" (headers string))
-(defun vc-fossil-checkin-i (files comment &optional rev)
- (apply 'vc-fossil-command nil 0 files
+(defun vc-fossil--checkin (files comment &optional rev)
+ (apply 'vc-fossil--command nil 0 files
(nconc (list "commit" "-m")
(log-edit-extract-headers
`(("Author" . "--user-override")
@@ -302,19 +331,19 @@ If `files` is nil return the status for all files."
(if (>= emacs-major-version 25)
(defun vc-fossil-checkin (files comment &optional rev)
- (vc-fossil-checkin-i files comment rev))
+ (vc-fossil--checkin files comment rev))
(defun vc-fossil-checkin (files rev comment)
- (vc-fossil-checkin-i files comment rev)))
+ (vc-fossil--checkin files comment rev)))
(defun vc-fossil-find-revision (file rev buffer)
- (apply #'vc-fossil-command buffer 0 file
+ (apply #'vc-fossil--command buffer 0 file
"cat"
(nconc
(unless (zerop (length rev)) (list "-r" rev))
(vc-switches 'Fossil 'checkout))))
(defun vc-fossil-checkout (file &optional editable rev)
- (apply #'vc-fossil-command nil 0 file
+ (apply #'vc-fossil--command nil 0 file
"update"
(nconc
(cond
@@ -326,26 +355,7 @@ If `files` is nil return the status for all files."
(defun vc-fossil-revert (file &optional contents-done)
"Revert FILE to the version stored in the fossil repository."
(if contents-done t
- (vc-fossil-command nil 0 file "revert")))
-
-(defun vc-fossil-do-prompted-command (prompt command &optional hist-var)
- (let* ((root (vc-fossil-root default-directory))
- (buffer (format "*vc-fossil : %s*" (expand-file-name root)))
- (fossil-program "fossil")
- (args '()))
- (when prompt
- (setq args (split-string
- (read-shell-command "Run Fossil (like this): "
- (concat fossil-program " " command)
- (or hist-var 'vc-fossil-history))
- " " t))
- (setq fossil-program (car args)
- command (cadr args)
- args (cddr args)))
- (apply 'vc-do-async-command buffer root fossil-program command args)
- (with-current-buffer buffer
- (vc-run-delayed (vc-compilation-mode 'Fossil)))
- (vc-set-async-update buffer)))
+ (vc-fossil--command nil 0 file "revert")))
(defun vc-fossil-pull (prompt)
"Pull upstream changes into the current branch.
@@ -353,7 +363,7 @@ If `files` is nil return the status for all files."
With a prefix argument, or if PROMPT is non-nil, prompt for a specific
Fossil pull command. The default is \"fossil update\"."
(interactive "P")
- (vc-fossil-do-prompted-command prompt "update" 'vc-fossil-pull-history))
+ (vc-fossil--do-async-prompted-command "update" prompt
'vc-fossil-pull-history))
(defun vc-fossil-push (prompt)
"Push changes to upstream repository.
@@ -361,7 +371,7 @@ Fossil pull command. The default is \"fossil update\"."
With a prefix argument or if PROMPT is non-nil, prompt for a specific
Fossil push command. The default is \"fossil push\"."
(interactive "P")
- (vc-fossil-do-prompted-command prompt "push" 'vc-fossil-push-history))
+ (vc-fossil--do-async-prompted-command "push" prompt 'vc-fossil-push-history))
;; HISTORY FUNCTIONS
@@ -376,7 +386,7 @@ Fossil push command. The default is \"fossil push\"."
(let ((inhibit-read-only t))
(with-current-buffer buffer
(dolist (file files)
- (apply #'vc-fossil-command buffer 0 nil "timeline"
+ (apply #'vc-fossil--command buffer 0 nil "timeline"
(nconc
(when start-revision (list "before" start-revision))
(when limit (list "-n" (number-to-string limit)))
@@ -418,7 +428,7 @@ Fossil push command. The default is \"fossil push\"."
(and (null (cdr files))
(equal root (expand-file-name (car files)))))
(setq files nil))
- (apply #'vc-fossil-command
+ (apply #'vc-fossil--command
buf 0 files "diff" "-i"
(nconc
(cond
@@ -432,7 +442,7 @@ Fossil push command. The default is \"fossil push\"."
"Execute \"fossil annotate\" on FILE, inserting the contents in BUFFER.
If REV is specified, annotate that revision."
;;(assert (not rev) nil "Annotating a revision not supported")
- (vc-fossil-command buffer 0 file "annotate"))
+ (vc-fossil--command buffer 0 file "annotate"))
(defconst vc-fossil-annotate-re
"\\([[:word:]]+\\)\\s-+\\([-0-9]+\\)\\s-+[0-9]+: ")
@@ -459,16 +469,16 @@ If REV is specified, annotate that revision."
(defun vc-fossil-create-tag (file name branchp)
(let* ((dir (if (file-directory-p file) file (file-name-directory file)))
(default-directory dir))
- (apply #'vc-fossil-command nil 0 nil `(,@(if branchp
+ (apply #'vc-fossil--command nil 0 nil `(,@(if branchp
'("branch" "new")
'("tag" "add"))
- ,name ,(vc-fossil-get-id dir)))))
+ ,name ,(vc-fossil--get-id dir)))))
;; FIXME: we should update buffers if update is non-nill
(defun vc-fossil-retrieve-tag (dir name update)
(let ((default-directory dir))
- (vc-fossil-command nil 0 nil "checkout" name)))
+ (vc-fossil--command nil 0 nil "checkout" name)))
;;; MISCELLANEOUS
@@ -477,14 +487,14 @@ If REV is specified, annotate that revision."
(with-temp-buffer
(cond
(file
- (vc-fossil-command t 0 (file-truename file) "finfo" "-l" "-b")
+ (vc-fossil--command t 0 (file-truename file) "finfo" "-l" "-b")
(goto-char (point-min))
(and (re-search-forward (concat "^" (regexp-quote rev)) nil t)
(zerop (forward-line))
(looking-at "^\\([0-9a-zA-Z]+\\)")
(match-string 1)))
(t
- (vc-fossil-command t 0 nil "info" rev)
+ (vc-fossil--command t 0 nil "info" rev)
(goto-char (point-min))
(and (re-search-forward "parent: *\\([0-9a-fA-F]+\\)" nil t)
(match-string 1))))))
@@ -494,23 +504,23 @@ If REV is specified, annotate that revision."
(with-temp-buffer
(cond
(file
- (vc-fossil-command t 0 (file-truename file) "finfo" "-l" "-b")
+ (vc-fossil--command t 0 (file-truename file) "finfo" "-l" "-b")
(goto-char (point-min))
(and (re-search-forward (concat "^" (regexp-quote rev)) nil t)
(zerop (forward-line -1))
(looking-at "^\\([0-9a-zA-Z]+\\)")
(match-string 1)))
(t
- (vc-fossil-command t 0 nil "info" rev)
+ (vc-fossil--command t 0 nil "info" rev)
(goto-char (point-min))
(and (re-search-forward "child: *\\([0-9a-fA-F]+\\)" nil t)
(match-string 1))))))
(defun vc-fossil-delete-file (file)
- (vc-fossil-command nil 0 (file-truename file) "rm" "--hard"))
+ (vc-fossil--command nil 0 (file-truename file) "rm" "--hard"))
(defun vc-fossil-rename-file (old new)
- (vc-fossil-command nil 0 (list (file-truename old) (file-truename new)) "mv"
"--hard"))
+ (vc-fossil--command nil 0 (list (file-truename old) (file-truename new))
"mv" "--hard"))
(provide 'vc-fossil)
- [nongnu] elpa/vc-fossil 7f26034 087/111: Corrected vc-fossil-dir-status function., (continued)
- [nongnu] elpa/vc-fossil 7f26034 087/111: Corrected vc-fossil-dir-status function., ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 2747e6c 103/111: Move vc-fossil.el to top dir, ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 4d3e1cb 086/111: Update vc-dir header info after fossil commands., ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil ec551ba 056/111: Implement previous-revision command for whole repository., ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil a57356e 061/111: Refactor find-revision command., ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 866bd8d 059/111: Use relative file names in print-log command., ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil be45ea1 066/111: Declare some unknown function and variables., ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil ac82044 065/111: Do not raise errors in next-revision and previous-revision commands., ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 007187d 075/111: Merge changes from pdo for emacs 25 support, ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 67855dd 081/111: Fixed accidental breakage in last commit., ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil e0d3521 085/111: Enforced double-dash internal function convention.,
ELPA Syncer <=
- [nongnu] elpa/vc-fossil 1bef549 109/111: From Upstream: ams: Add (vc-fossil-link), ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 6beb2f2 092/111: Merge old trunk I hope, ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 4e95c73 094/111: Merged., ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 2fd4bf0 095/111: Improved vc-dir performance on large repositories., ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil aff450c 018/111: deal with some compiler warnings (assignments to line etc remain), ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 0921094 023/111: whitespace and fiddle with a instructions comment, ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil eeb48f4 024/111: fiddle with some if constructs so I can read this, ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 5e71178 029/111: ideomatic lisp, ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil adb17bc 034/111: Use file-truename in vc-fossil-state otherwise status is not returned if called from outside a fossil tree, ELPA Syncer, 2021/09/29
- [nongnu] elpa/vc-fossil 13a0a69 036/111: Untabify, ELPA Syncer, 2021/09/29