1 .. -*- coding: utf-8 -*- |
1 .. -*- coding: utf-8 -*- |
2 |
2 |
3 .. _MercurialPresentation: |
3 .. _MercurialPresentation: |
4 |
4 |
5 Présentation de Mercurial |
5 Introducing Mercurial |
6 ========================= |
6 ===================== |
7 |
7 |
8 Introduction |
8 Introduction |
9 ```````````` |
9 ```````````` |
10 Mercurial_ gère un ensemble distribué d'entrepôts contenant des arbres de |
10 Mercurial_ manages a distributed repository containing revisions |
11 révisions (chaque révision indique les changements à effectuer pour obtenir la |
11 trees (each revision indicates the changes required to obtain the |
12 version suivante, et ainsi de suite). Localement, on dispose d'un entrepôt |
12 next, and so on). Locally, we have a repository containing revisions |
13 contenant un arbre de révisions, et d'un répertoire de travail. Il est possible |
13 tree, and a working directory. It is possible |
14 de mettre dans son répertoire de travail, une des versions issue de son entrepôt |
14 to put in its working directory, one of the versions of its local repository, |
15 local, de la modifier puis de la verser dans son entrepôt. Il est également |
15 modify and then push it in its repository. |
16 possible de récuprer dans son entrepôt local des révisions venant d'un autre |
16 It is also possible to get revisions from another repository or to export |
17 entrepôt, ou d'exporter ses propres révisions depuis son entrepôt local vers un |
17 its own revisions from the local repository to another repository. |
18 autre entrepôt. |
|
19 |
|
20 A noter que contrairement à CVS/Subversion, on crée généralement un entrepôt par |
|
21 projet à gérer. |
|
22 |
|
23 Lors d'un développement collaboratif, on crée généralement un entrepôt central |
|
24 accessible à tout les développeurs du projet. Ces entrepôts centraux servent de |
|
25 référence. Selon ses besoins, chacun peut ensuite disposer d'un entrepôt local, |
|
26 qu'il faudra penser à synchroniser avec l'entrepôt central de temps à autre. |
|
27 |
18 |
28 |
19 |
29 Principales commandes |
20 In contrast to CVS/Subversion, we usually create a repository by |
30 ````````````````````` |
21 project to manage. |
31 * Créer un entrepôt local :: |
|
32 |
22 |
33 hg clone ssh://orion//home/src/prive/rep |
23 In a collaborative development, we usually create a central repository |
34 |
24 accessible to all developers of the project. These central repository is used |
35 * Voir le contenu de l'entrepôt local (outil graphique en Tk) :: |
25 as a reference. According to its needs, then everyone can have a local repository, |
36 |
26 that you will have to synchronize with the central repository from time to time. |
37 hg view |
|
38 |
|
39 * Ajouter un sous-répertoire ou un fichier dans le répertoire courant :: |
|
40 |
|
41 hg add rep |
|
42 |
|
43 * Placer dans son répertoire de travail une révision spécifique (ou la dernière |
|
44 revision) issue de l'entrepôt local :: |
|
45 |
|
46 hg update [identifiant-revision] |
|
47 hg up [identifiant-revision] |
|
48 |
|
49 * Récupérer dans son entrepôt local, l'arbre de révisions contenu dans un |
|
50 entrepôt distant (cette opération ne modifie pas le répertoire local) :: |
|
51 |
|
52 hg pull ssh://orion//home/src/prive/rep |
|
53 hg pull -u ssh://orion//home/src/prive/rep # équivalent à pull + update |
|
54 |
|
55 * Voir quelles sont les têtes de branches de l'entrepôt local si un `pull` a |
|
56 tiré une nouvelle branche :: |
|
57 |
|
58 hg heads |
|
59 |
|
60 * Verser le répertoire de travail dans l'entrepôt local (et créer une nouvelle |
|
61 révision) :: |
|
62 |
|
63 hg commit |
|
64 hg ci |
|
65 |
|
66 * Fusionner, avec la révision mère du répertoire local, une autre révision issue |
|
67 de l'entrepôt local (la nouvelle révision qui en résultera aura alors deux |
|
68 révisions mères) :: |
|
69 |
|
70 hg merge identifiant-revision |
|
71 |
|
72 * Exporter dans un entrepôt distant, l'arbre de révisions contenu dans son |
|
73 entrepôt local (cette opération ne modifie pas le répertoire local) :: |
|
74 |
|
75 hg push ssh://orion//home/src/prive/rep |
|
76 |
|
77 * Voir quelle sont les révisions locales non présentes dans un autre entrepôt :: |
|
78 |
|
79 hg outgoing ssh://orion//home/src/prive/rep |
|
80 |
|
81 * Voir quelle sont les révisions d'un autre entrepôt non présentes localement :: |
|
82 |
|
83 hg incoming ssh://orion//home/src/prive/rep |
|
84 |
|
85 * Voir quelle est la révision issue de l'entrepôt local qui a été sortie dans le |
|
86 répertoire de travail et modifiée :: |
|
87 |
|
88 hg parent |
|
89 |
|
90 * Voir les différences entre le répertoire de travail et la révision mère de |
|
91 l'entrepôt local, éventuellement permettant de les verser dans l'entrepôt |
|
92 local :: |
|
93 |
|
94 hg diff |
|
95 hg commit-tool |
|
96 hg ct |
|
97 |
27 |
98 |
28 |
99 Bonnes pratiques |
29 Major commands |
100 ```````````````` |
30 `````````````` |
101 * penser à faire un `hg pull -u` régulièrement et particulièrement avant de |
31 * Create a local repository:: |
102 faire un `hg commit` |
|
103 |
32 |
104 * penser à faire un `hg push` lorsque votre entrepôt contient une version |
33 hg clone ssh://orion//home/src/private/rep |
105 relativement stable de vos modifications |
|
106 |
34 |
107 * si un `hg pull -u` a créé une nouvelle tête de branche : |
35 * See the contents of the local repository (graphical tool in Tk):: |
108 |
36 |
109 1. identifier l'identifiant de celle-ci avec `hg head` |
37 hgview |
110 2. fusionner avec `hg merge` |
|
111 3. `hg ci` |
|
112 4. `hg push` |
|
113 |
38 |
114 .. _Mercurial: http://www.selenic.com/mercurial/ |
39 * Add a sub-directory or file in the current directory:: |
|
40 |
|
41 hg add rep |
|
42 |
|
43 * Move to the working directory a specific revision (or last |
|
44 revision) from the local repository:: |
|
45 |
|
46 hg update [identifier-revision] |
|
47 hg up [identifier-revision] |
|
48 |
|
49 * Get in its local repository, the tree of revisions contained in a |
|
50 remote repository (this does not change the local directory):: |
|
51 |
|
52 hg pull ssh://orion//home/src/private/rep |
|
53 hg pull-u ssh://orion//home/src/private/rep # equivalent to pull + update |
|
54 |
|
55 * See what are the heads of branches of the local repository if a `pull` |
|
56 returned a new branch:: |
|
57 |
|
58 hg heads |
|
59 |
|
60 * Submit the working directory in the local repository (and create a new |
|
61 revision):: |
|
62 |
|
63 hg commit |
|
64 hg ci |
|
65 |
|
66 * Merge with the mother revision of local directory, another revision from |
|
67 the local respository (the new revision will be then two mothers |
|
68 revisions):: |
|
69 |
|
70 hg merge identifier-revision |
|
71 |
|
72 * Export to a remote repository, the tree of revisions in its content |
|
73 local respository (this does not change the local directory):: |
|
74 |
|
75 hg push ssh://orion//home/src/private/rep |
|
76 |
|
77 * See what local revisions are not in another repository:: |
|
78 |
|
79 hg outgoing ssh://orion//home/src/private/rep |
|
80 |
|
81 * See what are the revisions of a repository not found locally:: |
|
82 |
|
83 hg incoming ssh://orion//home/src/private/rep |
|
84 |
|
85 * See what is the revision of the local repository which has been taken out |
|
86 from the working directory and amended:: |
|
87 |
|
88 hg parent |
|
89 |
|
90 * See the differences between the working directory and the mother revision |
|
91 of the local repository, possibly to submit them in the local repository:: |
|
92 |
|
93 hg diff |
|
94 hg commit-tool |
|
95 hg ct |
|
96 |
|
97 |
|
98 Best Practices |
|
99 `````````````` |
|
100 * Think of making a `hg pull -u` regularly, and particularly before |
|
101 a `hg commit`. |
|
102 |
|
103 * Think of a `hg push` when your repository contains a version |
|
104 relatively stable of your changes. |
|
105 |
|
106 * If a `hg pull u` created a new branch head: |
|
107 |
|
108 1. identify its identifier with `hg head` |
|
109 2. merge with `hg merge` |
|
110 3. `hg ci` |
|
111 4. `hg push` |
|
112 |
115 |
113 |
116 .. include:: D061-mercurial-forest.en.txt |
114 .. include:: D061-mercurial-forest.en.txt |