My linux world » Mercurial Survival Guide

Mercurial Survival Guide


Contents

Split repository in sub repositories

myrepository has the following repositories:

  1. create filemap.txt:
        include mysubdir1
        rename mysubdir1 .
    
  2. run the following command:
    hg convert --filemap /tmp/myfilemap myrepository myrepository-dest
  3. look at myrepository-dest. It has the content of mysubdir1.

Merge repositories

If you want to merge myrepository1 with myrepository2 :

echo clone myrepository2 to myworkingcopy
hg clone myrepository1 myworkingcopy
echo change directory to myworkingcopy
cd myworkingcopy
echo pull myrepository2 (with force option)
hg pull -f myrepository2
echo merge both repositories
hg merge
echo finally, commit
hg commit

Get guid latest revision

hg identify -i http://srv-scm/hg/MYREPOSITORY

Clone without login/password prompt

hg clone http://mylogin:mypasswd@srv-scm/myrepos

Subversion to mercurial

  1. clone hgsubversion
      hg clone http://bitbucket.org/durin42/hgsubversion/ ~/hgsubversion
  2. install requires (the extension requires the Python Subversion bindings)
      yum install python-subvertpy
  3. Enable extension in mercurial
    Configure your hgrc to enable the extension by adding the following lines: (vi ~/.hgrc)

    [extensions]
    hgsubversion = ~/hgsubversion/hgsubversion
    

    And install it:

    cd ~/hgsubversion
    chmod +x setup.py
    ./setup.py install
  4. Test
    hg --config clone http://python-nose.googlecode.com/svn nose-hg

Remove working copy files

This will remove all your working copy files, and only keep the .hg folder (at the root place)

hg update null

Copyright © 2023 My linux world - by Marc RABAHI
Design by Marc RABAHI and encelades.

Fork me on GitHub