README
changeset 633 f597539c7abd
parent 631 a287f6cd9c6b
child 969 1d5b97537561
child 981 4f81068ed8cd
equal deleted inserted replaced
632:8b8f710bb658 633:f597539c7abd
    30 
    30 
    31 Setting up a Mercurial project:
    31 Setting up a Mercurial project:
    32 
    32 
    33  $ cd project/
    33  $ cd project/
    34  $ hg init         # creates .hg
    34  $ hg init         # creates .hg
    35  $ hg status       # show changes between repo and working dir
       
    36  $ hg diff         # generate a unidiff
       
    37  $ hg addremove    # add all unknown files and remove all missing files
    35  $ hg addremove    # add all unknown files and remove all missing files
    38  $ hg commit       # commit all changes, edit changelog entry
    36  $ hg commit       # commit all changes, edit changelog entry
    39  $ hg export <rev> # export a changeset as a diff
       
    40 
    37 
    41  Mercurial will look for a file named .hgignore in the root of your
    38  Mercurial will look for a file named .hgignore in the root of your
    42  repository contains a set of regular expressions to ignore in file
    39  repository which contains a set of regular expressions to ignore in
    43  paths.
    40  file paths.
    44 
       
    45 Mercurial commands:
       
    46 
       
    47  $ hg help [command]   # get online help
       
    48  $ hg history          # show changesets
       
    49  $ hg log Makefile     # show commits per file
       
    50  $ hg update           # check out the tip revision
       
    51  $ hg update <id>      # check out a specified changeset
       
    52                        # IDs can be tags, revision numbers, or unique
       
    53                        # subsets of changeset hash numbers
       
    54  $ hg add foo          # add a new file for the next commit
       
    55  $ hg remove bar       # mark a file as removed
       
    56  $ hg verify           # check repo integrity
       
    57  $ hg tags             # show current tags
       
    58  $ hg tag <name>       # tag current tip with distributed tag <name>
       
    59  $ hg tag -l <name>    # tag current tip with local tag <name>
       
    60  $ hg annotate [files] # show changeset numbers for each file line
       
    61 
    41 
    62 Branching and merging:
    42 Branching and merging:
    63 
    43 
    64  $ cd ..
    44  $ hg clone linux linux-work    # create a new branch
    65  $ mkdir linux-work
       
    66  $ cd linux-work
    45  $ cd linux-work
    67  $ hg init ../linux          # create a new branch
       
    68  $ hg update                 # populate the working directory
       
    69  $ <make changes>
    46  $ <make changes>
    70  $ hg commit
    47  $ hg commit
    71  $ cd ../linux
    48  $ cd ../linux
    72  $ hg pull ../linux-work     # pull changesets from linux-work
    49  $ hg pull ../linux-work     # pull changesets from linux-work
    73  $ hg update -m              # merge the new tip from linux-work into
    50  $ hg update -m              # merge the new tip from linux-work into
    74                              # our working directory
    51                              # our working directory
       
    52  $ hg commit                 # commit the result of the merge
    75 
    53 
    76 Importing patches:
    54 Importing patches:
    77 
    55 
    78  Fast:
    56  Fast:
    79  $ patch < ../p/foo.patch
    57  $ patch < ../p/foo.patch
    96  $ hg export 28237 > foo.patch    # export changeset 28237
    74  $ hg export 28237 > foo.patch    # export changeset 28237
    97 
    75 
    98 Network support:
    76 Network support:
    99 
    77 
   100  # pull from the primary Mercurial repo
    78  # pull from the primary Mercurial repo
   101  foo$ hg init
    79  foo$ hg clone http://selenic.com/hg/ 
   102  foo$ hg pull http://selenic.com/hg/
    80  foo$ cd hg
   103  foo$ hg update # hg co works too
       
   104 
    81 
   105  # export your current repo via HTTP with browsable interface
    82  # export your current repo via HTTP with browsable interface
   106  foo$ hg serve -n "My repo" -p 80
    83  foo$ hg serve -n "My repo" -p 80
   107  
    84  
   108  # pushing changes to a remote repo with SSH
    85  # pushing changes to a remote repo with SSH
   113  bar$ hg update -m        # merge changes into your working directory
    90  bar$ hg update -m        # merge changes into your working directory
   114 
    91 
   115  # Set up a CGI server on your webserver
    92  # Set up a CGI server on your webserver
   116  foo$ cp hgweb.cgi ~/public_html/hg/index.cgi
    93  foo$ cp hgweb.cgi ~/public_html/hg/index.cgi
   117  foo$ emacs ~/public_html/hg/index.cgi # adjust the defaults
    94  foo$ emacs ~/public_html/hg/index.cgi # adjust the defaults
   118 
       
   119 Symbolic repository names:
       
   120 
       
   121  Mercurial uses an options file called ~/.hgrc. To track locations
       
   122  symbolically, add a section to it like this:
       
   123 
       
   124  [paths]
       
   125  main = http://selenic.com/hg
       
   126  linux = http://www.kernel.org/hg/