Patchwork D10448: bookmark: use `list_paths` to access path definition

login
register
mail settings
Submitter phabricator
Date April 16, 2021, 12:55 a.m.
Message ID <differential-rev-PHID-DREV-qiwo52e33vmmcullbkrq-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48765/
State Superseded
Headers show

Comments

phabricator - April 16, 2021, 12:55 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The content of the `[paths]` config section is receiving transformation that
  make it hard to recognise whats the actual name, and the next changeset will
  make it worse. So we use the official API for this instead.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/bookmarks.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -601,11 +601,12 @@ 
     # if an @pathalias already exists, we overwrite (update) it
     if path.startswith(b"file:"):
         path = urlutil.url(path).path
-    for p, u in ui.configitems(b"paths"):
-        if u.startswith(b"file:"):
-            u = urlutil.url(u).path
-        if path == u:
-            return b'%s@%s' % (b, p)
+    for name, p in urlutil.list_paths(ui):
+        loc = p.rawloc
+        if loc.startswith(b"file:"):
+            loc = urlutil.url(loc).path
+        if path == loc:
+            return b'%s@%s' % (b, name)
 
     # assign a unique "@number" suffix newly
     for x in range(1, 100):