diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bd0040e..f8753db 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,18 +7,17 @@ jobs: strategy: matrix: hg: [ '5.5', '5.6', '5.7', '5.8', '5.9', '6.0', '6.1', '6.2', '6.3' ] - env: - HG_VERSION: ${{ matrix.hg }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: python-version: '3.10' - check-latest: true - - name: Cache check-versions script - id: cache-check-versions - uses: actions/cache@v3 + - uses: actions/cache@v3 + id: cache-pip with: - path: ~/.cache/git-remote-hg - key: check-versions - - run: ./tools/check-versions $HG_VERSION + path: ~/.cache/pip + key: pip + - name: Install hg + run: + pip install mercurial==${{ matrix.hg }} + - run: make test diff --git a/git-remote-hg b/git-remote-hg index e27aede..1e738cd 100755 --- a/git-remote-hg +++ b/git-remote-hg @@ -411,16 +411,13 @@ class Parser: return (user, int(date), hgtz(tz)) def fix_file_path(path): - def posix_path(path): - if os.sep == '/': - return path - # even Git for Windows expects forward - return path.replace(compat.to_b(os.sep), b'/') - # also converts forward slash to backwards slash on Win path = os.path.normpath(path) - if not os.path.isabs(path): - return posix_path(path) - return posix_path(os.path.relpath(path, b'/')) + if os.path.isabs(path): + path = os.path.relpath(path, b'/') + if os.sep == '/': + return path + # even Git for Windows expects forward + return path.replace(compat.to_b(os.sep), b'/') def export_files(files): final = [] @@ -1757,8 +1754,7 @@ def fix_path(alias, repo, orig_url): url = compat.urlparse(orig_url, b'file') if url.scheme != b'file' or os.path.isabs(os.path.expanduser(url.path)): return - abs_url = compat.urljoin(b"%s/" % compat.getcwd(), orig_url) - cmd = ['git', 'config', b'remote.%s.url' % alias, b"hg::%s" % abs_url] + cmd = ['git', 'config', b'remote.%s.url' % alias, b"hg::%s" % os.path.abspath(orig_url)] subprocess.call(cmd) def select_private_refs(alias):