added Mercurial support

This commit is contained in:
Bozhidar Batsov 2012-04-11 14:56:29 +03:00
parent b58fd0020b
commit 26a2f6318e

View file

@ -258,6 +258,33 @@ seconds; the server cuts off after 10 requests in 20 seconds.")
(pb/find-parse-time
"\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\)"))))
(defun pb/hg-repo (dir)
"Get the current hg repo for DIR."
(with-temp-buffer
(pb/run-process dir "hg" "paths")
(goto-char (point-min))
(re-search-forward "default = \\(.*\\)")
(match-string-no-properties 1)))
(defun pb/checkout-hg (name config dir)
"Check package NAME with config CONFIG out of hg into DIR."
(let ((repo (plist-get config :url)))
(with-current-buffer (get-buffer-create "*package-build-checkout*")
(goto-char (point-max))
(cond
((and (file-exists-p (expand-file-name ".hg" dir))
(string-equal (pb/hg-repo dir) repo))
(print "checkout directory exists, updating...")
(pb/run-process dir "hg" "pull")
(pb/run-process dir "hg" "update"))
(t
(when (file-exists-p dir)
(delete-directory dir t nil))
(print "cloning repository")
(pb/run-process nil "hg" "clone" repo dir)))
(pb/run-process dir "hg" "tip" "--style" "compact")
(pb/find-parse-time
"\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}\\)"))))
(defun pb/dump (data file)
"Write DATA to FILE as a pretty-printed Lisp sexp."
@ -307,6 +334,7 @@ The file is written to `package-build-working-dir'."
"--exclude=.git*"
"--exclude=_darcs"
"--exclude=.bzr"
"--exclude=.hg"
(or (mapcar (lambda (fn) (concat dir "/" fn)) files)
(list dir)))))