Mercurial > hg
comparison mercurial/bookmarks.py @ 46907:ffd3e823a7e5
urlutil: extract `url` related code from `util` into the new module
The new module is well fitting for this new code. And this will be useful to
make the gathered code collaborate more later.
Differential Revision: https://phab.mercurial-scm.org/D10374
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 12 Apr 2021 03:01:04 +0200 |
parents | 6266d19556ad |
children | d55b71393907 |
comparison
equal
deleted
inserted
replaced
46906:33524c46a092 | 46907:ffd3e823a7e5 |
---|---|
24 obsutil, | 24 obsutil, |
25 pycompat, | 25 pycompat, |
26 scmutil, | 26 scmutil, |
27 txnutil, | 27 txnutil, |
28 util, | 28 util, |
29 ) | |
30 from .utils import ( | |
31 urlutil, | |
29 ) | 32 ) |
30 | 33 |
31 # label constants | 34 # label constants |
32 # until 3.5, bookmarks.current was the advertised name, not | 35 # until 3.5, bookmarks.current was the advertised name, not |
33 # bookmarks.active, so we must use both to avoid breaking old | 36 # bookmarks.active, so we must use both to avoid breaking old |
595 if b == b'@': | 598 if b == b'@': |
596 b = b'' | 599 b = b'' |
597 # try to use an @pathalias suffix | 600 # try to use an @pathalias suffix |
598 # if an @pathalias already exists, we overwrite (update) it | 601 # if an @pathalias already exists, we overwrite (update) it |
599 if path.startswith(b"file:"): | 602 if path.startswith(b"file:"): |
600 path = util.url(path).path | 603 path = urlutil.url(path).path |
601 for p, u in ui.configitems(b"paths"): | 604 for p, u in ui.configitems(b"paths"): |
602 if u.startswith(b"file:"): | 605 if u.startswith(b"file:"): |
603 u = util.url(u).path | 606 u = urlutil.url(u).path |
604 if path == u: | 607 if path == u: |
605 return b'%s@%s' % (b, p) | 608 return b'%s@%s' % (b, p) |
606 | 609 |
607 # assign a unique "@number" suffix newly | 610 # assign a unique "@number" suffix newly |
608 for x in range(1, 100): | 611 for x in range(1, 100): |