hg.rst
changeset 685 6413021852a2
parent 678 cd12d3519111
child 766 0eb76fb9d948
equal deleted inserted replaced
663:07f96799cb19 685:6413021852a2
     1 -*- mode: outline; coding: utf-8 -*-
     1 -*- mode: outline; coding: utf-8 -*-
     2 
     2 
     3 * Useful customization.
     3 * About.
       
     4 
       
     5     http://mercurial.selenic.com/wiki/ProjectsUsingMercurial
       
     6                 Some Projects that Use Mercurial
       
     7 
       
     8 * User config.
     4 
     9 
     5 Put to your ~/.hgrc:
    10 Put to your ~/.hgrc:
     6 
    11 
     7   [ui]
    12   [ui]
     8   ; Editor for editing commit message.
    13   ; Editor for editing commit message.
    48 or put into ~/.hgrc:
    53 or put into ~/.hgrc:
    49 
    54 
    50   [defaults]
    55   [defaults]
    51   log = -f
    56   log = -f
    52 
    57 
       
    58 * Publishing repo.
       
    59 
       
    60 With static HTTP hosting you can copy via rsync, ftp, scp, etc., so long as all the files beneath
       
    61 .hg are copied. Also since 1.1 pull protocol can detect static HTTP hosting:
       
    62 
       
    63   $ hg clone http://example.com/project
       
    64 
       
    65   http://mercurial.selenic.com/wiki/hgserve
       
    66   http://mercurial.selenic.com/wiki/HgWebDirStepByStep
       
    67   http://mercurial.selenic.com/wiki/StaticHTTP
       
    68 
       
    69 ** hgweb.config.
       
    70 
       
    71 Set allowed project by specifying paths to they (keys are URL, values are fs paths):
       
    72 
       
    73   [paths]
       
    74   myproject = /home/user/hg/myproject
       
    75   otherproject = /home/user/hg/otherproject
       
    76 
       
    77 You can use single wildcard '*' to search current subdirs or double wildcard '**' to search subdirs
       
    78 recursively:
       
    79 
       
    80   [paths]
       
    81   myproject = /home/user/hg/my/*
       
    82   otherproject = /home/user/hg/other/**
       
    83 
       
    84 Alternatively you can set a collection of repos (keys and values are both filesystem paths, keys
       
    85 should be prefixes of the values and are "subtracted" from the values in order to generate the URL
       
    86 paths to each repository):
       
    87 
       
    88   [collections]
       
    89   /home/user/hg = /home/user/hg
       
    90   /home/another/hg = /home/another/hg
       
    91 
       
    92 Allow archive downloads:
       
    93 
       
    94   [web]
       
    95   allow_archive = gz, zip, bz2
       
    96 
       
    97 Make web page look nice:
       
    98 
       
    99   [web]
       
   100   # Use 'cd /lib/python2.x/site-packages/mercurial/templates; find . -type d' to see available
       
   101   # styles. Some interesting: gitweb, coal, monoblue.
       
   102   style = gitweb
       
   103 
       
   104 Set another settings:
       
   105 
       
   106   [web]
       
   107   encoding = UTF-8
       
   108 
       
   109   maxchanges = 100
       
   110   maxfiles = 100
       
   111 
       
   112 In each $proj/.hg/hgrc put:
       
   113 
       
   114   [web]
       
   115   contact = ADMIN <admin@example.com>
       
   116   description = <p style="color: red;">$proj</b> allow make a <a href="http://example.com">BIG Thing.</a>
       
   117   # Do not use name, in this case you see dir name where project lcated.
       
   118   # name = $proj
       
   119 
       
   120 To allow push in 'hg serv':
       
   121 
       
   122   [web]
       
   123   allow_push = *
       
   124   push_ssl = false
       
   125 
       
   126   http://mercurial.selenic.com/wiki/PublishingRepositories
       
   127                 Publishing Mercurial Repositories
       
   128 
       
   129 ** init.d script.
       
   130 
       
   131   #!/bin/sh
       
   132   CMD=/usr/bin/hg
       
   133 
       
   134   PORT=7878
       
   135   SRC=/srv/hg
       
   136   CONGIG=/srv/hg/hgweb.config
       
   137   PIDFILE=/var/run/hg.pid
       
   138 
       
   139   case "$1" in
       
   140   start)
       
   141     echo "Mecurial Server service starting."
       
   142     (cd "$SRC"; $CMD serve -d -p $PORT --pid-file "$PIDFILE")
       
   143     ;;
       
   144   stop)
       
   145     if [ -f "$PIDFILE" ]; then
       
   146       PID=`cat "$PIDFILE"`
       
   147       if [ "$PID" -gt 1 ]; then
       
   148         kill -TERM $PID
       
   149         echo "Stopping the Mercurial service PID=$PID."
       
   150       else
       
   151         echo Bad PID for Mercurial -- \"$PID\".
       
   152         echo You may remove \"$PIDFILE\" manually.
       
   153       fi
       
   154     else
       
   155       echo No PID file recorded for mercurial.
       
   156     fi
       
   157     ;;
       
   158   *)
       
   159     echo "$0 {start|stop}"
       
   160     exit 1
       
   161     ;;
       
   162   esac
       
   163 
       
   164   http://mercurial.selenic.com/wiki/hgserve
       
   165 
    53 * Manage patches with MQ.
   166 * Manage patches with MQ.
    54 
   167 
    55 First enable MQ, add following to your ~/.hgrc:
   168 First enable MQ, add following to your ~/.hgrc:
    56 
   169 
    57   [extensions]
   170   [extensions]
   130 
   243 
   131 * Proxy.
   244 * Proxy.
   132 
   245 
   133   $ hg clone --config http_proxy.host=$host:$port \
   246   $ hg clone --config http_proxy.host=$host:$port \
   134     --config http_proxy.user=$user --config http_proxy.passwd=$password  $addr
   247     --config http_proxy.user=$user --config http_proxy.passwd=$password  $addr
       
   248 
       
   249 * Free Mercurial hosting.
       
   250 
       
   251   http://mercurial.selenic.com/wiki/MercurialHosting
       
   252                 Free Hosting of Mercurial Repositories