Mercurial > hgrepos > DevTools > mercurial-extensions
comparison extensions/kwarchive.py @ 425:2a062f87f75d
Make "revinfo" and "kwarchive" work on Mercurial 6.
Some URL related utility function have been moved from within mercurial.util
to mercurial.utils.urlutil.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sat, 27 Aug 2022 21:36:16 +0200 |
| parents | bee0d9026720 |
| children | e036013a4003 |
comparison
equal
deleted
inserted
replaced
| 424:bee0d9026720 | 425:2a062f87f75d |
|---|---|
| 113 try: | 113 try: |
| 114 from mercurial.utils import dateutil as _dateutil | 114 from mercurial.utils import dateutil as _dateutil |
| 115 except ImportError: | 115 except ImportError: |
| 116 _dateutil = util | 116 _dateutil = util |
| 117 | 117 |
| 118 | 118 # some URL specific util functions moved to new mercurial.utils.urlutil |
| 119 testedwith = b"4.3.1 4.3.2 4.4.1 4.4.2 4.5.2 4.6.1 4.8.1 4.9 5.0.1 5.1.2 5.2.1 5.5 5.6 5.9.1" | 119 try: |
| 120 from mercurial.utils import urlutil as _urlutil | |
| 121 except ImportError: | |
| 122 _urlutil = util | |
| 123 | |
| 124 | |
| 125 testedwith = b"4.3.1 4.3.2 4.4.1 4.4.2 4.5.2 4.6.1 4.8.1 4.9 5.0.1 5.1.2 5.2.1 5.5 5.6 5.9.1 6.1.4" | |
| 120 | 126 |
| 121 SHORTENED_HG_SCHEMES = { | 127 SHORTENED_HG_SCHEMES = { |
| 122 b"ssh": b"hg+ssh", | 128 b"ssh": b"hg+ssh", |
| 123 b"http": b"hg+http", | 129 b"http": b"hg+http", |
| 124 b"https": b"hg+https", | 130 b"https": b"hg+https", |
| 707 hglocation = locations[0].loc | 713 hglocation = locations[0].loc |
| 708 else: | 714 else: |
| 709 hglocation = locations.loc | 715 hglocation = locations.loc |
| 710 try: | 716 try: |
| 711 if path_filter == b"full": | 717 if path_filter == b"full": |
| 712 path_uri = bytes(util.url(hglocation)) | 718 path_uri = bytes(_urlutil.url(hglocation)) |
| 713 elif path_filter == b"nopwd": | 719 elif path_filter == b"nopwd": |
| 714 path_uri = util.hidepassword(hglocation) | 720 path_uri = _urlutil.hidepassword(hglocation) |
| 715 elif path_filter == b"nouser": | 721 elif path_filter == b"nouser": |
| 716 path_url = util.url(hglocation) | 722 path_url = _urlutil.url(hglocation) |
| 717 path_url.user = None | 723 path_url.user = None |
| 718 path_url.passwd = None | 724 path_url.passwd = None |
| 719 path_uri = bytes(path_url) | 725 path_uri = bytes(path_url) |
| 720 elif path_filter == b"short": | 726 elif path_filter == b"short": |
| 721 path_url = util.url(hglocation) | 727 path_url = _urlutil.url(hglocation) |
| 722 path_url.scheme = SHORTENED_HG_SCHEMES.get(path_url.scheme, | 728 path_url.scheme = SHORTENED_HG_SCHEMES.get(path_url.scheme, |
| 723 b"hg") | 729 b"hg") |
| 724 path_url.user = None | 730 path_url.user = None |
| 725 path_url.passwd = None | 731 path_url.passwd = None |
| 726 path_url.host = stripped_hostname(path_url.host) | 732 path_url.host = stripped_hostname(path_url.host) |
| 727 path_url.port = None | 733 path_url.port = None |
| 728 path_uri = bytes(path_url) | 734 path_uri = bytes(path_url) |
| 729 elif path_filter == b"last": | 735 elif path_filter == b"last": |
| 730 path_url = str(util.url(hglocation)).split('/') | 736 path_url = str(_urlutil.url(hglocation)).split('/') |
| 731 path_uri = pycompat.sysbytes(".../"+path_url[-1]) | 737 path_uri = pycompat.sysbytes(".../"+path_url[-1]) |
| 732 else: | 738 else: |
| 733 raise error.Abort(b"path-filter `%s' not implemented" | 739 raise error.Abort(b"path-filter `%s' not implemented" |
| 734 % path_filter) | 740 % path_filter) |
| 735 except LookupError: | 741 except LookupError: |
