01 May 2009, 23:31

mercurial usefull stuff

Share

Using mercurial for the beginner may sounds scarry here are fast tips

  • Edit ~/.hgrc

    ## This is a Mercurial configuration file. [ui] username = Your Name

    #enable ssh compression ssh = ssh -C

    [extensions]

    enable hg convert to import you old svn repository

    hgext.convert=

    #enable hg glog command hgext.graphlog =

    enable color diff, need mercurial >=1.1

    color=

    enable visual filemerge on OsX

    [merge-tools] filemerge.executable=opendiff filemerge.args=$other $local -ancestor $base -merge $output filemerge.gui=True

  • At the root of you repository add .hgignore (and commit it) hg add .hgignore,_ hg commit, hg push_

    syntax: glob

    .DS_Store

    Xcode

    *.swp *~.nib build *.pbxuser *.perspective *.perspectivev3

    Python

    *.py[oc]c

    no subversion directories

    .svn

    #others *~

  • Remember to hg update after a pull or use hg pull -u

  • Use hg glog

    @ changeset: 4:1961f87e1d05 |\ tag: tip | | parent: 2:fb59b74f6239 | | parent: 3:18393dd152ee | | user: ME | | date: Fri May 01 23:22:23 2009 +0200 | | summary: resolve conflicts | | | o changeset: 3:18393dd152ee | | parent: 1:c8785a6f41ec | | user: ME | | date: Fri May 01 15:44:25 2009 +0200 | | summary: change helloworld to use tag | | o | changeset: 2:fb59b74f6239 |/ user: ME | date: Fri May 01 23:12:21 2009 +0200 | summary: add the super killer app | o changeset: 1:c8785a6f41ec | user: ME | date: Thu Apr 30 01:23:17 2009 +0200 | summary: add my exercices | o changeset: 0:a2883c1a5659 user: ME date: Thu Apr 30 01:14:57 2009 +0200 summary: first version of chatclient socket is working

  • Use hg rollback when something go wrong (only last commit)

  • Do not use hg push -f if “abort: push creates new remote heads!“, Try hg merge and hg update –all if conflicts occurs, hg commit, then hg push

  • Force a merge with my files or their files:

    HGMERGE=internal:local hg merge #keep my files HGMERGE=internal:other hg merge #keep their files