Showing posts with label SCM. Show all posts
Showing posts with label SCM. Show all posts

Monday, December 22, 2008

Convert Subversion Repositories to Mercurial

Finally found some time to migrate some projects from SVN to Hg. The enterprise SVN became so cumbersome and slow as people keep throwing all junks into it, which you have no control of.
  • The 1st recipe was trying to convert directly using Hg in Working With Subversion Repositories
    hg convert --config convert.hg.tagsbranch=0 http://marshal.com/trunk/project1
    But there seemed a bug in Hg when the SVN requires HTTP authorization - even the user and password were correct it still could not pass through:

    initializing destination project1 repository
    http authorization required
    realm: crowd
    user: marshal
    password:
    real URL is http://marshal.com/trunk/project1/
    http authorization required
    realm: crowd
    user: marshal
    password:
    http authorization required
    realm: crowd
    user: marshal
    password:
    abort: HTTP Error 401: Authorization Required

  • Now veer to the Python tool for Hg, which requires Python 2.5+ (already included on Ubuntu 8.1+) & SVN.Do the following:
    # svn not installed by default
    sudo apt-get install subversion
    # easy_install not included in Python package by default
    sudo apt-get install python-setuptools
    # download & install hgsvn
    sudo easy_install hgsvn
    Best match: hgsvn 0.1.6
    Downloading http://pypi.python.org/packages/2.5/h/hgsvn/hgsvn-0.1.6-py2.5.egg#md5=8d15f42a8f4cb8516e219b7952bd9607
    Processing hgsvn-0.1.6-py2.5.egg
    Moving hgsvn-0.1.6-py2.5.egg to /usr/lib/python2.5/site-packages
    Adding hgsvn 0.1.6 to easy-install.pth file
    Installing hgimportsvn script to /usr/bin
    Installing hgpullsvn script to /usr/bin

    Installed /usr/lib/python2.5/site-packages/hgsvn-0.1.6-py2.5.egg
    Processing dependencies for hgsvn
    Finished processing dependencies for hgsvn

  • The real staff:
    hgimportsvn http://marshal.com/trunk/project1
    * svn 'info' '--xml' 'http://marshal.com/trunk/project1'
    Password for 'marshal':


    Then the program froze after you typed the password. (Well, it happened to me).
    So I have to manually run:
    svn info http://marshal.com/trunk/project1
    And key in the user name/password there, it passed.
  • Import SVN project again:
    hgimportsvn http://marshal.com/trunk/project1
    This will import SVN's project1 into current directory and no authorization required any more.
    cd project1
    hgpullsvn
    pulls all SVN history. Then the daily use of mercurial starts...

Tuesday, November 11, 2008

Use TortoiseHg 0.5 to clone a Mercurial 1.0.2 SSH repository

If you just downloaded TortoiseHg v0.5, and try to clone the remote SSH repository, you'll get error message: "The system cannot execute the specified program." Now try:
TortoiseHg> TortoisePlink.exe
The system cannot execute the specified program.
So you have to install Microsoft Visual C++ 2005 SP1 Redistributable Package (x86) according to TortoiseHg FAQ. But even you have done that, it seems that TortoisePlink does not support private key for SSH well.

Now I just fall back to Putty as this is much more direct and prime. Modify Mercurial.ini under TortoiseHg:
; In order to push/pull over ssh you must specify a ssh tool
;ssh = "C:\TortoiseHg\TortoisePlink.exe" -ssh -2
ssh = "C:\Putty0.6\Plink.exe" -ssh -2 -i "C:\key\ubuntu-1.ppk"
Then right click->TortoiseHG->Clone a Repository->Source Path, input something like
ssh://root@192.168.10.1//home/env/mercurial/open-source/openJDK
Then click "clone", it works without a hitch.

Note: As Putty uses user's relative path to home, //home/env/... is to tell it this is an absolute path /home/env/...

Ref:

Sunday, November 9, 2008

Install Mercurial 1.0.2 on Ubuntu 8.1 server using source code package

(Using root recommended)

If compiler and python not installed:
apt-get install build-essential python-dev
tar xvf mercurial-1.0.2.tar.gz
cd mercurial-1.0.2
make install
To verify,
hg debuginstall
Hopefully, you'll see

Checking encoding (UTF-8)...
Checking extensions...
Checking templates...
Checking patch...
Checking commit editor...
Checking username...
No username found, using 'root@hubuntus' instead
(specify a username in your .hgrc file)
No problems detected


And that's it.

Ref: http://www.selenic.com/mercurial/wiki/index.cgi/UnixInstall