1st
FEB

Mercurial & hg view

Posted by admin under Linuxi:

Install on Ubuntu and Debian sudo apt-get install mercurial

hg view How?

You try the ‘hg view’ command and you will get an error:

sudo apt-get install mercurial
sudo apt-get install python-setuptools python-dev build-essential
sudo easy_install -U mercurial
wget http://www.selenic.com/mercurial/release/mercurial-1.0.tar.gz
tar zxvf mercurial-x.x.tar.gz
cp mercurial-x.x/contrib/hgk /usr/bin
sudo apt-get install tk8.5

put the following in your $HOME/.hgrc

[extensions]
hgk=/usr/local/lib/python2.6/dist-packages/mercurial-1.5.1-py2.6-linux-i686.egg/hgext/hgk.py

[hgk]
path=/your home/bin/hgk

Some Useful Commands:

The actual version information: hg version
Create a new repository in the given directory:hg help init
hg init [-e CMD] [--remotecmd CMD] [DEST]

Making a local copy of a repository: hg clone <directory>
or hg clone ssh://sourceforge.foo:port/removeDirectory

Through history: hg log or hg glog

Viewing specific revisions use the -r (or --rev) option
hg log -r 024584ws345
hg log -r q272e0d5w32 -r 0272e0d5w324

More detailed information add -v (or --verbose) option
To see content of a change add the -p (or --patch) option
e.g. hg log -v -p -l 9 | less

To display the change set: hg tip -vp
pull the changes: hg in, hg pull
update the working copy: hg up (update)

merging the changes

incoming change: hg in -v
outgoing change: hg out -v
hg merge -r default (tip)

The life of a patch

hg qnew -f <file-name> (create a new patch)
hg qimport fileName (import a patch file)
hg qseries -v (listen patches views)
hg qpop (remove the top patch) and hg qpop -a (for unapply all patches)
hg qpush (apply the patch again form the top) and hg qpush -a (apply all patches)

Specify a patch by name:
hg qpop -n <patch name>hg qpush -n <patch name>
hg qren (for rename a patch)
hg qrm <patch name> (remove patch)
hg qrefresh -U -e (check out the latest update of the patches)

hg log -v -r tip (Control)
hg qdiff | less -S
hg qrefresh -X foo (to exclude files matching foo)

Merge the changes from first-patch into second-patch
hg qgoto first-patch # go to first patch
hg qfold second-patch # fold second patch into it

4 Responses to “Mercurial & hg view”

  1. Robert, 1. April 2011, 5:21

    Tried using the commands on “merge the changes…” but it doesn’t work. An error was returned and the command was promptly cancelled. Could you help me with that?

    Cheers

  2. admin, 1. April 2011, 9:20

    With the hg qfold command you can merge a patch into another one:

    hg qgoto first-patch      # go to first patch
    hg qfold second-patch     # fold second patch into first patch

  3. David Brown, 4. April 2011, 14:17

    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:”Table Normal”;
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-parent:”";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin:0cm;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:10.0pt;
    font-family:”Calibri”,”sans-serif”;
    mso-bidi-font-family:”Times New Roman”;}

    I think it is admirable that so much thought goes into the design phase. I am often disappointed in how little effort may be made by developers and seeing your dedication to the improvement of quality in coding make me very impressed. I always look for new ideas when looking at the various ways I can encourage our developers to improve the sites I am involved in managing such as http://www.mycover.com.au for example. Please feel free to visit the site and offer me your comments.

  4. Ed Ward, 10. April 2011, 15:23

    hg qnew -f <file-name> (create a new patch)
    hg qimport fileName (import a patch file)
    hg qseries -v (listen patches views)
    hg qpop (remove the top patch) and hg qpop -a (for unapply all patches)
    hg qpush (apply the patch again form the top) and hg qpush -a (apply all patches)

    Hi! I tried this yet it still didn’t help me in merging the change. Please help me.

Post your comment

Captcha
Enter the letters you see above.