README
author mpm@selenic.com
Mon, 23 May 2005 16:05:48 -0800
changeset 140 30ef77113872
parent 81 17884f79d59d
child 160 5c331d941c7f
permissions -rw-r--r--
Minor safety checks to manifest diff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
     1
Setting up Mercurial in your home directory:
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
     2
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
     3
 Note: Debian fails to include bits of distutils, you'll need
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
     4
 python-dev to install. Alternately, shove everything somewhere in
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
     5
 your path.
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
     6
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
     7
 $ tar xvzf mercurial-<ver>.tar.gz
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
     8
 $ cd mercurial-<ver>
63
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
     9
 $ python2.3 setup.py install --home ~
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    10
 $ export PYTHONPATH=${HOME}/lib/python  # add this to your .bashrc
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    11
 $ export HGMERGE=tkmerge                # customize this
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    12
 $ hg                                    # test installation, show help
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    13
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    14
 If you get complaints about missing modules, you probably haven't set
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    15
 PYTHONPATH correctly.
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    16
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    17
Setting up a Mercurial project:
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    18
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    19
 $ cd linux/
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    20
 $ hg init         # creates .hg
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    21
 $ hg status       # show changes between repo and working dir
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    22
 $ hg diff         # generate a unidiff
63
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
    23
 $ hg export       # export a changeset as a diff
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    24
 $ hg addremove    # add all unknown files and remove all missing files
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    25
 $ hg commit       # commit all changes, edit changelog entry
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    26
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    27
 Mercurial will look for a file named .hgignore in the root of your
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    28
 repository contains a set of regular expressions to ignore in file
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    29
 paths.
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    30
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    31
Mercurial commands:
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    32
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    33
 $ hg history          # show changesets
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    34
 $ hg log Makefile     # show commits per file
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    35
 $ hg checkout         # check out the tip revision
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    36
 $ hg checkout <hash>  # check out a specified changeset
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    37
 $ hg add foo          # add a new file for the next commit
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    38
 $ hg remove bar       # mark a file as removed
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    39
 $ hg verify           # check repo integrity
67
a182f2561c8e Add tag support
mpm@selenic.com
parents: 63
diff changeset
    40
 $ hg tags             # show current tags
81
17884f79d59d Add annotate and blame to the command list and README
mpm@selenic.com
parents: 67
diff changeset
    41
 $ hg annotate [files] # show changeset numbers for each file line
17884f79d59d Add annotate and blame to the command list and README
mpm@selenic.com
parents: 67
diff changeset
    42
 $ hg blame [files]    # show commit users for each file line
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    43
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    44
Branching and merging:
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    45
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    46
 $ cd ..
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    47
 $ mkdir linux-work
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    48
 $ cd linux-work
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    49
 $ hg branch ../linux        # create a new branch
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    50
 $ hg checkout               # populate the working directory
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    51
 $ <make changes>
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    52
 $ hg commit
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    53
 $ cd ../linux
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    54
 $ hg merge ../linux-work    # pull changesets from linux-work
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    55
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    56
Importing patches:
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    57
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    58
 Fast:
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    59
 $ patch < ../p/foo.patch
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    60
 $ hg addremove
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    61
 $ hg commit
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    62
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    63
 Faster:
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    64
 $ patch < ../p/foo.patch
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    65
 $ hg commit `lsdiff -p1 ../p/foo.patch`
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    66
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    67
 Fastest:
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    68
 $ cat ../p/patchlist | xargs hg import -p1 -b ../p 
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    69
63
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
    70
Network support:
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
    71
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
    72
 The simple way:
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    73
1
273ce12ad8f1 Update README to discuss remote pull, rsync, and the hg repo
mpm@selenic.com
parents: 0
diff changeset
    74
 # pull the self-hosting hg repo
273ce12ad8f1 Update README to discuss remote pull, rsync, and the hg repo
mpm@selenic.com
parents: 0
diff changeset
    75
 foo$ hg init
273ce12ad8f1 Update README to discuss remote pull, rsync, and the hg repo
mpm@selenic.com
parents: 0
diff changeset
    76
 foo$ hg merge http://selenic.com/hg/
27
febfb35d2a3e hg co after hg merge
mpm@selenic.com
parents: 1
diff changeset
    77
 foo$ hg checkout  # hg co works too
1
273ce12ad8f1 Update README to discuss remote pull, rsync, and the hg repo
mpm@selenic.com
parents: 0
diff changeset
    78
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    79
 # export your .hg directory as a directory on your webserver
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    80
 foo$ ln -s .hg ~/public_html/hg-linux 
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    81
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    82
 # merge changes from a remote machine
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    83
 bar$ hg merge http://foo/~user/hg-linux
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    84
63
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
    85
 The new, fast, experimental way:
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
    86
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
    87
 # pull the self-hosting hg repo
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
    88
 foo$ hg init
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
    89
 foo$ hg merge hg://selenic.com/hg/
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
    90
 foo$ hg checkout  # hg co works too
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
    91
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
    92
 # Set up the CGI server on your webserver
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
    93
 foo$ ln -s .hg ~/public_html/hg-linux/.hg
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
    94
 foo$ cp hgweb.py ~/public_html/hg-linux/index.cgi
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
    95
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
    96
 # merge changes from a remote machine
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
    97
 bar$ hg merge hg://foo/~user/hg-linux
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
    98
1
273ce12ad8f1 Update README to discuss remote pull, rsync, and the hg repo
mpm@selenic.com
parents: 0
diff changeset
    99
 Another approach which does perform well right now is to use rsync.
273ce12ad8f1 Update README to discuss remote pull, rsync, and the hg repo
mpm@selenic.com
parents: 0
diff changeset
   100
 Simply rsync the remote repo to a read-only local copy and then do a
273ce12ad8f1 Update README to discuss remote pull, rsync, and the hg repo
mpm@selenic.com
parents: 0
diff changeset
   101
 local pull.
273ce12ad8f1 Update README to discuss remote pull, rsync, and the hg repo
mpm@selenic.com
parents: 0
diff changeset
   102