I have a project having mercurial HG code source management,and try to migrate it on a VSTS/Git platform.
I read that there is a tool for doing that, "fast-export"... So I tried but not did't achieve to do it working in Windows...
Say I have D:\MyProject
containing the .hg
directory and the project code files, I
fast-export
files in the "D:\fast-export-master" folder, D:\MyProject-git
D:\MyProject-git
the git init
command (a new .git
directory appeared then);D:\MyProject-git
i did..\fast-export-master\hg-fast-export.sh -r "D:\MyProject"
now strange things starts happening, a command line window appeared and disappeared so quickly I didn't understood what happened, so I relaunched the previous command in a hope to see the message... I should try tens of times until able to capture in the printscreen the command-line message, that says strange things:
which: no D:\fast-export-master\hg-fast-export.sh in (/c/Users/xxx/bin:mingw64/bin:/user/local/bin:/usr/bin:/bin/mingw64/bin:/usr/bin:/c/Users/xxx/bin:/c/ProgramData/Oracle/Java/javapath:/c/WINDOWS/system32 [...etc...etc...])
I wonder what is the problem and how to solve it...
EDIT:
Following the @max630 suggestion bellow, I reinstalled Python and update the PATH, so it's recognized in the command
> python
Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
opened the "GIT Bash" from the start menu then
cd "/D/MyProject-git"
../fast-export-master/hg-fast-export.sh -r "D:\MyProject" --force
that gave:
../fast-export-master/hg-fast-export.sh: line 175: python: command not found
C:\Program Files\Git\mingw64\libexec\git-core\git-fast-import.exe statistics:
---------------------------------------------------------------------
Objects allocated: 5000
...
On the other hand, hg-fast-export is a bash script, which requires a bash. The readme says On windows the bash that comes with "Git for Windows" is known to work well. Well, I don’t use Git for Windows, so that didn’t sound very appealing either.
Using hg-fast-export is quite simple for a mercurial repository : mkdir repo-git # or whatever cd repo-git git init hg-fast-export.sh -r <local-repo> git checkout HEAD Please note that hg-fast-export does not automatically check out the newly imported repository. You probably want to follow up the import with a git checkout -command.
All your branches and tags should be on your new Git server in a nice, clean import. Since Mercurial and Git have fairly similar models for representing versions, and since Git is a bit more flexible, converting a repository from Mercurial to Git is fairly straightforward, using a tool called "hg-fast-export", which you’ll need a copy of:
On Windows, you will need to install Git for Windows in order to have git bash, which is needed by hg-fast-export. To install mercurial, run: pip install mercurial, or use your system's package manager to install the mercurial libraries for the version of Python you are using. To get this script, clone or download this repository.
I think your concern is that you imported the "hg-fast-export" into a directory that was not added to your environment variables, according to the error message "D:\fast-export-master\hg-fast-export.sh" was not found in the list of your environment variables, so try to add th following "D:\fast-export-master\"in your environment variables and then try again.
If it does not work out yet, look at this article and follow step by step what was said:
https://www.appveyor.com/blog/2014/02/23/converting-mercurial-repository-to-git-on-windows/
The author has copied the directory "hg-fast-export" into the new directory git (without the .git of "hg-fast-export") and has also added hg, git and python to his environment variables.
good luck
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With