Closed kakaiba-talaga closed 4 years ago
After some thought, I decided that may be running it in Windows is the issue. So, I tried it in Ubuntu via Window Subsystem for Linux (WSL). Now, I can see statuses that the import is actually being done until it isn't...
$> python3 ./hg-export-tool/exporter.py map-file.json -A authors.map --hg-hash
Initialized empty Git repository in /tmp/majic-web-hg-git-434315ec61588cbfb59cab1f10886b13/.git/
2560 files updated, 0 files merged, 875 files removed, 0 files unresolved
marked working directory as branch AsyncSchedulingModule-1
saved backup bundle to /tmp/app-here-f09db68cbe0ffffe427263dbb4d97d2b/.hg/strip-backup/701bf349be4e-4fb7c600-amend.hg
Laoded 35 authors
...
Issued 16240 commands
error: cannot lock ref 'refs/heads/Deliveries/Scheduling_(Chris)': 'refs/heads/Deliveries' exists; cannot create 'refs/heads/Deliveries/Scheduling_(Chris)'
/usr/lib/git-core/git-fast-import statistics:
---------------------------------------------------------------------
Alloc'd objects: 140000
Total objects: 138473 ( 208619 duplicates )
blobs : 47930 ( 187077 duplicates 27258 deltas of 47846 attempts)
trees : 74361 ( 21542 duplicates 64896 deltas of 73363 attempts)
commits: 16182 ( 0 duplicates 0 deltas of 0 attempts)
tags : 0 ( 0 duplicates 0 deltas of 0 attempts)
Total branches: 225 ( 510 loads )
marks: 1048576 ( 8091 unique )
atoms: 16504
Memory total: 9735 KiB
pools: 3173 KiB
objects: 6562 KiB
---------------------------------------------------------------------
pack_report: getpagesize() = 4096
pack_report: core.packedGitWindowSize = 1073741824
pack_report: core.packedGitLimit = 35184372088832
pack_report: pack_used_ctr = 25131
pack_report: pack_mmap_calls = 6736
pack_report: pack_open_windows = 2 / 2
pack_report: pack_mapped = 646542674 / 646542674
---------------------------------------------------------------------
Traceback (most recent call last):
File "./hg-export-tool/exporter.py", line 255, in <module>
main()
File "./hg-export-tool/exporter.py", line 251, in main
BASH
File "./hg-export-tool/exporter.py", line 176, in process_repo
convert(hg_repo_copy, temp_git_repo, fast_export_args, bash)
File "./hg-export-tool/exporter.py", line 148, in convert
cwd=git_repo,
File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/bin/bash', 'hg-fast-export.sh', '-r', '/tmp/app-here-f09db68cbe0ffffe427263dbb4d97d2b', '-A', '/home/kakaiba/scratch/authors.map', '--hg-hash']' returned non-zero exit status 1.
The error:
error: cannot lock ref 'refs/heads/Deliveries/Scheduling(Chris)': 'refs/heads/Deliveries' exists; cannot create 'refs/heads/Deliveries/Scheduling(Chris)'
is about 2 closed branches.
@chrisjbillington Is there an option that I can map the Deliveries/Scheduling_(Chris)
branch to some other name to prevent this error?
I tried using the -B branches.map
but it didn't work.
branches.map
"Deliveries/Scheduling_(Chris)"="xDeliveries/Scheduling_(Chris)"
I suspect the error you're getting on Windows is due to the filepaths being too long - longer than 256 characters. I'm not sure what do do instead of shutil.copytree() that can deal with that, but I'll look into it. My tool does create temporary directories with 32 characters of extra random hex in their names which exacerbates the problem, though.
Branches with slashes in them with the bit before the slash being an existing branch name are invald in git, and yes, you can use a branch mapping file to rename the branches. See the documentation of hg-fast-export for this. This tool will just pass extra command line arguments on to hg-fast-export, so it should work fine!
Manually specifying the mappings for all the incompatible branches and tags is the way to go. Just don't forget to include the -n
flag. Otherwise, the "auto sanitize" feature will kick in and will override/ignore any mappings for branches and tags.
python3 ./exporter.py map-file.json -A authors.map -B branches.map -T tags.map -n
Thank you, @chrisjbillington, for this wrapper for hg-fast-export
.
Ran this in Windows 10 Pro
1909
, under Git Bash2.25.1.windows.1
, and Python3.7.5
using the latest version (Commit: 136ee344c20fd2c77f4aa0c90c4ac1a6c11c6a6a [136ee34], Date: Wednesday, 1 April 2020 14:21:27).$ python /d/Repositories/Others/hg-export-tool/exporter.py --bash="/c/Program Files/Development/Git/git-bash.exe" map-f ile.json -A authors.map --hg-hash
I ran this against a big mercurial repo with and without the
--hg-hash
flag. It seems doing its thing then these errors occurred:Note: The directory names have been sanitized.
The files that it says that are missing is not missing.