[Updated] D10403: urlutil: add a new `get_unique_pull_path`

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Thu Apr 15 13:46:25 UTC 2021


Closed by commit rHG1998a8311c48: urlutil: add a new `get_unique_pull_path` (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D10403?vs=26859&id=26938

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D10403/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D10403

AFFECTED FILES
  mercurial/utils/urlutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/urlutil.py b/mercurial/utils/urlutil.py
--- a/mercurial/utils/urlutil.py
+++ b/mercurial/utils/urlutil.py
@@ -471,6 +471,22 @@
         yield parseurl(url, default_branches)
 
 
+def get_unique_pull_path(action, repo, ui, source=None, default_branches=()):
+    """return a unique `(path, branch)` or abort if multiple are found
+
+    This is useful for command and action that does not support multiple
+    destination (yet).
+
+    Note that for now, we cannot get multiple destination so this function is "trivial".
+
+    The `action` parameter will be used for the error message.
+    """
+    if source is None:
+        source = b'default'
+    url = ui.expandpath(source)
+    return parseurl(url, default_branches)
+
+
 def get_clone_path(ui, source, default_branches=()):
     """return the `(origsource, path, branch)` selected as clone source"""
     url = ui.expandpath(source)



To: marmoute, #hg-reviewers, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210415/41a77c4a/attachment-0002.html>


More information about the Mercurial-patches mailing list