ecumber

Git Conversion

Jul 24th, 2020
113
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CONVERTING THE CVS REPOS TO GIT
  2. You will need:
  3. - Linux VM/WSL (Ubuntu 18.04 Recommended)
  4. - git
  5. - cvs2git (Ubuntu package: cvs2svn - use 18.04; 20.04 removed this!)
  6.  
  7. 1. Find the directory you want to convert to git. This will be the folder with a CVSROOT subfolder inside.
  8.  
  9. For example:
  10.  
  11. ├───folder
  12. │ ├───CVSROOT
  13. │ │ └───stuff
  14. │ │
  15. │ ├───file1
  16. │ └───folder
  17. │ └───file2
  18.  
  19. The directory "folder" will be the one you want to convert.
  20.  
  21. 2. Navigate to the directory in WSL/Linux that the folder is in, but don't go inside the folder itself.
  22.  
  23. 3. Convert the repositories using cvs2git. Replace path/to/directory/ with the folder you want to convert:
  24.  
  25. cvs2git --blobfile=blob.dat --dumpfile=dump.dat --username=cvs2git path/to/directory/
  26.  
  27. The command may take a long itme, and the generated files will take up a lot of space, so run this on an HDD with enough space.
  28.  
  29. If it encounters errors about unable to convert log files, try this command, once again replacing path/to/directory/ with the folder you want to convert:
  30.  
  31. cvs2git --encoding=euc_jp --encoding=euc_jis_2004 --encoding=euc_jisx0213 --encoding=iso2022_jp --encoding=iso2022_jp_1 --encoding=iso2022_jp_2 --encoding=iso2022_jp_2004 --encoding=iso2022_jp_3 --encoding=iso2022_jp_ext --encoding=shift_jis --encoding=shift_jis_2004 --encoding=shift_jisx0213 --encoding=utf_16 --encoding=utf_16_be --encoding=utf_16_le --encoding=utf_7 --encoding=utf_8 --blobfile=blob.dat --dumpfile=dump.dat --username=cvs2git path/to/directory/
  32.  
  33. The error about converting the logs is due to the repositories using Japanese characters, so the command above will keep trying different character formats to convert it to until one works.
  34.  
  35. 4. Convert the dump files to git repositories:
  36.  
  37. mkdir repository-git
  38. cd repository-git
  39. git init
  40. cat ../blob.dat ../dump.dat | git fast-import
  41. git reset --hard
  42.  
  43. The folder name can be anything you want, but I prefer using the original foldername with a -git suffix to make it easy to identify.
  44.  
  45. Once that command completes, the directory will be decoded and converted into a working git repository. It will work as any old git repository, so you can even commit to it or revert back to an old version.
  46.  
  47. The "blob.dat" and "dump.dat" files can be deleted once everything is done.
RAW Paste Data