Tip 1 -- merging heads:<br><br>A while ago Éric suggested a nice tip to make merges easier and since
I haven't seen many people using it and now I got a chance to use it
again, I think it might be worth showing it once more:<br><br># so assume you just committed some changes:<br>$ hg ci Doc/whatsnew/3.3.rst -m 'Update and reorganize the whatsnew entry for PEP 393.'<br># you push them, but someone else pushed something in the meanwhile, so the push fails<br>
$ hg push<br>pushing to ssh://<a href="http://hg@hg.python.org/cpython">hg@hg.python.org/cpython</a><br>searching for changes<br>abort: push creates new remote heads on branch 'default'!<br>(you should pull and merge or use push -f to force)<br>
# so you pull the other changes<br>$ hg pull -u<br>pulling from ssh://<a href="http://hg@hg.python.org/cpython">hg@hg.python.org/cpython</a><br>searching for changes<br>adding changesets<br>adding manifests<br>adding file changes<br>
added 4 changesets with 5 changes to 5 files (+1 heads)<br>not updating, since new heads added<br>(run 'hg heads' to see heads, 'hg merge' to merge)<br># and use "hg heads ." to see the two heads (yours and the one you pulled) in the current branch<br>
$ hg heads .<br>changeset: 72521:e6a2b54c1d16<br>tag: tip<br>user: Victor Stinner <<a href="mailto:victor.stinner@haypocalc.com">victor.stinner@haypocalc.com</a>><br>date: Thu Sep 29 04:02:13 2011 +0200<br>
summary: Fix hex_digit_to_int() prototype: expect Py_UCS4, not Py_UNICODE<br><br>changeset: 72517:ba6ee5cc9ed6<br>user: Ezio Melotti <<a href="mailto:ezio.melotti@gmail.com">ezio.melotti@gmail.com</a>><br>
date: Thu Sep 29 08:34:36 2011 +0300<br>summary: Update and reorganize the whatsnew entry for PEP 393.<br># here comes the tip: before merging you switch to the other head (i.e. the one pushed by Victor),<br># if you don't switch, you'll be merging Victor changeset and in case of conflicts you will have to review<br>
# and modify his code (e.g. put a Misc/NEWS entry in the right section or something more complicated)<br>$ hg up e6a2b54c1d16<br>6 files updated, 0 files merged, 0 files removed, 0 files unresolved<br># after the switch you will merge the changeset you just committed, so in case of conflicts<br>
# reviewing and merging is much easier because you know the changes already<br>$ hg merge<br>1 files updated, 0 files merged, 0 files removed, 0 files unresolved<br>(branch merge, don't forget to commit)<br># here everything went fine and there were no conflicts, and in the diff I can see my last changeset<br>
$ hg di<br>diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst<br>[...]<br># everything looks fine, so I can commit the merge and push<br>$ hg ci -m 'Merge heads.'<br>$ hg push<br>pushing to ssh://<a href="http://hg@hg.python.org/cpython">hg@hg.python.org/cpython</a><br>
searching for changes<br>remote: adding changesets <br>remote: adding manifests<br>
remote: adding file changes<br>remote: added 2 changesets with 1 changes to 1 files<br>remote: buildbot: 2 changes sent successfully<br>remote: notified <a href="mailto:python-checkins@python.org">python-checkins@python.org</a> of incoming changeset ba6ee5cc9ed6<br>
remote: notified <a href="mailto:python-checkins@python.org">python-checkins@python.org</a> of incoming changeset e7672fe3cd35<br><br>This tip is not only useful while merging, but it's also useful for python-checkins reviews, because the "merge" mail has the same diff of the previous mail rather than having 15 unrelated changesets from the last week because the committer didn't pull in a while.<br>
<br><br>Tip 2 -- extended diffs:<br><br>If you haven't already, enable git diffs, adding to your ~/.hgrc the following two lines:<br><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">
[diff]<br>git = True<br></blockquote><div>(this is already in the devguide, even if 'git = on' is used there. The mercurial website uses git = True too.) <br></div><div>More info: <a href="http://hgtip.com/tips/beginner/2009-10-22-always-use-git-diffs/">http://hgtip.com/tips/beginner/2009-10-22-always-use-git-diffs/</a><br>
<br><br>Tip 3 -- extensions:<br><br>I personally like the 'color' extension, it makes the output of commands like 'hg diff' and 'hg stat' more readable (e.g. it shows removed lines in red and added ones in green).<br>
If you want to give it a try, add to your ~/.hgrc the following two lines:<br><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">[extensions]<br>
color =<br></blockquote><br>If you find operations like pulling, updating or cloning too slow, you might also want to look at the 'progress' extension, which displays a progress bar during these operations:<br><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">
[extensions]<br>
progress =<br></blockquote></div><br><br>Tip 4 -- porting from 2.7 to 3.2:<br><br>The devguide suggests:<blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">
hg export a7df1a869e4a | hg import --no-commit -<br></blockquote><div>but it's not always necessary to copy the changeset number manually.<br>If you are porting your last commit you can just use 'hg export 2.7' (or any other branch name):<br>
* using the one-dir-per-branch setup:<br> wolf@hp:~/dev/py/2.7$ hg ci -m 'Fix some bug.'<br> wolf@hp:~/dev/py/2.7$ cd ../3.2<br> wolf@hp:~/dev/py/3.2$ hg pull -u ../2.7<br> wolf@hp:~/dev/py/3.2$ hg export 2.7 | hg import --no-commit -<br>
* using the single-dir setup:<br> wolf@hp:~/dev/python$ hg branch<br> 2.7<br> wolf@hp:~/dev/python$ hg ci -m 'Fix some bug.' <br> wolf@hp:~/dev/python$ hg up 3.2 # here you might enjoy the progress extension<br>
wolf@hp:~/dev/python$ hg export 2.7 | hg import --no-commit -<br>And then you can check that everything is fine, and commit on 3.2 too.<br>Of course it works the other way around (from 3.2 to 2.7) too.<br><br></div><br>
I hope you'll find these tips useful.<br><br>Best Regards,<br>Ezio Melotti<br><br><br><div class="gmail_quote">On Thu, Sep 29, 2011 at 8:36 AM, ezio.melotti <span dir="ltr"><<a href="mailto:python-checkins@python.org">python-checkins@python.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><a href="http://hg.python.org/cpython/rev/e7672fe3cd35" target="_blank">http://hg.python.org/cpython/rev/e7672fe3cd35</a><br>
changeset: 72522:e7672fe3cd35<br>
parent: 72520:e6a2b54c1d16<br>
parent: 72521:ba6ee5cc9ed6<br>
user: Ezio Melotti <<a href="mailto:ezio.melotti@gmail.com">ezio.melotti@gmail.com</a>><br>
date: Thu Sep 29 08:36:23 2011 +0300<br>
summary:<br>
Merge heads.<br>
<br>
files:<br>
Doc/whatsnew/3.3.rst | 63 +++++++++++++++++++++----------<br>
1 files changed, 42 insertions(+), 21 deletions(-)<br>
<br></blockquote></div><br>