Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull request: Fix for "Cloning HG repo to Git creates "uncheck-out-able" repositories". And upgrade for filenames transcoding #79

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

IngeniousOne
Copy link

Hi, everybody!

I have two suggestion for you.

  • First: A bug-fix for a problem on Windows systems:

     Cloning HG repo to Git creates "uncheck-out-able" repositories 
    

because
guilty function
crushes paths (e.g. /bin/foo-file.py => \bin\foo-file.py), making them unknown for Git repo (git uses "/ " for storing file paths instead of "\") on check-out. In reply to "checkout" command it generates error message:
Checkout error
first commit fixes that.

  • Second:
    A solution for cases when HG repository contains files with names in non Utf-8 encoding and containing culture-related symbols (e.g. cp1251 "Тестовый файл.txt").
    In this cases, cloning a HG repository to git with git-remote-hg, produces unreadable filenames in git
    Unreadable names
    Solution bidirectionally solves this problem by transcoding filenames on-the-fly. All you need is to add to .git/config or to a global one options:
    • "remote-hg.transcode-filenames" - boolean key option to enable|disable transcoding functional;
      • remote-hg.hg_filenames_enc - required string - HG repo filenames encoding;
      • remote-hg.git_filenames_enc - optional string(default: utf-8) - Git repo filenames encoding.

…mes encodings between repositories. Bidirectional.

    Added git.config options:
    - "remote-hg.transcode-filenames" - boolean key option to enable|disable transcoding functional;
        - remote-hg.hg_filenames_enc - required string - HG repo filenames encoding;
        - git_filenames_enc          - optional string(default: utf-8) - Git repo filenames encoding.
@IngeniousOne IngeniousOne changed the title Pull request Pull request: Fix for "Cloning HG repo to Git creates "uncheck-out-able" repositories" and filenames transcoding Jul 30, 2019
@IngeniousOne IngeniousOne changed the title Pull request: Fix for "Cloning HG repo to Git creates "uncheck-out-able" repositories" and filenames transcoding Pull request: Fix for "Cloning HG repo to Git creates "uncheck-out-able" repositories". and filenames transcoding Jul 30, 2019
@IngeniousOne IngeniousOne changed the title Pull request: Fix for "Cloning HG repo to Git creates "uncheck-out-able" repositories". and filenames transcoding Pull request: Fix for "Cloning HG repo to Git creates "uncheck-out-able" repositories". And upgrade for filenames transcoding Jul 30, 2019
@benbrummer
Copy link

Can you add this PR to the mnauw fork, too. Almost all Distributions (Ubuntu, Fedora, Arch Linux...) are useing this. In fact this error is already fixed there, but your solution is in my optinion the better one.

@IngeniousOne
Copy link
Author

IngeniousOne commented Nov 19, 2019 via email

@felipec
Copy link
Owner

felipec commented Jan 17, 2020

Wouldn't it be better to have a per-repository configuration that specifies the encoding of the Mercurial repository? You wouldn't want to transcode as cp1251 all repositories.

Also, in Git all repositories are assumed to be utf-8, so there's no need to specify that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants