doc/book/en/D060-mercurial.en.txt
author Sandrine Ribeau <sandrine.ribeau@logilab.fr>
Thu, 11 Dec 2008 10:58:52 -0800
changeset 208 30762142841f
parent 127 ae611743f5c6
child 267 843e0b1bf991
permissions -rw-r--r--
[doc] Translation to english.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
     1
.. -*- coding: utf-8 -*-
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
     2
105
300166b41ea9 [doc] Moved installation from mercurial forest in appendix. Cleaned installation section but needs improvements.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 104
diff changeset
     3
.. _MercurialPresentation:
98
f756ead5746a [doc] Initial translation of first two section in installation chapter.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 93
diff changeset
     4
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
     5
Introducing Mercurial
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
     6
=====================
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
     7
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
     8
Introduction
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
     9
````````````
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    10
Mercurial_ manages a distributed repository containing revisions
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    11
trees (each revision indicates the changes required to obtain the
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    12
next, and so on). Locally, we have a repository containing revisions
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    13
tree, and a working directory. It is possible
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    14
to put in its working directory, one of the versions of its local repository,
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    15
modify and then push it in its repository. 
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    16
It is also possible to get revisions from another repository or to export
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    17
its own revisions from the local repository to another repository.
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    18
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    19
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    20
In contrast to CVS/Subversion, we usually create a repository by
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    21
project to manage.
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    22
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    23
In a collaborative development, we usually create a central repository
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    24
accessible to all developers of the project. These central repository is used
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    25
as a reference. According to its needs, then everyone can have a local repository,
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    26
that you will have to synchronize with the central repository from time to time.
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    27
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    28
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    29
Major commands
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    30
``````````````
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    31
* Create a local repository::
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    32
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    33
     hg clone ssh://orion//home/src/private/rep
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    34
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    35
* See the contents of the local repository (graphical tool in Tk)::
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    36
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    37
     hgview
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    38
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    39
* Add a sub-directory or file in the current directory::
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    40
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    41
     hg add rep
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    42
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    43
* Move to the working directory a specific revision (or last
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    44
  revision) from the local repository::
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    45
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    46
     hg update [identifier-revision]
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    47
     hg up [identifier-revision]
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    48
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    49
* Get in its local repository, the tree of revisions contained in a
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    50
  remote repository (this does not change the local directory)::
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    51
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    52
     hg pull ssh://orion//home/src/private/rep
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    53
     hg pull-u ssh://orion//home/src/private/rep # equivalent to pull + update
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    54
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    55
* See what are the heads of branches of the local repository if a `pull`
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    56
  returned a new branch::
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    57
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    58
     hg heads
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    59
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    60
* Submit the working directory in the local repository (and create a new
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    61
  revision)::
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    62
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    63
     hg commit
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    64
     hg ci
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    65
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    66
* Merge with the mother revision of local directory, another revision from
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    67
  the local respository (the new revision will be then two mothers
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    68
  revisions)::
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    69
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    70
     hg merge identifier-revision
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    71
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    72
* Export to a remote repository, the tree of revisions in its content
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    73
  local respository (this does not change the local directory)::
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    74
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    75
     hg push ssh://orion//home/src/private/rep
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    76
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    77
* See what local revisions are not in another repository::
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    78
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    79
     hg outgoing ssh://orion//home/src/private/rep
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    80
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    81
* See what are the revisions of a repository not found locally::
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    82
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    83
     hg incoming ssh://orion//home/src/private/rep
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    84
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    85
* See what is the revision of the local repository which has been taken out 
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    86
  from the working directory and amended::
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    87
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    88
     hg parent
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    89
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    90
* See the differences between the working directory and the mother revision
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    91
  of the local repository, possibly to submit them in the local repository::
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    92
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    93
     hg diff
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    94
     hg commit-tool
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    95
     hg ct
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    96
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    97
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    98
Best Practices
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    99
``````````````
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   100
* Think of making a `hg pull -u` regularly, and particularly before
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   101
   a `hg commit`.
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   102
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   103
* Think of a `hg push` when your repository contains a version
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   104
  relatively stable of your changes.
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   105
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   106
* If a `hg pull u` created a new branch head:
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   107
208
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   108
   1. identify its identifier with `hg head`
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   109
   2. merge with `hg merge`
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   110
   3. `hg ci`
30762142841f [doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   111
   4. `hg push`
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   112
127
ae611743f5c6 [doc] divided book in parts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 105
diff changeset
   113
ae611743f5c6 [doc] divided book in parts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 105
diff changeset
   114
.. include:: D061-mercurial-forest.en.txt