Mercurial on Windows Using Cygwin
1) Download and Install Cygwin
Download cygwin setup file setup-x86.exe (or setup-x86_64.exe) from http://cygwin.com/install.html and run it. You should see a windows similar to the one below
follow the guideline in installation wizard until you reach the package selection window as shown below
Select the following packages:
a) openssh under Net (click on "Default" to change it to "Install")
b) vim under Editors and
c) mercurial under Devel.
Follow default options and finish install (this can take a while).
2) Create ssh folder and than create a separate folder to store class archive keys (useful when working with more then one repositories)
Open cygwin terminal (Programs - Cygwin - Cygwin Terminal) and type (refer figure below- key content with classes)
mkdir ~/.ssh
Command description: mkdir is command to create new directory. "~/' is path for home directory and "." before folder name is used to create hidden directory (to windows explorer)
Navigate to this newly created folder by typing
cd ~/.ssh
Command description: cd stands for "change drive" and used to navigate to a particular directory.
Create contentkeys folder inside newly created ssh folder
mkdir contentkeys
and navigate to this newly created folder by typing
cd contentkeys
Now, we need to copy the keys to this folder. First download the keys to C:\ and than execute the following command
mv /cygdrive/c/classes ~/.ssh/contentkeys
mv /cygdrive/c/classes.pub ~/.ssh/contentkeys
Command description: mv stands for "move" and used to move file from one location to other. Here we are moving the file from C:\classes (in cygwin windows c drive is accessed through /cygdrive/c/classes) to newly created classkeys folder.
You can check the content of this folder by typing command
ls
Command description: ls stands for "list" and used to display the content of a directory
this will display the newly moved class and class.pub keys
Now, we will change the permission of the class key file by executing the command
chmod 600 ~/.ssh/contentkeys/content
Now we will create the directory were we want to save the mercurial repository. I am first creating directory "CBA" and then directory "content" inside it.
mkdir /cygdrive/c/Users/Prashant\ Patil/CBA
mkdir /cygdrive/c/Users/Prashant\ Patil/CBA/content
Now, we will clone the repository from the CBA servier to our local directory by executing the command
hg clone -e "ssh -i ~/.ssh/contentkeys/content" ssh://hg@fab.cba.mit.edu:846/content /cygdrive/c/Users/Prashant\ Patil/CBA/content
Now, navigate to your arhive folder (in my case C/Users/Prashant\ Patil/CBA/content). You will find a .hg folder in it. Open hgrc file in notepad located inside .hg folder. Copy paste following (of-course edit it with your name and email). Don't remove which is already there in the file, just append this
[ui]
username = Prashant Patil
ssh = ssh -i ~/.ssh/contentkeys/content -C
[hooks]
changegroup = hg update >&2
username = Prashant Patil
ssh = ssh -i ~/.ssh/contentkeys/content -C
[hooks]
changegroup = hg update >&2
Save the file and close it.
Now, in terminal cd to archive directory
hg pull
hg update
hg addremove
hg commit -m "message"
hg push
If branches have diverged, you need to merge them
pull
updage
merge
addremove
commit
push
If there are multiple heads then you need to merge them to a single head
hg heads
hg merge headnumber
hg update -c
hg commit -m message
(repeat for every head you have created)
If two branches have incompatible changes and can not be merged then, save you updated file in location other then archive.
roll your archive back so that you can manually integrate your changes with those of whomever pushed their incompatible changes before you did!...
hg commit --close-branch -m message
hg update -c
hg pull
hg update
hg merge
hg add .
hg commit -m message
hg push
(repeat for however many extra heads you've created)
Mercurial in Windows using TortoiseHg
TortoiseHg is a version of the Mercurial application for Windows with GUI.
Step - 1: Download executable from here and Install it.
Step - 2: Create a folder where you want to keep all your files.
Step - 3: If you key is generated in openSSH then you need to first convert into putty (TortoiseHg) compatible key. For that you can use the software called Puttygen that can be downloaded from here
Step - 4: Now you need to specify ssh keys. For that we are going to you a software called "Pageant". Navigate to C:\Program Files\TortoiseHg and double click on Pageant.exe . It will start running and you can find it in system tray in task bar. Right click on system tray and click on "Add key" and add the converted ssh key.
Step - 5: Go to File -> Clone Repository. Enter Source "ssh://hg@fab.xxxx" and destination as one of the local directory in your computer.
Step - 6: Edit configuration file - Go to file File -> Settings and select repository setting tab and click on "Edit File" and append following
Mercurial in Windows using TortoiseHg
TortoiseHg is a version of the Mercurial application for Windows with GUI.
Step - 1: Download executable from here and Install it.
Step - 2: Create a folder where you want to keep all your files.
Step - 3: If you key is generated in openSSH then you need to first convert into putty (TortoiseHg) compatible key. For that you can use the software called Puttygen that can be downloaded from here
Step - 4: Now you need to specify ssh keys. For that we are going to you a software called "Pageant". Navigate to C:\Program Files\TortoiseHg and double click on Pageant.exe . It will start running and you can find it in system tray in task bar. Right click on system tray and click on "Add key" and add the converted ssh key.
Step - 5: Go to File -> Clone Repository. Enter Source "ssh://hg@fab.xxxx" and destination as one of the local directory in your computer.
Note - If you are asked for password then your ssh keys are not properly set.
Step - 6: Edit configuration file - Go to file File -> Settings and select
[ui]
username = Prashant Patil
[hooks]
changegroup = hg update >&2
No comments:
Post a Comment