Function: projectile--hg-default-path

projectile--hg-default-path is a byte-compiled function defined in projectile.el.

Signature

(projectile--hg-default-path ROOT)

Documentation

Return the Mercurial default path configured for ROOT, or nil.

That's the upstream a repository was cloned from, so it plays the same role as git's origin remote. Read out of .hg/hgrc directly rather than by running hg, which would cost a process launch per project.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--hg-default-path (root)
  "Return the Mercurial `default' path configured for ROOT, or nil.
That's the upstream a repository was cloned from, so it plays the same
role as git\\='s `origin' remote.  Read out of `.hg/hgrc' directly rather
than by running hg, which would cost a process launch per project."
  (let ((hgrc (expand-file-name ".hg/hgrc" root)))
    (when (file-readable-p hgrc)
      (with-temp-buffer
        (insert-file-contents hgrc)
        (goto-char (point-min))
        (when (re-search-forward "^[ \t]*default[ \t]*=[ \t]*\\(.+?\\)[ \t]*$" nil t)
          (match-string 1))))))