mirror of
https://github.com/dimitri/el-get.git
synced 2024-09-29 13:08:51 +08:00
Add checksum methods for git and hg.
These return the hash of the current revision of the package
This commit is contained in:
parent
dc22e60e6e
commit
0e908c8100
|
@ -89,8 +89,19 @@ found."
|
|||
:error "Could not update git submodules"))
|
||||
post-update-fun)))
|
||||
|
||||
(defun el-get-git-compute-checksum (package)
|
||||
"Return the hash of the checked-out revision of PACKAGE."
|
||||
(with-temp-buffer
|
||||
(cd (el-get-package-directory package))
|
||||
(let* ((args '("git" "show-ref" "HEAD"))
|
||||
(cmd (mapconcat 'shell-quote-argument args " "))
|
||||
(output (shell-command-to-string cmd))
|
||||
(hash (and (string-match "^[[:space:]]*\\([^[:space:]]+\\)" output)
|
||||
(match-string 0 output))))
|
||||
hash)))
|
||||
|
||||
(el-get-register-method
|
||||
:git #'el-get-git-clone #'el-get-git-pull #'el-get-rmdir
|
||||
#'el-get-git-clone-hook)
|
||||
#'el-get-git-clone-hook nil #'el-get-git-compute-checksum)
|
||||
|
||||
(provide 'el-get-git)
|
||||
|
|
|
@ -58,8 +58,19 @@
|
|||
:error ,ko))
|
||||
post-update-fun)))
|
||||
|
||||
(defun el-get-hg-compute-checksum (package)
|
||||
"Return the hash of the checked-out revision of PACKAGE."
|
||||
(with-temp-buffer
|
||||
(cd (el-get-package-directory package))
|
||||
(let* ((args '("hg" "--debug" "tags"))
|
||||
(cmd (mapconcat 'shell-quote-argument args " "))
|
||||
(output (shell-command-to-string cmd))
|
||||
(hash (and (string-match "^tip[[:space:]]+[0-9]+\\:\\([0-9A-Fa-f]+\\)" output)
|
||||
(match-string 0 output))))
|
||||
hash)))
|
||||
|
||||
(el-get-register-method
|
||||
:hg #'el-get-hg-clone #'el-get-hg-pull #'el-get-rmdir
|
||||
#'el-get-hg-clone-hook)
|
||||
#'el-get-hg-clone-hook nil #'el-get-hg-compute-checksum)
|
||||
|
||||
(provide 'el-get-hg)
|
||||
|
|
Loading…
Reference in New Issue
Block a user