-
-
Notifications
You must be signed in to change notification settings - Fork 28
Utilities
Jonas Bernoulli edited this page Jun 20, 2018
·
2 revisions
Offer to update outdated upstream urls of all drones. See https://github.com/emacscollective/borg/issues/73.
(defun borg-sync-drone-urls ()
"Offer to update outdated upstream urls of all drones."
(interactive)
(let (moved)
(dolist (drone (borg-clones))
(let ((a (borg-get drone "url"))
(b (ignore-errors (oref (epkg drone) url))))
(when (and b (not (magit--forge-url-equal a b)))
(push (list drone a b) moved))))
(when (and moved
(yes-or-no-p
(concat (mapconcat (pcase-lambda (`(,drone ,a ,b))
(format "%s: %s => %s" drone a b))
moved "\n")
"\n\nThese upstream repositories appear to have moved."
"\s\sUpdate local configuration accordingly? ")))
(let ((default-directory borg-user-emacs-directory))
(pcase-dolist (`(,drone ,_ ,b) moved)
(process-file "git" nil nil nil "config" "-f" ".gitmodules"
(format "submodule.%s.url" drone) b))
(process-file "git" nil nil nil "submodule" "sync")))))