How to use hg convert properly

1.6k Views Asked by At

at one point I committed large files to my hg repository, I later did a hg forget on these files, but now my repository is quite big and on every new clone it takes ages as these files are still being pulled down as part of the history.

I am using this SO post to try and convert my repository into a repository that doesn't know of the large files. I am doing the following

assume my repository has the following structure:

~/workspace/
    project/
        data/
            large_file.txt
        src/
            ...

I am doing the following

cd workspace/project
echo data/large_file.txt >> /tmp/myfilemap
hg convert --filemap ~/workspace/project ~/workspace/new_repo

However the new_repo just appears to be empty.

Am I doing something wrong?

1

There are 1 best solutions below

4
Nanhydrin On

The convert action operates within the working directory so you probably don't want to start the operation from in there.

The command format is as follows:

hg convert --filemap filemap_path SourceRepoPath TargetRepoPath

You can use relative paths, but put the filemap outside the repos.

Your filemap contents should be formatted like so:

exclude "data/large_file.txt"