Showing posts with label Mercurial. Show all posts
Showing posts with label Mercurial. Show all posts

Monday, March 16, 2020

Move Mercurial repository to Git on Bitbucket

As you probably know Bitbucket will discontinue Mercurial support – all Mercurial repositories will be removed at June 1, 2020. So if you have Mercurial repositories there it is good to take care about them in advance and move them to Git which becomes basic source control in Bitbucket. Articles which I found had lack of some important information so it still took time to go through them. So I decided to write separate post and summarize all steps which are needed for moving Mercurial repositories to Git on Windows 10 PC:

1. Install latest version of TortoiseHG (older versions may not have HgGit plugin which will be needed below)
2. Install Git for Windows 3. Rename repository and make hg clone from new address
4. In HR repository folder enable HgGit plugin by adding following section to .hg/.hgrc file:
[extensions]
hggit=
5. Go to "C:\Program Files\Git\usr\bin" and run ssh-keygen.exe
Use default settings - it will add 2 files to C:\Users\{username}\.ssh: id_rsa and id_rsa.pub
6. Copy content of id_rsa.pub file
7. Login to bitbucket.org > Profile page > Settings > Security > SSH Keys > Add key > Insert content of copied id_rsa.pub
8. Go to hg repositoy folder:
8.1. in .hg/.hgrc add following line under [ui]:
ssh = "ssh.exe"
8.2. ensure that path "C:\Program Files\Git\usr\bin" (which is path to ssh.exe) is added to PATH environment variable 8.3 run the following command:
hg push git+ssh://{username}@bitbucket.org/{username}/{repository}.git
(git repository url can be copied from bitbucket and then replace https by git+ssh)

After that your repository should be available on Git with all version history and branches you had in Mercurial.

Tuesday, May 10, 2016

How to set author displayed in Mercurial commits on Windows

Note for readers: in this article I will show how to configure author name on Windows PC for future Mercurial commits. It won’t contain information how to change author for commits which were already done.

If you work with different repositories sometime it may be necessary to change Author field displayed in commits history. On Windows PCs in order to do that go to C:\Users\{username} and edit mercurial.ini file:

[ui]
username = developer

In this example “developer” is the user name which will be displayed in Author field. If you will now open TortoiseHG Workbench tool new user name should be displayed in Author column.

Friday, April 1, 2016

Solve problem with Access denied error in TortoiseHG for Windows when try to commit change

If you recently cloned repository to the Windows PC, made some change and try to perform commit via TortoiseHG, you may get the following error:

Trouble committing file.
Access is denied
[Code: 255]

In order to solve it go to the Windows explorer and open properties of the repository folder. Then on Security tab click Edit and ensure that Users group has Full control rights:

After changes will be applied to all files and subfolders in the folder, error should disappear and commit should be successful.