README
author mpm@selenic.com
Mon, 27 Jun 2005 22:29:44 -0800
changeset 495 e94cebc60d96
parent 445 fe48ffa3665f
child 507 dd8b19114fe7
permissions -rw-r--r--
Pull from TAH -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Pull from TAH manifest hash: 08b55e07198b8a4272753895fe3727d9f52ebb75 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCwO5YywK+sNU5EO8RArUtAJ9gsYYNbZH22COOz9B7ppwgCDxM8ACfYWcl n9Dim3Z7qepGUXvRDEeFZ9c= =JMQx -----END PGP SIGNATURE-----
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
445
fe48ffa3665f README tidy-up
mpm@selenic.com
parents: 330
diff changeset
     1
MERCURIAL QUICK-START
fe48ffa3665f README tidy-up
mpm@selenic.com
parents: 330
diff changeset
     2
204
161cef501e8d README: integrate various changes and suggestions from Rafael Villar Burke
mpm@selenic.com
parents: 182
diff changeset
     3
Setting up Mercurial:
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
     4
204
161cef501e8d README: integrate various changes and suggestions from Rafael Villar Burke
mpm@selenic.com
parents: 182
diff changeset
     5
 Note: some distributions fails to include bits of distutils by
205
d255d99a7cbd README: integrate some changes from Kevin Smith
mpm@selenic.com
parents: 204
diff changeset
     6
 default, you'll need python-dev to install. You'll also need a C
d255d99a7cbd README: integrate some changes from Kevin Smith
mpm@selenic.com
parents: 204
diff changeset
     7
 compiler and a 3-way merge tool like merge, tkdiff, or kdiff3.
204
161cef501e8d README: integrate various changes and suggestions from Rafael Villar Burke
mpm@selenic.com
parents: 182
diff changeset
     8
161cef501e8d README: integrate various changes and suggestions from Rafael Villar Burke
mpm@selenic.com
parents: 182
diff changeset
     9
 First, unpack the source:
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    10
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    11
 $ tar xvzf mercurial-<ver>.tar.gz
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    12
 $ cd mercurial-<ver>
204
161cef501e8d README: integrate various changes and suggestions from Rafael Villar Burke
mpm@selenic.com
parents: 182
diff changeset
    13
205
d255d99a7cbd README: integrate some changes from Kevin Smith
mpm@selenic.com
parents: 204
diff changeset
    14
 To install system-wide:
204
161cef501e8d README: integrate various changes and suggestions from Rafael Villar Burke
mpm@selenic.com
parents: 182
diff changeset
    15
161cef501e8d README: integrate various changes and suggestions from Rafael Villar Burke
mpm@selenic.com
parents: 182
diff changeset
    16
 $ python setup.py install   # change python to python2.3 if 2.2 is default
161cef501e8d README: integrate various changes and suggestions from Rafael Villar Burke
mpm@selenic.com
parents: 182
diff changeset
    17
205
d255d99a7cbd README: integrate some changes from Kevin Smith
mpm@selenic.com
parents: 204
diff changeset
    18
 To install in your home directory (~/bin and ~/lib, actually), run:
204
161cef501e8d README: integrate various changes and suggestions from Rafael Villar Burke
mpm@selenic.com
parents: 182
diff changeset
    19
161cef501e8d README: integrate various changes and suggestions from Rafael Villar Burke
mpm@selenic.com
parents: 182
diff changeset
    20
 $ python2.3 setup.py install --home=~
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    21
 $ export PYTHONPATH=${HOME}/lib/python  # add this to your .bashrc
204
161cef501e8d README: integrate various changes and suggestions from Rafael Villar Burke
mpm@selenic.com
parents: 182
diff changeset
    22
 $ export PATH=${HOME}/bin:$PATH         # 
205
d255d99a7cbd README: integrate some changes from Kevin Smith
mpm@selenic.com
parents: 204
diff changeset
    23
204
161cef501e8d README: integrate various changes and suggestions from Rafael Villar Burke
mpm@selenic.com
parents: 182
diff changeset
    24
 And finally:
161cef501e8d README: integrate various changes and suggestions from Rafael Villar Burke
mpm@selenic.com
parents: 182
diff changeset
    25
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    26
 $ hg                                    # test installation, show help
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    27
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    28
 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
    29
 PYTHONPATH correctly.
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
Setting up a Mercurial project:
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    32
445
fe48ffa3665f README tidy-up
mpm@selenic.com
parents: 330
diff changeset
    33
 $ cd project/
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    34
 $ hg init         # creates .hg
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    35
 $ 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
    36
 $ hg diff         # generate a unidiff
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    37
 $ 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
    38
 $ hg commit       # commit all changes, edit changelog entry
261
3dae0296551d Update README
mpm@selenic.com
parents: 241
diff changeset
    39
 $ hg export <rev> # export a changeset as a diff
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    40
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    41
 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
    42
 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
    43
 paths.
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    44
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    45
Mercurial commands:
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    46
445
fe48ffa3665f README tidy-up
mpm@selenic.com
parents: 330
diff changeset
    47
 $ hg help [command]   # get online help
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    48
 $ hg history          # show changesets
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    49
 $ hg log Makefile     # show commits per file
261
3dae0296551d Update README
mpm@selenic.com
parents: 241
diff changeset
    50
 $ hg update           # check out the tip revision
3dae0296551d Update README
mpm@selenic.com
parents: 241
diff changeset
    51
 $ hg update <id>      # check out a specified changeset
160
5c331d941c7f Update the README a bit
mpm@selenic.com
parents: 81
diff changeset
    52
                       # IDs can be tags, revision numbers, or unique
5c331d941c7f Update the README a bit
mpm@selenic.com
parents: 81
diff changeset
    53
                       # subsets of changeset hash numbers
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    54
 $ 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
    55
 $ hg remove bar       # mark a file as removed
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    56
 $ hg verify           # check repo integrity
67
a182f2561c8e Add tag support
mpm@selenic.com
parents: 63
diff changeset
    57
 $ hg tags             # show current tags
81
17884f79d59d Add annotate and blame to the command list and README
mpm@selenic.com
parents: 67
diff changeset
    58
 $ hg annotate [files] # show changeset numbers for each file line
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    59
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    60
Branching and merging:
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    61
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    62
 $ cd ..
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    63
 $ mkdir linux-work
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    64
 $ cd linux-work
327
a9ad98a9c9bc Tweak README for branch, push, and .hgrc
mpm@selenic.com
parents: 261
diff changeset
    65
 $ hg init ../linux          # create a new branch
261
3dae0296551d Update README
mpm@selenic.com
parents: 241
diff changeset
    66
 $ hg update                 # populate the working directory
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    67
 $ <make changes>
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    68
 $ hg commit
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    69
 $ cd ../linux
261
3dae0296551d Update README
mpm@selenic.com
parents: 241
diff changeset
    70
 $ hg pull ../linux-work     # pull changesets from linux-work
445
fe48ffa3665f README tidy-up
mpm@selenic.com
parents: 330
diff changeset
    71
 $ hg update -m              # merge the new tip from linux-work into
261
3dae0296551d Update README
mpm@selenic.com
parents: 241
diff changeset
    72
                             # our working directory
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    73
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    74
Importing patches:
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    75
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    76
 Fast:
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    77
 $ patch < ../p/foo.patch
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    78
 $ hg addremove
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    79
 $ hg commit
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    80
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    81
 Faster:
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    82
 $ patch < ../p/foo.patch
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    83
 $ hg commit `lsdiff -p1 ../p/foo.patch`
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    84
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    85
 Fastest:
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
    86
 $ 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
    87
205
d255d99a7cbd README: integrate some changes from Kevin Smith
mpm@selenic.com
parents: 204
diff changeset
    88
Exporting a patch:
d255d99a7cbd README: integrate some changes from Kevin Smith
mpm@selenic.com
parents: 204
diff changeset
    89
d255d99a7cbd README: integrate some changes from Kevin Smith
mpm@selenic.com
parents: 204
diff changeset
    90
 (make changes)
d255d99a7cbd README: integrate some changes from Kevin Smith
mpm@selenic.com
parents: 204
diff changeset
    91
 $ hg commit
d255d99a7cbd README: integrate some changes from Kevin Smith
mpm@selenic.com
parents: 204
diff changeset
    92
 $ hg tip
d255d99a7cbd README: integrate some changes from Kevin Smith
mpm@selenic.com
parents: 204
diff changeset
    93
 28237:747a537bd090880c29eae861df4d81b245aa0190
d255d99a7cbd README: integrate some changes from Kevin Smith
mpm@selenic.com
parents: 204
diff changeset
    94
 $ hg export 28237 > foo.patch    # export changeset 28237
d255d99a7cbd README: integrate some changes from Kevin Smith
mpm@selenic.com
parents: 204
diff changeset
    95
63
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
    96
Network support:
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
    97
445
fe48ffa3665f README tidy-up
mpm@selenic.com
parents: 330
diff changeset
    98
 # pull from the primary Mercurial repo
1
273ce12ad8f1 Update README to discuss remote pull, rsync, and the hg repo
mpm@selenic.com
parents: 0
diff changeset
    99
 foo$ hg init
261
3dae0296551d Update README
mpm@selenic.com
parents: 241
diff changeset
   100
 foo$ hg pull http://selenic.com/hg/
3dae0296551d Update README
mpm@selenic.com
parents: 241
diff changeset
   101
 foo$ hg update # hg co works too
1
273ce12ad8f1 Update README to discuss remote pull, rsync, and the hg repo
mpm@selenic.com
parents: 0
diff changeset
   102
160
5c331d941c7f Update the README a bit
mpm@selenic.com
parents: 81
diff changeset
   103
 # export your current repo via HTTP with browsable interface
5c331d941c7f Update the README a bit
mpm@selenic.com
parents: 81
diff changeset
   104
 foo$ hg serve -n "My repo" -p 80
5c331d941c7f Update the README a bit
mpm@selenic.com
parents: 81
diff changeset
   105
 
327
a9ad98a9c9bc Tweak README for branch, push, and .hgrc
mpm@selenic.com
parents: 261
diff changeset
   106
 # pushing changes to a remote repo with SSH
a9ad98a9c9bc Tweak README for branch, push, and .hgrc
mpm@selenic.com
parents: 261
diff changeset
   107
 foo$ hg push ssh://user@example.com/~/hg/
a9ad98a9c9bc Tweak README for branch, push, and .hgrc
mpm@selenic.com
parents: 261
diff changeset
   108
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
   109
 # merge changes from a remote machine
261
3dae0296551d Update README
mpm@selenic.com
parents: 241
diff changeset
   110
 bar$ hg pull http://foo/
445
fe48ffa3665f README tidy-up
mpm@selenic.com
parents: 330
diff changeset
   111
 bar$ hg update -m        # merge changes into your working directory
63
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
   112
160
5c331d941c7f Update the README a bit
mpm@selenic.com
parents: 81
diff changeset
   113
 # Set up a CGI server on your webserver
445
fe48ffa3665f README tidy-up
mpm@selenic.com
parents: 330
diff changeset
   114
 foo$ cp hgweb.cgi ~/public_html/hg/index.cgi
fe48ffa3665f README tidy-up
mpm@selenic.com
parents: 330
diff changeset
   115
 foo$ emacs ~/public_html/hg/index.cgi # adjust the defaults
63
1c590d34bf61 Minor changes for release 0.4e
mpm@selenic.com
parents: 27
diff changeset
   116
204
161cef501e8d README: integrate various changes and suggestions from Rafael Villar Burke
mpm@selenic.com
parents: 182
diff changeset
   117
Symbolic repository names:
161cef501e8d README: integrate various changes and suggestions from Rafael Villar Burke
mpm@selenic.com
parents: 182
diff changeset
   118
327
a9ad98a9c9bc Tweak README for branch, push, and .hgrc
mpm@selenic.com
parents: 261
diff changeset
   119
 Mercurial uses an options file called ~/.hgrc. To track locations
a9ad98a9c9bc Tweak README for branch, push, and .hgrc
mpm@selenic.com
parents: 261
diff changeset
   120
 symbolically, add a section to it like this:
204
161cef501e8d README: integrate various changes and suggestions from Rafael Villar Burke
mpm@selenic.com
parents: 182
diff changeset
   121
327
a9ad98a9c9bc Tweak README for branch, push, and .hgrc
mpm@selenic.com
parents: 261
diff changeset
   122
 [paths]
a9ad98a9c9bc Tweak README for branch, push, and .hgrc
mpm@selenic.com
parents: 261
diff changeset
   123
 main = http://selenic.com/hg
445
fe48ffa3665f README tidy-up
mpm@selenic.com
parents: 330
diff changeset
   124
 linux = http://www.kernel.org/hg/