Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
en:cookbook:advancedhg [2011/01/19 21:39] gokhlayeh created |
en:cookbook:advancedhg [2015/11/26 21:16] llev [Basic functionality of MQ] |
||
---|---|---|---|
Line 3: | Line 3: | ||
==== Use an external tool to merge ==== | ==== Use an external tool to merge ==== | ||
- | If you want to use tools presented on this page, particulary MQ, had a tool to manage merges (when several commits overwhrite each other and you have to edit the result manually) will probably usefull to you. SliTaz propose Meld, a light software which do that well. After installation, tell to Mercurial to use it if necessary by putting in ~/.hgrc : | + | If you want to use tools presented on this page, MQ particularly has a tool to manage merges (when several commits overwrite each other and you have to edit the result manually) which will probably be useful to you. SliTaz proposes Meld, a light software that can do that well. After installation, tell Mercurial to use it if necessary by putting it in your ~/.hgrc: |
<code> | <code> | ||
Line 10: | Line 10: | ||
</code> | </code> | ||
- | ==== Usefull extensions ==== | + | ==== Useful extensions ==== |
- | To add an extension, you can use the ~/.hgrc file; Syntax is: | + | To add an extension, you can use the ~/.hgrc file: |
<code> | <code> | ||
[extensions] | [extensions] | ||
name = adress | name = adress | ||
</code> | </code> | ||
- | Some extensions are packed with Mercurial, so it's not necessary to give them adresse. It's the case of the four following: | + | Some extensions are packed within Mercurial, so it's not necessary to give them addressess. It's the case of the four following: |
**color** | **color** | ||
- | Add color in Mercurial. Usefull when displaying difference between several versions of a file. | + | Add color in Mercurial. Useful when displaying differences between several versions of a file. |
**hgext.fetch** | **hgext.fetch** | ||
- | Add the command hg fetch, which regroup hg pull && hg merge && hg update. | + | Add the command hg fetch, which regroups hg pull && hg merge && hg update. |
**hgext.graphlog** | **hgext.graphlog** | ||
- | Add the command glog, which display the revision tree along the log. It's advised to limit the lenght of the log with option -l (i.e.: -l 10). Option -p display the detail of differences introducted at each commit. | + | Add the command glog, which displays the revision tree along with the log. It's advised to limit the length of the log with option -l (i.e.: -l 10). Option -p displays the detail of differences introduced at each commit. |
**mq** | **mq** | ||
- | This tool his explained in details bellow. It allow to manage a patch-list for a Mercurial repository: apply them, unapply, update, etc. This extension add several commands, which generally start by 'q'. Some webpages details this tool, search: mercurial mq. | + | This tool is explained in detail below. It allows you to manage a patch-list for a Mercurial repository: apply them, unapply, update, etc. This extension adds several commands which generally start with 'q'. Some webpages detail this tool, search: mercurial mq. |
- | ==== Base functionnalities of MQ ==== | + | ==== Basic functionality of MQ ==== |
- | In a mercurial repository, create a patch repository with controled revision; It's a repository of patch into which the changes can be commited using Mercurial, like a repository in a repository: | + | In a mercurial repository, create a patch repository with a controlled revision; it's a repository of patches into which the changes can be committed using Mercurial, like a repository within a repository: |
<code>hg qinit -c</code> | <code>hg qinit -c</code> | ||
- | Après avoir procédé à des modifications, les enregistrer en temps que patch plutôt que les commiter : | + | After modifications, save them as a patch instead of committing them: |
- | After modifications, save them as a patch instead of commit them: | + | |
<code>hg qnew nom_du_patch</code> | <code>hg qnew nom_du_patch</code> | ||
Line 58: | Line 57: | ||
<code>hg qpop -a</code> | <code>hg qpop -a</code> | ||
- | Goto a given patch in the queue: | + | Go to a given patch in the queue: |
<code>hg qgoto patch</code> | <code>hg qgoto patch</code> | ||
- | Add a message to the current patch (before commit it): | + | Add a message to the current patch (before committing it): |
<code>hg qrefresh -m "Message"</code> | <code>hg qrefresh -m "Message"</code> | ||
- | Transform a patch into commit: | + | Transform a patch into a commit: |
<code>hg qfinish patch</code> | <code>hg qfinish patch</code> | ||
Line 70: | Line 69: | ||
<code>hg qcommit -m "Message de commit"</code> | <code>hg qcommit -m "Message de commit"</code> | ||
- | Note: Patches are saved into .hg/patches. The file .hg/patches/series can be manually edited to change the application order of the patches; but take care if several patches having the same target file: it can create problems. | + | Note: Patches are saved into .hg/patches. The file .hg/patches/series can be manually edited to change the application order of the patches; but take care if several patches have the same target file: it can create problems. |
==== MQ & Merge ==== | ==== MQ & Merge ==== | ||
Line 76: | Line 75: | ||
**General idea** | **General idea** | ||
- | Patches can be updated using the merge tool of Mercurial: it's easier than edit them manually. To do this, it's necessary to have two heads in the repository. One being the repository with patches applied ontop; the other the repository with th new commits/update/etc: | + | Patches can be updated using the merge tool of Mercurial: it's easier than editing them manually. To do this, it's necessary to have two heads in the repository. One being the repository with patches applied ontop; the other the repository with the new commits/updates/etc: |
<code> | <code> | ||
Line 89: | Line 88: | ||
</code> | </code> | ||
- | The patches branch will next be merged into the new branch, and MQ will use the merge function from Mercurial to update the patches. Please note that using an external merge tool (as meld proposed previously) is highly recommended. | + | The patches branch will next be merged into the new branch and MQ will use the merge function from Mercurial to update the patches. Please note that using an external merge tool (such as meld proposed previously) is highly recommended. |
- | Create the head patches : | + | Create the head patches: |
<code> | <code> | ||
qpush -a | qpush -a | ||
Line 100: | Line 99: | ||
Create the new head: | Create the new head: | ||
<code> | <code> | ||
- | hg update -C <N°qparent> # Goto the revision noted before. | + | hg update -C <N°qparent> # Go to the revision noted before. |
# Next, do what you planned to: | # Next, do what you planned to: | ||
# Update: | # Update: | ||
hg pull -u | hg pull -u | ||
- | # Commiter new changes, make the modifications then: | + | # Commit new changes, make the modifications then: |
hg commit -m "message" | hg commit -m "message" | ||
# Edit a patch: | # Edit a patch: |