<br><br><div class="gmail_quote">On Thu, Jul 2, 2009 at 13:42, Dirkjan Ochtman <span dir="ltr"><<a href="mailto:dirkjan@ochtman.nl">dirkjan@ochtman.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
In response to some rumblings on python-committers and just to request<br>
more feedback, a progress report. I know it's long, I've tried to put<br>
to keep it concise and chunked, though.<br>
<br>
- First of all, I've got the basic conversion down, I've done it a few<br>
times now, with progressively better results. You can view some<br>
results at <a href="http://hg.python.org/" target="_blank">http://hg.python.org/</a>, which has a preliminary cpython<br>
repository. *** The changeset hashes for that repo will change, so you<br>
won't be able to commit or pull from it in the future.***<br>
<br>
- Second of all, some planning. I've thought about it a bit, and I<br>
think we should aim for going live with hg on August 1. Given that I'm<br>
on vacation from 8-18 July (and I'm not sure whether I'll be able to<br>
actually work on it during that time, though I imagine I'll be able to<br>
spend some time on it at least), that's quite ambitious, so I'm going<br>
to say it's okay if it slips by a few days. Putting a deadline out<br>
there is a good thing, anyway.<br>
</blockquote><div><br></div><div>Fine by me as long as people realize that if anything is questionable then the switch will not happen. Getting this right takes precedence over any deadline. And obviously we will need to do at least one live conversion on <a href="http://python.org">python.org</a> hardware to make sure everything will work smoothly.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
- Third of all, to make this possible, it would be helpful if I got<br>
more feedback on the PEP. Last time I raised it, there was virtually<br>
nothing. This time, I'll include it inline so there's hopefully less<br>
of a barrier to reviewing it.<br>
<br>
- Fourth, Mercurial 1.3 was just released! Bet you didn't see that<br>
coming. It's looking like a pretty good release, with an experimental<br>
version of the much-coveted subrepository support (like<br>
svn:externals). This also means that the latest version of<br>
hgsubversion, the tool I used for the conversion, will be more<br>
accessible for converting other projects. You know you want to!<br>
</blockquote><div><br></div><div>And will make the idea of splitting out the standard library and tests a reasonable thing to do.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
- Fifth, here's a list of things, off the top of my head, that still need doing:<br>
<br>
* Get agreement on branch strategy and branch processing (list of<br>
branches + proposed handling at<br>
<a href="http://hg.python.org/pymigr/file/tip/all-branches.txt" target="_blank">http://hg.python.org/pymigr/file/tip/all-branches.txt</a>) <--- PLEASE<br>
REVIEW<br>
* Get agreement on tag processing (first come up with a list)<br>
* Set up hg-ssh infra (should be easy)<br>
* Set up hooks (should be mostly straightforward)<br>
* Set up roundup integration (should be made easier by quick revision<br>
map hgweb extension)<br>
* Write docs<br>
<br>
- Sixth (this is the good part), less obvious things that have been<br>
done or don't need doing:<br>
<br>
* .hgignore generation (I've been convinced it's too hard, the current<br>
version will do)</blockquote><div><br></div><div>Yeah, we can do this manually.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
* revlog reordering (it's painless and a big win)<br>
<br>
I'll get through all of these myself, but obviously any help would be<br>
welcome. For any hg users, writing docs should be an easy start. For<br>
others, please review the PEP (below), the branch map in<br>
<a href="http://hg.python.org/pymigr/file/tip/all-branches.txt" target="_blank">http://hg.python.org/pymigr/file/tip/all-branches.txt</a> and the author<br>
map at <a href="http://hg.python.org/pymigr/file/tip/author-map" target="_blank">http://hg.python.org/pymigr/file/tip/author-map</a> (not that much<br>
has changed since the start, so if you've looked at it already, feel<br>
free to skip this part). Right now I'm a little stuck on branch<br>
processing, because it's a long running script that needs a bunch of<br>
debugging, but I'll get going on that again.<br>
<br>
I think that's all I can think of for now, I'll update the PEP with<br>
new bits soon. Here it is, ready for your review:<br>
<br>
==============================================================<br>
<br>
Motivation<br>
<br>
After having decided to switch to the Mercurial DVCS, the actual<br>
migration still has to be performed. In the case of an important piece<br>
of infrastructure like the version control system for a large,<br>
distributed project like Python, this is a significant effort. This<br>
PEP is an attempt to describe the steps that must be taken for further<br>
discussion. It's somewhat similar to PEP 347 [1], which discussed the<br>
migration to SVN.<br>
<br>
To make the most of hg, I (Dirkjan) would like to make a high-fidelity<br>
conversion, such that (a) as much of the svn metadata as possible is<br>
retained, and (b) all metadata is converted to formats that are common<br>
in Mercurial. This way, tools written for Mercurial can be optimally<br>
used. In order to do this, I want to use the hgsubversion [2] software<br>
to do an initial conversion. This hg extension is focused on providing<br>
high-quality conversion from Subversion to Mercurial for use in<br>
two-way correspondence, meaning it doesn't throw away as much<br>
available metadata as other solutions.<br>
<br>
Such a conversion also seems like a good time to reconsider the<br>
contents of the repository and determine if some things are still<br>
valuable. In this spirit, the following sections also propose<br>
discarding some of the older metadata.<br>
Timeline<br>
<br>
TBD; needs fully working hgsubversion and consensus on this document.<br>
Transition plan<br>
Branch strategy<br>
<br>
Mercurial has two basic ways of using branches: cloned branches, where<br>
each branch is kept in a separate repository, and named branches,<br>
where each revision keeps metadata to note on which branch it belongs.<br>
The former makes it easier to distinguish branches, at the expense of<br>
requiring more disk space on the client. The latter makes it a little<br>
easier to switch between branches, but often has somewhat unintuitive<br>
results for people (though this has been getting better in recent<br>
versions of Mercurial).<br>
<br>
I'm still a bit on the fence about whether Python should adopt cloned<br>
branches and named branches. Since it usually makes more sense to tag<br>
releases on the maintenance branch, for example, mainline history<br>
would not contain release tags if we used cloned branches. Also,<br>
Mercurial 1.2 and 1.3 have the necessary tools to make named branches<br>
less painful (because they can be properly closed and closed heads are<br>
no longer considered in relevant cases).<br>
<br>
A disadvantage might be that the used clones will be a good bit larger<br>
(since they essentially contain all other branches as well). This can<br>
me mitigated by keeping non-release (feature) branches in separate<br>
clones. Also note that it's still possible to clone a single named<br>
branch from a combined clone, by specifying the branch as in hg clone<br>
<a href="http://hg.python.org/main/#2.6-maint" target="_blank">http://hg.python.org/main/#2.6-maint</a>. Keeping the py3k history in a<br>
separate clone problably also makes sense.<br>
</blockquote><div><br></div><div>While I really like the idea of using named branches for each release so that there is a single py3k branch that contains all relevant history for every release, I think we should start simple and go with cloned branches. That way the workflow does not radically shift from what we do now for svn to start. Once the conversion is done and people are comfortable with hg we can then discuss moving towards a named branch approach.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
XXX To do: size comparison for selected separation scenarios.<br>
Converting branches<br>
<br>
There are quite a lot of branches in SVN's branches directory. I<br>
propose to clean this up a bit, by employing the following the<br>
strategy:<br>
<br>
* Keep all release (maintenance) branches<br>
* Discard branches that haven't been touched in 18 months, unless<br>
somone indicates there's still interest in such a branch<br>
* Keep branches that have been touched in the last 18 months,<br>
unless someone indicates the branch can be deprecated<br>
</blockquote><div><br></div><div>Sounds reasonable to me. We can just make a list and send it to python-committers to make final decisions of what should stick around.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Converting tags<br>
<br>
The SVN tags directory contains a lot of old stuff. Some of these are<br>
not, in fact, full tags, but contain only a smaller subset of the<br>
repository. I think we should keep all release tags, and consider<br>
other tags for inclusion based on requests from the developer<br>
community. I'd like to consider unifying the release tag naming scheme<br>
to make some things more consistent, if people feel that won't create<br>
too many problems. For example, Mercurial itself just uses '1.2.1' as<br>
a tag, where CPython would currently use r121.</blockquote><div><br></div><div>I don't use tags so I don't really care, but in the name of easy transition I say we don't change the naming scheme (although I have no issue dropping obscure tags).</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
Author map<br>
<br>
In order to provide user names the way they are common in hg (in the<br>
'First Last <<a href="mailto:user@example.org">user@example.org</a>>' format), we need an author map to map<br>
cvs and svn user names to real names and their email addresses. I have<br>
a complete version of such a map in my migration tools repository [3].<br>
The email addresses in it might be out of date; that's bound to<br>
happen, although it would be nice to try and have as many people as<br>
possible review it for addresses that are out of date. The current<br>
version also still seems to contain some encoding problems.</blockquote><div><br></div><div>Something else that can go out to python-committers before the switch.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Generating .hgignore<br>
<br>
The .hgignore file can be used in Mercurial repositories to help<br>
ignore files that are not eligible for version control. It does this<br>
by employing several possible forms of pattern matching. The current<br>
Python repository already includes a rudimentary .hgignore file to<br>
help with using the hg mirrors.<br>
<br>
It might be useful to have the .hgignore be generated automatically<br>
from svn:ignore properties. This would make sure all historic<br>
revisions also have useful ignore information (though one could argue<br>
ignoring isn't really relevant to just checking out an old revision).</blockquote><div><br></div><div>Don't bother with anything automatic. We can change the .hgignore file by hand. We all know glob and regex syntax. =)</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
Revlog reordering<br>
<br>
As an optional optimization technique, we should consider trying a<br>
reordering pass on the revlogs (internal Mercurial files) resulting<br>
from the conversion. In some cases this results in dramatic decreases<br>
in on-disk repository size.</blockquote><div><br></div><div>Fine by me.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
Other repositories<br>
<br>
Richard Tew has indicated that he'd like the Stackless repository to<br>
also be converted. What other projects in the <a href="http://svn.python.org" target="_blank">svn.python.org</a><br>
repository should be converted? Do we want to convert the peps<br>
repository? distutils? others?</blockquote><div><br></div><div>I don't think there is a single project we host -- all two of them -- that have not said they want to convert. So I say convert everything and let's turn off the svn server by the end of the year.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
Infrastructure<br>
hg-ssh<br>
<br>
Developers should access the repositories through ssh, similar to the<br>
current setup. Public keys can be used to grant people access to a<br>
shared hg@ account. A hgwebdir instance should also be set up for easy<br>
browsing and read-only access. If we're using ssh, developers should<br>
trivially be able to start new clones (for longer-term features that<br>
profit from a separate branch).<br>
Hooks<br>
<br>
A number of hooks is currently in use. The hg equivalents for these<br>
should be developed and deployed. The following hooks are being used:<br>
<br>
* check whitespace: a hook to reject commits in case the<br>
whitespace doesn't match the rules for the Python codebase. Should be<br>
straightforward to re-implement from the current version. We can also<br>
offer a whitespace hook for use with client-side repositories that<br>
people can use; it could either warn about whitespace issues and/or<br>
truncate trailing whitespace from changed lines. Open issue: do we<br>
check only the tip after each push, or do we check every commit in a<br>
changegroup?<br>
* commit mails: we can leverage the notify extension for this<br>
* buildbots: both the regular and the community build masters must<br>
be notified. Fortunately buildbot includes support for hg. I've also<br>
implemented this for Mercurial itself, so I don't expect problems<br>
here.<br>
* check contributors: in the current setup, all changesets bear<br>
the username of committers, who must have signed the contributor<br>
agreement. In a DVCS, the committers are not necessarily the same<br>
people who push, and so we can't check if the committer is a<br>
contributor. We could use a hook to check if the committer is a<br>
contributor if we keep a list of registered contributors.</blockquote><div><br></div><div>Can we check these scripts into the repository itself? That way there is a chance of reuse as hg commands, e.g. ``hg pydev-ci`` as a replacement for ``make patchcheck``.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
<br>
hgwebdir<br>
<br>
A more or less stock hgwebdir installation should be set up. We might<br>
want to come up with a style to match the Python website. It may also<br>
be useful to build a quick extension to augment the URL rev parser so<br>
that it can also take r[0-9]+ args and come up with the matching hg<br>
revision.<br>
After migration<br>
Where to get code<br>
<br>
It needs to be decided where the hg repositories will live. I'd like<br>
to propose to keep the hgwebdir instance at <a href="http://hg.python.org" target="_blank">hg.python.org</a>. This is an<br>
accepted standard for many organizations, and an easy parallel to<br>
<a href="http://svn.python.org" target="_blank">svn.python.org</a>. The 2.7 (trunk) repo might live at<br>
<a href="http://hg.python.org/main/" target="_blank">http://hg.python.org/main/</a>, for example, with py3k at<br>
<a href="http://hg.python.org/py3k/" target="_blank">http://hg.python.org/py3k/</a>. For write access, developers will have to<br>
use ssh, which could be ssh://<a href="http://hg@hg.python.org/main/" target="_blank">hg@hg.python.org/main/</a>. A demo<br>
installation will be set up with a preliminary conversion so people<br>
can experiment and review; it can live at<br>
<a href="http://hg.python.org/example/" target="_blank">http://hg.python.org/example/</a>.<br>
<br>
<a href="http://code.python.org" target="_blank">code.python.org</a> was also proposed as the hostname. Personally, I think<br>
that using the VCS name in the hostname is good because it prevents<br>
confusion: it should be clear that you can't use svn or bzr for<br>
<a href="http://hg.python.org" target="_blank">hg.python.org</a>.<br>
</blockquote><div><br></div><div>How about <a href="http://hg.python.org">hg.python.org</a> for the official branches and we keep <a href="http://code.python.org">code.python.org</a> for personal branches of the developers like we have done with the bzr experiments?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
hgwebdir can already provide tarballs for every changeset. I think<br>
this obviates the need for daily snapshots; we can just point users to<br>
tip.tar.gz instead, meaning they will get the latest. If desired, we<br>
could even use buildbot results to point to the last good changeset.</blockquote><div><br></div><div>I like the stable buildbot tarball idea.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Python-specific documentation<br>
<br>
hg comes with good built-in documentation (available through hg help)<br>
and a wiki [4] that's full of useful information and recipes. In<br>
addition to that, the parts of the developer FAQ [5] concerning<br>
version control will gain a section on using hg for Python<br>
development. Some of the text will be dependent on the outcome of<br>
debate about this PEP (for example, the branching strategy).<br>
<br>
Think first, commit later?<br>
<br>
In recent history, old versions of Python have been maintained by a<br>
select group of people backporting patches from trunk to release<br>
branches. While this may not scale so well as the development pace<br>
grows, it also runs into some problems with the current crop of<br>
distributed versioning tools. These tools (I believe similar problems<br>
would exist for either git, bzr, or hg, though some may cope better<br>
than others) are based on the idea of a Directed Acyclic Graph (or<br>
DAG), meaning they keep track of relations of changesets.<br>
<br>
Mercurial itself has a stable branch which is a ''strict'' subset of<br>
the unstable branch. This means that generally all fixes for the<br>
stable branch get committed against the tip of the stable branch, then<br>
they get merged into the unstable branch (which already contains the<br>
parent of the new cset). This provides a largely frictionless<br>
environment for moving changes from stable to unstable branches.<br>
Mistakes, where a change that should go on stable goes on unstable<br>
first, do happen, but they're usually easy to fix. That can be done by<br>
copying the change over to the stable branch, then trivial-merging<br>
with unstable -- meaning the merge in fact ignores the parent from the<br>
stable branch).<br>
<br>
This strategy means a little more work for regular committers, because<br>
they have to think about whether their change should go on stable or<br>
unstable; they may even have to ask someone else (the RM) before<br>
committing. But it also relieves a dedicated group of committers of<br>
regular backporting duty, in addition to making it easier to work with<br>
the tool.<br>
<br>
Now would be a good time to consider changing strategies in this<br>
regard, although it would be relatively easy to switch to such a model<br>
later on.</blockquote><div><br></div><div>As I have said, we should change our workflow habits after the switch and people are comfortable with hg.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
The future of Subversion<br>
<br>
What happens to the Subversion repositories after the migration? Since<br>
the svn server contains a bunch of repositories, not just the CPython<br>
one, it will probably live on for a bit as not every project may want<br>
to migrate or it takes longer for other projects to migrate. To<br>
prevent people from staying behind, we may want to remove migrated<br>
projects from the repository.<br>
Build identification<br>
<br>
Python currently provides the sys.subversion tuple to allow Python<br>
code to find out exactly what version of Python it's running against.<br>
The current version looks something like this:<br>
<br>
* ('CPython', 'tags/r262', '71600')<br>
* ('CPython', 'trunk', '73128M')<br>
<br>
Another value is returned from Py_GetBuildInfo() in the C API, and<br>
available to Python code as part of sys.version:<br>
<br>
* 'r262:71600, Jun 2 2009, 09:58:33'<br>
* 'trunk:73128M, Jun 2 2009, 01:24:14'<br>
<br>
I propose that the revision identifier will be the short version of<br>
hg's revision hash, for example 'dd3ebf81af43', augmented with '+'<br>
(instead of 'M') if the working directory from which it was built was<br>
modified. This mirrors the output of the hg id command, which is<br>
intended for this kind of usage.<br>
<br>
For the tag/branch identifier, I propose that hg will check for tags<br>
on the currently checked out revision, use the tag if there is one<br>
('tip' doesn't count), and uses the branch name otherwise.<br>
sys.subversion becomes<br>
<br>
* ('CPython', '2.6.2', 'dd3ebf81af43')<br>
* ('CPython', 'default', 'af694c6a888c+')<br>
<br>
and the build info string becomes<br>
<br>
* '2.6.2:dd3ebf81af43, Jun 2 2009, 09:58:33'<br>
* 'default:af694c6a888c+, Jun 2 2009, 01:24:14'<br>
<br>
This reflects that the default branch in hg is called 'default'<br>
instead of Subversion's 'trunk', and reflects the proposed new tag<br>
format.</blockquote><div><br></div><div>Should we consider adding a sys.revision attribute and begin the deprecation of sys.subversion?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
References<br>
[1] <a href="http://www.python.org/dev/peps/pep-0347/" target="_blank">http://www.python.org/dev/peps/pep-0347/</a><br>
[2] <a href="http://bitbucket.org/durin42/hgsubversion/" target="_blank">http://bitbucket.org/durin42/hgsubversion/</a><br>
[3] <a href="http://hg.xavamedia.nl/cpython/pymigr/" target="_blank">http://hg.xavamedia.nl/cpython/pymigr/</a><br>
[4] <a href="http://www.selenic.com/mercurial/wiki/" target="_blank">http://www.selenic.com/mercurial/wiki/</a><br>
[5] <a href="http://www.python.org/dev/faq/#version-control" target="_blank">http://www.python.org/dev/faq/#version-control</a><br>
<br>
=====================================================<br>
<br>
Cheers,<br>
<br>
Dirkjan<br>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-dev" target="_blank">http://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="http://mail.python.org/mailman/options/python-dev/brett%40python.org" target="_blank">http://mail.python.org/mailman/options/python-dev/brett%40python.org</a><br>
</blockquote></div><br>