2009-05-25 10:53:48 -04:00
|
|
|
|
PEP: 385
|
2011-02-25 13:30:02 -05:00
|
|
|
|
Title: Migrating from Subversion to Mercurial
|
2009-06-04 14:11:38 -04:00
|
|
|
|
Version: $Revision$
|
|
|
|
|
Last-Modified: $Date$
|
2011-02-25 13:30:02 -05:00
|
|
|
|
Author: Dirkjan Ochtman <dirkjan@ochtman.nl>,
|
|
|
|
|
Antoine Pitrou <solipsis@pitrou.net>,
|
|
|
|
|
Georg Brandl <georg@python.org>
|
2012-02-10 08:10:37 -05:00
|
|
|
|
Status: Final
|
2009-05-25 10:53:48 -04:00
|
|
|
|
Type: Process
|
|
|
|
|
Content-Type: text/x-rst
|
|
|
|
|
Created: 25-May-2009
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Motivation
|
|
|
|
|
==========
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
After having decided to switch to the Mercurial DVCS, the actual
|
|
|
|
|
migration still has to be performed. In the case of an important
|
|
|
|
|
piece of infrastructure like the version control system for a large,
|
|
|
|
|
distributed project like Python, this is a significant effort. This
|
|
|
|
|
PEP is an attempt to describe the steps that must be taken for further
|
|
|
|
|
discussion. It's somewhat similar to `PEP 347`_, which discussed the
|
|
|
|
|
migration to SVN.
|
2009-05-25 10:53:48 -04:00
|
|
|
|
|
2011-02-25 13:30:02 -05:00
|
|
|
|
To make the most of hg, we would like to make a high-fidelity
|
2009-05-25 10:53:48 -04:00
|
|
|
|
conversion, such that (a) as much of the svn metadata as possible is
|
2010-11-19 12:12:24 -05:00
|
|
|
|
retained, and (b) all metadata is converted to formats that are common
|
|
|
|
|
in Mercurial. This way, tools written for Mercurial can be optimally
|
2011-02-25 13:30:02 -05:00
|
|
|
|
used. In order to do this, we want to use the `hgsubversion`_
|
|
|
|
|
software to do an initial conversion. This hg extension is focused on
|
2010-11-19 12:12:24 -05:00
|
|
|
|
providing high-quality conversion from Subversion to Mercurial for use
|
|
|
|
|
in two-way correspondence, meaning it doesn't throw away as much
|
|
|
|
|
available metadata as other solutions.
|
|
|
|
|
|
|
|
|
|
Such a conversion also seems like a good time to reconsider the
|
|
|
|
|
contents of the repository and determine if some things are still
|
|
|
|
|
valuable. In this spirit, the following sections also propose
|
|
|
|
|
discarding some of the older metadata.
|
2009-05-25 10:53:48 -04:00
|
|
|
|
|
|
|
|
|
.. _PEP 347: http://www.python.org/dev/peps/pep-0347/
|
|
|
|
|
.. _hgsubversion: http://bitbucket.org/durin42/hgsubversion/
|
|
|
|
|
|
|
|
|
|
|
2009-06-05 12:49:40 -04:00
|
|
|
|
Timeline
|
|
|
|
|
========
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
The current schedule for conversion milestones:
|
|
|
|
|
|
2011-02-25 13:30:02 -05:00
|
|
|
|
- 2011-02-24: availability of a test repo at hg.python.org
|
2010-11-19 12:12:24 -05:00
|
|
|
|
|
|
|
|
|
Test commits will be allowed (and encouraged) from all committers to
|
|
|
|
|
the Subversion repository. The test repository and all test commits
|
|
|
|
|
will be removed once the final conversion is done. The server-side
|
|
|
|
|
hooks will be installed for the test repository, in order to test
|
|
|
|
|
buildbot, diff-email and whitespace checking integration.
|
|
|
|
|
|
2011-03-01 10:05:57 -05:00
|
|
|
|
- 2011-03-05: final conversion (tentative)
|
2010-11-19 12:12:24 -05:00
|
|
|
|
|
|
|
|
|
Commits to the Subversion branches now maintained in Mercurial will
|
|
|
|
|
be blocked. Developers should refrain from pushing to the Mercurial
|
|
|
|
|
repositories until all infrastructure is ensured to work after their
|
|
|
|
|
switch over to the new repository.
|
|
|
|
|
|
|
|
|
|
|
2009-05-25 10:53:48 -04:00
|
|
|
|
Transition plan
|
|
|
|
|
===============
|
|
|
|
|
|
|
|
|
|
Branch strategy
|
|
|
|
|
---------------
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
Mercurial has two basic ways of using branches: cloned branches, where
|
|
|
|
|
each branch is kept in a separate repository, and named branches,
|
|
|
|
|
where each revision keeps metadata to note on which branch it belongs.
|
|
|
|
|
The former makes it easier to distinguish branches, at the expense of
|
|
|
|
|
requiring more disk space on the client. The latter makes it a little
|
2011-02-25 13:30:02 -05:00
|
|
|
|
easier to switch between branches, but all branch names are a
|
|
|
|
|
persistent part of history. [1]_
|
2009-08-03 07:38:44 -04:00
|
|
|
|
|
|
|
|
|
Differences between named branches and cloned branches:
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
* Tags in a different (maintenance) clone aren't available in the
|
|
|
|
|
local clone
|
|
|
|
|
* Clones with named branches will be larger, since they contain more
|
|
|
|
|
data
|
2009-08-03 07:38:44 -04:00
|
|
|
|
|
2011-02-25 13:30:02 -05:00
|
|
|
|
We propose to use named branches for release branches and adopt cloned
|
|
|
|
|
branches for feature branches.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
History management
|
|
|
|
|
------------------
|
|
|
|
|
|
|
|
|
|
In order to minimize the loss of information due to the conversion, we
|
|
|
|
|
propose to provide several repositories as a conversion result:
|
|
|
|
|
|
|
|
|
|
* A repository trimmed to the mainline trunk (and py3k), as well as
|
|
|
|
|
past and present maintenance branches -- this is called the
|
2011-02-25 13:52:39 -05:00
|
|
|
|
"working" repo and is where development continues. This repository has
|
|
|
|
|
all the history needed for development work, including annotating
|
|
|
|
|
source files with changes back up to 1990 and other common history-digging
|
|
|
|
|
operations.
|
2009-05-25 10:53:48 -04:00
|
|
|
|
|
2011-02-25 13:30:02 -05:00
|
|
|
|
The ``default`` branch in that repo is what is known as ``py3k`` in
|
|
|
|
|
Subversion, while the Subversion trunk lives on with the branch name
|
2011-02-28 13:26:58 -05:00
|
|
|
|
``legacy-trunk``; however in Mercurial this branch will be closed.
|
|
|
|
|
Release branches are named after their major.minor version, e.g. ``3.2``.
|
2009-05-25 10:53:48 -04:00
|
|
|
|
|
2011-02-25 13:52:39 -05:00
|
|
|
|
* A repository with the full, unedited conversion of the Subversion
|
|
|
|
|
repository (actually, its /python subdirectory) -- this is called
|
|
|
|
|
the "historic" or "archive" repo and will be offered as a read-only
|
|
|
|
|
resource. [2]_
|
|
|
|
|
|
2011-02-25 13:30:02 -05:00
|
|
|
|
* One more repository per active feature branch; "active" means that
|
2011-02-25 13:52:39 -05:00
|
|
|
|
at least one core developer asks for the branch to be provided. Each
|
|
|
|
|
such repository will contain both the feature branch and all ancestor
|
|
|
|
|
changesets from mainline (coming from ``trunk`` and/or ``py3k`` in SVN).
|
2009-05-25 10:53:48 -04:00
|
|
|
|
|
2011-02-25 13:52:39 -05:00
|
|
|
|
Since all branches are present in the historic repo, they can later be
|
|
|
|
|
extracted as separate repositories at any time should it prove to be
|
|
|
|
|
necessary.
|
2009-05-25 10:53:48 -04:00
|
|
|
|
|
2011-02-25 13:57:09 -05:00
|
|
|
|
The final revision map between SVN revision numbers, Mercurial changesets
|
|
|
|
|
and SVN branch names will be made available in a file stored in the ``Misc``
|
|
|
|
|
directory. Its format is as following::
|
|
|
|
|
|
|
|
|
|
[...]
|
|
|
|
|
88483 e65daae6cf4499a0863cb7645109a4798c28d83e issue10276-snowleopard
|
|
|
|
|
88484 835cb57abffeceaff0d85c2a3aa0625458dd3e31 py3k
|
|
|
|
|
88485 d880f9d8492f597a030772c7485a34aadb6c4ece release32-maint
|
|
|
|
|
88486 0c431b8c22f5dbeb591414c154acb7890c1809df py3k
|
|
|
|
|
88487 82cda1f21396bbd10db8083ea20146d296cb630b release32-maint
|
|
|
|
|
88488 8174d00d07972d6f109ed57efca8273a4d59302c release27-maint
|
|
|
|
|
[...]
|
|
|
|
|
|
|
|
|
|
|
2009-05-25 10:53:48 -04:00
|
|
|
|
Converting tags
|
|
|
|
|
---------------
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
The SVN tags directory contains a lot of old stuff. Some of these are
|
|
|
|
|
not, in fact, full tags, but contain only a smaller subset of the
|
|
|
|
|
repository. All release tags will be kept; other tags will be
|
2011-02-25 13:30:02 -05:00
|
|
|
|
included based on requests from the developer community. We propose
|
|
|
|
|
to make the tag naming scheme consistent, in this style: ``v3.2.1a2``.
|
|
|
|
|
|
2009-05-25 10:53:48 -04:00
|
|
|
|
|
|
|
|
|
Author map
|
|
|
|
|
----------
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
In order to provide user names the way they are common in hg (in the
|
|
|
|
|
'First Last <user@example.org>' format), we need an author map to map
|
2011-02-25 13:30:02 -05:00
|
|
|
|
cvs and svn user names to real names and their email addresses. We
|
2012-03-04 08:32:42 -05:00
|
|
|
|
have a complete version of such a map in the migration tools
|
|
|
|
|
repository (not publicly accessible to avoid leaking addresses to
|
|
|
|
|
harvesters). The email addresses in it might be out of date; that's
|
2010-11-19 12:12:24 -05:00
|
|
|
|
bound to happen, although it would be nice to try and have as many
|
|
|
|
|
people as possible review it for addresses that are out of date. The
|
|
|
|
|
current version also still seems to contain some encoding problems.
|
2009-05-25 10:53:48 -04:00
|
|
|
|
|
2011-02-25 13:30:02 -05:00
|
|
|
|
|
2009-05-25 10:53:48 -04:00
|
|
|
|
Generating .hgignore
|
|
|
|
|
--------------------
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
The .hgignore file can be used in Mercurial repositories to help
|
|
|
|
|
ignore files that are not eligible for version control. It does this
|
|
|
|
|
by employing several possible forms of pattern matching. The current
|
|
|
|
|
Python repository already includes a rudimentary .hgignore file to
|
|
|
|
|
help with using the hg mirrors.
|
2009-05-25 10:53:48 -04:00
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
Since the current Python repository already includes a .hgignore file
|
|
|
|
|
(for use with hg mirrors), we'll just use that. Generating full
|
|
|
|
|
history of the file was debated but deemed impractical (because it's
|
|
|
|
|
relatively hard with fairly little gain, since ignoring is less
|
|
|
|
|
important for older revisions).
|
2009-05-25 10:53:48 -04:00
|
|
|
|
|
|
|
|
|
|
2011-02-25 13:30:02 -05:00
|
|
|
|
Repository size
|
|
|
|
|
---------------
|
|
|
|
|
|
|
|
|
|
A bare conversion result of the current Python repository weighs 1.9
|
|
|
|
|
GB; although this is smaller than the Subversion repository (2.7 GB)
|
|
|
|
|
it is not feasible.
|
|
|
|
|
|
|
|
|
|
The size becomes more manageable by the trimming applied to the
|
|
|
|
|
working repository, and by a process called "revlog reordering" that
|
|
|
|
|
optimizes the layout of internal Mercurial storage very efficiently.
|
|
|
|
|
|
|
|
|
|
After all optimizations done, the size of the working repository is
|
|
|
|
|
around 180 MB on disk. The amount of data transferred over the
|
|
|
|
|
network when cloning is estimated to be around 80 MB.
|
|
|
|
|
|
2009-05-25 10:53:48 -04:00
|
|
|
|
|
|
|
|
|
Other repositories
|
|
|
|
|
------------------
|
|
|
|
|
|
2011-02-25 13:30:02 -05:00
|
|
|
|
There are a number of other projects hosted in svn.python.org's
|
|
|
|
|
"projects" repository. The "peps" directory will be converted along
|
|
|
|
|
with the main Python one. Richard Tew has indicated that he'd like the
|
|
|
|
|
Stackless repository to also be converted. What other projects in the
|
|
|
|
|
svn.python.org repository should be converted?
|
2009-05-25 10:53:48 -04:00
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
There's now an initial stab at converting the Jython repository. The
|
|
|
|
|
current tip of hgsubversion unfortunately fails at some point.
|
|
|
|
|
Pending investigation.
|
2009-08-03 07:38:44 -04:00
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
Other repositories that would like to converted to Mercurial can
|
|
|
|
|
announce themselves to me after the main Python migration is done, and
|
|
|
|
|
I'll take care of their needs.
|
2009-08-03 07:38:44 -04:00
|
|
|
|
|
2009-05-25 10:53:48 -04:00
|
|
|
|
|
|
|
|
|
Infrastructure
|
|
|
|
|
==============
|
|
|
|
|
|
|
|
|
|
hg-ssh
|
|
|
|
|
------
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
Developers should access the repositories through ssh, similar to the
|
|
|
|
|
current setup. Public keys can be used to grant people access to a
|
2011-02-25 13:30:02 -05:00
|
|
|
|
shared hg@ account. A hgwebdir instance also has been set up at
|
|
|
|
|
``hg.python.org`` for easy browsing and read-only access. It is
|
|
|
|
|
configured so that developers can trivially start new clones (for
|
|
|
|
|
longer-term features that profit from development in a separate
|
|
|
|
|
repository).
|
2009-05-25 10:53:48 -04:00
|
|
|
|
|
2011-02-25 14:04:21 -05:00
|
|
|
|
Also, direct creation of public repositories is allowed for core developers,
|
|
|
|
|
although it is not yet decided which naming scheme will be enforced::
|
|
|
|
|
|
|
|
|
|
$ hg init ssh://hg@hg.python.org/sandbox/mywork
|
|
|
|
|
repo created, public URL is http://hg.python.org/sandbox/mywork
|
|
|
|
|
|
|
|
|
|
|
2009-05-25 10:53:48 -04:00
|
|
|
|
Hooks
|
|
|
|
|
-----
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
A number of hooks is currently in use. The hg equivalents for these
|
|
|
|
|
should be developed and deployed. The following hooks are being used:
|
|
|
|
|
|
|
|
|
|
* check whitespace: a hook to reject commits in case the whitespace
|
|
|
|
|
doesn't match the rules for the Python codebase. In a changegroup,
|
|
|
|
|
only the tip is checked (this allows cleanup commits for changes
|
|
|
|
|
pulled from third-party repos). We can also offer a whitespace hook
|
|
|
|
|
for use with client-side repositories that people can use; it could
|
|
|
|
|
either warn about whitespace issues and/or truncate trailing
|
|
|
|
|
whitespace from changed lines.
|
|
|
|
|
|
2011-02-25 14:04:21 -05:00
|
|
|
|
* push mails: Emails will include diffs for each changeset pushed
|
2011-02-25 14:06:26 -05:00
|
|
|
|
to the public repository, including the username which pushed the
|
|
|
|
|
changesets (this is not necessarily the same as the author recorded
|
|
|
|
|
in the changesets).
|
2009-05-25 10:53:48 -04:00
|
|
|
|
|
2011-02-25 14:06:26 -05:00
|
|
|
|
* buildbots: the python.org build master will be notified of each changeset
|
|
|
|
|
pushed to the ``cpython`` repository, and will trigger an appropriate build
|
|
|
|
|
on every build slave for the branch in which the changeset occurs.
|
2009-05-25 10:53:48 -04:00
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
The `hooks repository`_ contains ports of these server-side hooks to
|
2011-02-28 13:22:36 -05:00
|
|
|
|
Mercurial, as well as a couple additional ones:
|
|
|
|
|
|
|
|
|
|
* check branch heads: a hook to reject pushes which create a new head on
|
2011-02-28 16:05:27 -05:00
|
|
|
|
an existing branch. The pusher then has to merge the excess heads
|
2011-02-28 13:22:36 -05:00
|
|
|
|
and try pushing again.
|
|
|
|
|
|
|
|
|
|
* check branches: a hook to reject all changesets not on an allowed named
|
|
|
|
|
branch. This hook's whitelist will have to be updated when we want to
|
|
|
|
|
create new maintenance branches.
|
|
|
|
|
|
|
|
|
|
* check line endings: a hook, based on the `eol extension`_, to reject all
|
|
|
|
|
changesets committing files with the wrong line endings. The commits then
|
|
|
|
|
have to be stripped and redone, possibly with the `eol extension`_ enabled
|
|
|
|
|
on the comitter's computer.
|
|
|
|
|
|
|
|
|
|
One additional hook could be beneficial:
|
2009-05-25 10:53:48 -04:00
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
* check contributors: in the current setup, all changesets bear the
|
|
|
|
|
username of committers, who must have signed the contributor
|
|
|
|
|
agreement. We might want to use a hook to check if the committer is
|
|
|
|
|
a contributor if we keep a list of registered contributors. Then,
|
|
|
|
|
the hook might warn users that push a group of revisions containing
|
|
|
|
|
changesets from unknown contributors.
|
2009-05-25 10:53:48 -04:00
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
.. _hooks repository: http://hg.python.org/hooks/
|
2009-05-25 10:53:48 -04:00
|
|
|
|
|
2011-02-25 13:30:02 -05:00
|
|
|
|
|
2009-08-03 07:50:49 -04:00
|
|
|
|
End-of-line conversions
|
|
|
|
|
-----------------------
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
Discussion about the lack of end-of-line conversion support in
|
2011-02-25 14:12:07 -05:00
|
|
|
|
Mercurial, which was provided initially by the `win32text extension`_,
|
|
|
|
|
led to the development of the new `eol extension`_ that supports a
|
2010-11-19 12:12:24 -05:00
|
|
|
|
versioned management of line-ending conventions on a file-by-file
|
|
|
|
|
basis, akin to Subversion's ``svn:eol-style`` properties. This
|
|
|
|
|
information is kept in a versioned file called ``.hgeol``, and such a
|
|
|
|
|
file has already been checked into the Subversion repository.
|
2009-08-03 07:50:49 -04:00
|
|
|
|
|
2011-02-28 13:22:36 -05:00
|
|
|
|
A hook also exists on the server side to reject any changeset
|
|
|
|
|
introducing inconsistent newline data (see above).
|
2009-08-03 07:50:49 -04:00
|
|
|
|
|
2011-02-25 14:12:07 -05:00
|
|
|
|
.. _eol extension: http://mercurial.selenic.com/wiki/EolExtension
|
|
|
|
|
.. _win32text extension: http://mercurial.selenic.com/wiki/Win32TextExtension
|
|
|
|
|
|
2011-02-25 13:30:02 -05:00
|
|
|
|
|
2009-05-25 10:53:48 -04:00
|
|
|
|
hgwebdir
|
|
|
|
|
--------
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
A more or less stock hgwebdir installation should be set up. We might
|
|
|
|
|
want to come up with a style to match the Python website.
|
|
|
|
|
|
2012-03-04 08:32:42 -05:00
|
|
|
|
A small WSGI application has been written that can look up
|
2010-11-19 12:12:24 -05:00
|
|
|
|
Subversion revisions and redirect to the appropriate hgweb page for
|
|
|
|
|
the given changeset, regardless in which repository the converted
|
|
|
|
|
revision ended up (since one big Subversion repository is converted
|
|
|
|
|
into several Mercurial repositories). It can also look up Mercurial
|
|
|
|
|
changesets by their hexadecimal ID.
|
|
|
|
|
|
2011-02-25 13:30:02 -05:00
|
|
|
|
|
2009-08-03 07:38:44 -04:00
|
|
|
|
roundup
|
|
|
|
|
-------
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
By pointing Roundup to the URL of the lookup script mentioned above,
|
|
|
|
|
links to SVN revisions will continue to work, and links to Mercurial
|
|
|
|
|
changesets can be created as well, without having to give repository
|
|
|
|
|
*and* changeset ID.
|
2009-08-03 07:38:44 -04:00
|
|
|
|
|
2009-06-05 12:49:40 -04:00
|
|
|
|
|
|
|
|
|
After migration
|
|
|
|
|
===============
|
|
|
|
|
|
|
|
|
|
Where to get code
|
|
|
|
|
-----------------
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
After migration, the hgwebdir will live at hg.python.org. This is an
|
|
|
|
|
accepted standard for many organizations, and an easy parallel to
|
2011-02-25 13:30:02 -05:00
|
|
|
|
svn.python.org. The working repo might live at
|
|
|
|
|
http://hg.python.org/cpython/, for example, with the archive repo at
|
|
|
|
|
http://hg.python.org/cpython-archive/. For write access, developers
|
|
|
|
|
will have to use ssh, which could be ssh://hg@hg.python.org/cpython/.
|
|
|
|
|
|
|
|
|
|
code.python.org was also proposed as the hostname. We think that
|
|
|
|
|
using the VCS name in the hostname is good because it prevents
|
|
|
|
|
confusion: it should be clear that you can't use svn or bzr for
|
|
|
|
|
hg.python.org.
|
|
|
|
|
|
|
|
|
|
hgwebdir can already provide tarballs for every changeset. This
|
|
|
|
|
obviates the need for daily snapshots; we can just point users to
|
2010-11-19 12:12:24 -05:00
|
|
|
|
tip.tar.gz instead, meaning they will get the latest. If desired, we
|
|
|
|
|
could even use buildbot results to point to the last good changeset.
|
2009-06-05 12:49:40 -04:00
|
|
|
|
|
2011-02-25 13:30:02 -05:00
|
|
|
|
|
2009-06-05 12:49:40 -04:00
|
|
|
|
Python-specific documentation
|
|
|
|
|
-----------------------------
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
hg comes with good built-in documentation (available through hg help)
|
2011-02-25 14:00:25 -05:00
|
|
|
|
and a `wiki`_ that's full of useful information and recipes, not to
|
|
|
|
|
mention a popular `book`_ (readable online).
|
2009-06-05 12:49:40 -04:00
|
|
|
|
|
2011-02-25 13:30:02 -05:00
|
|
|
|
In addition to that, the recently overhauled `Python Developer's
|
|
|
|
|
Guide`_ already has a branch with instructions for Mercurial instead
|
|
|
|
|
of Subversion; an online `build of this branch`_ is also available.
|
|
|
|
|
|
|
|
|
|
.. _Python Developer's Guide: http://docs.python.org/devguide/
|
|
|
|
|
.. _build of this branch: http://potrou.net/hgdevguide/
|
2011-02-25 13:46:10 -05:00
|
|
|
|
.. _wiki: http://mercurial.selenic.com/wiki/
|
2011-02-25 14:00:25 -05:00
|
|
|
|
.. _book: http://hgbook.red-bean.com/
|
2009-06-05 12:49:40 -04:00
|
|
|
|
|
2009-08-03 07:38:44 -04:00
|
|
|
|
Proposed workflow
|
|
|
|
|
-----------------
|
|
|
|
|
|
2011-02-25 13:30:02 -05:00
|
|
|
|
We propose two workflows for the migration of patches between several
|
2010-11-19 12:12:24 -05:00
|
|
|
|
branches.
|
|
|
|
|
|
2011-02-25 13:30:02 -05:00
|
|
|
|
For migration within 2.x or 3.x branches, we propose a patch always
|
2010-11-19 12:12:24 -05:00
|
|
|
|
gets committed to the oldest branch where it applies first. Then, the
|
|
|
|
|
resulting changeset can be merged using hg merge to all newer branches
|
|
|
|
|
within that series (2.x or 3.x). If it does not apply as-is to the
|
|
|
|
|
newer branch, hg revert can be used to easily revert to the
|
|
|
|
|
new-branch-native head, patch in some alternative version of the patch
|
|
|
|
|
(or none, if it's not applicable), then commit the merge. The premise
|
|
|
|
|
here is that all changesets from an older branch within the series are
|
|
|
|
|
eventually merged to all newer branches within the series.
|
|
|
|
|
|
|
|
|
|
The upshot is that this provides for the most painless merging
|
|
|
|
|
procedure. This means that in the general case, people have to think
|
|
|
|
|
about the oldest branch to which the patch should be applied before
|
|
|
|
|
actually applying it. Usually, that is one of only two branches: the
|
|
|
|
|
latest maintenance branch and the trunk, except for security fixes
|
|
|
|
|
applicable to older branches in security-fix-only mode.
|
|
|
|
|
|
|
|
|
|
For merging bug fixes from the 3.x to the 2.7 maintenance branch (2.6
|
|
|
|
|
and 2.5 are in security-fix-only mode and their maintenance will
|
|
|
|
|
continue in the Subversion repository), changesets should be
|
|
|
|
|
transplanted (not merged) in some other way. The transplant
|
|
|
|
|
extension, import/export and bundle/unbundle work equally well here.
|
|
|
|
|
|
|
|
|
|
Choosing this approach allows 3.x not to carry all of the 2.x
|
|
|
|
|
history-since-it-was-branched, meaning the clone is not as big and the
|
|
|
|
|
merges not as complicated.
|
2009-06-05 12:49:40 -04:00
|
|
|
|
|
2011-02-25 13:30:02 -05:00
|
|
|
|
|
2009-06-05 12:49:40 -04:00
|
|
|
|
The future of Subversion
|
|
|
|
|
------------------------
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
What happens to the Subversion repositories after the migration?
|
|
|
|
|
Since the svn server contains a bunch of repositories, not just the
|
|
|
|
|
CPython one, it will probably live on for a bit as not every project
|
|
|
|
|
may want to migrate or it takes longer for other projects to migrate.
|
|
|
|
|
To prevent people from staying behind, we may want to move migrated
|
2011-02-25 13:30:02 -05:00
|
|
|
|
projects from the repository to a new, read-only repository with a new
|
|
|
|
|
name.
|
|
|
|
|
|
2009-06-05 12:49:40 -04:00
|
|
|
|
|
|
|
|
|
Build identification
|
|
|
|
|
--------------------
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
Python currently provides the sys.subversion tuple to allow Python
|
|
|
|
|
code to find out exactly what version of Python it's running against.
|
|
|
|
|
The current version looks something like this:
|
2009-06-05 12:49:40 -04:00
|
|
|
|
|
|
|
|
|
* ('CPython', 'tags/r262', '71600')
|
|
|
|
|
* ('CPython', 'trunk', '73128M')
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
Another value is returned from Py_GetBuildInfo() in the C API, and
|
|
|
|
|
available to Python code as part of sys.version:
|
2009-06-05 12:49:40 -04:00
|
|
|
|
|
|
|
|
|
* 'r262:71600, Jun 2 2009, 09:58:33'
|
|
|
|
|
* 'trunk:73128M, Jun 2 2009, 01:24:14'
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
I propose that the revision identifier will be the short version of
|
|
|
|
|
hg's revision hash, for example 'dd3ebf81af43', augmented with '+'
|
|
|
|
|
(instead of 'M') if the working directory from which it was built was
|
|
|
|
|
modified. This mirrors the output of the hg id command, which is
|
|
|
|
|
intended for this kind of usage. The sys.subversion value will also
|
|
|
|
|
be renamed to sys.mercurial to reflect the change in VCS.
|
2009-06-05 12:49:40 -04:00
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
For the tag/branch identifier, I propose that hg will check for tags
|
|
|
|
|
on the currently checked out revision, use the tag if there is one
|
|
|
|
|
('tip' doesn't count), and uses the branch name otherwise.
|
|
|
|
|
sys.subversion becomes
|
2009-06-05 12:49:40 -04:00
|
|
|
|
|
2011-02-28 13:32:14 -05:00
|
|
|
|
* ('CPython', 'v2.6.2', 'dd3ebf81af43')
|
2009-06-05 12:49:40 -04:00
|
|
|
|
* ('CPython', 'default', 'af694c6a888c+')
|
|
|
|
|
|
|
|
|
|
and the build info string becomes
|
|
|
|
|
|
2011-02-28 13:32:14 -05:00
|
|
|
|
* 'v2.6.2:dd3ebf81af43, Jun 2 2009, 09:58:33'
|
2009-06-05 12:49:40 -04:00
|
|
|
|
* 'default:af694c6a888c+, Jun 2 2009, 01:24:14'
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
This reflects that the default branch in hg is called 'default'
|
|
|
|
|
instead of Subversion's 'trunk', and reflects the proposed new tag
|
|
|
|
|
format.
|
|
|
|
|
|
2011-02-28 13:32:14 -05:00
|
|
|
|
Mercurial also allows to find out the latest tag and the number of
|
|
|
|
|
changesets separating the current changeset from that tag, allowing for
|
|
|
|
|
a descriptive version string::
|
|
|
|
|
|
|
|
|
|
$ hg parent --template "{latesttag}+{latesttagdistance}-{node|short}\n"
|
|
|
|
|
v3.2+37-4b5d0d260e72
|
|
|
|
|
$ hg up 2.7
|
|
|
|
|
3316 files updated, 0 files merged, 379 files removed, 0 files unresolved
|
|
|
|
|
$ hg parent --template "{latesttag}+{latesttagdistance}-{node|short}\n"
|
|
|
|
|
v2.7.1+216-9619d21d8198
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
|
2011-02-25 13:30:02 -05:00
|
|
|
|
Footnotes
|
|
|
|
|
=========
|
|
|
|
|
|
|
|
|
|
.. [1] The Mercurial book discourages the use of named branches, but
|
|
|
|
|
it is, in this respect, somewhat outdated. Named branches have
|
|
|
|
|
gotten much easier to use since that comment was written, due to
|
|
|
|
|
improvements in hg.
|
|
|
|
|
|
|
|
|
|
.. [2] Since the initial working repo is a subset of the archive repo,
|
|
|
|
|
it would also be feasible to pull changes from the working repo
|
|
|
|
|
into the archive repo periodically.
|
|
|
|
|
|
|
|
|
|
|
2010-11-19 12:12:24 -05:00
|
|
|
|
Copyright
|
|
|
|
|
=========
|
|
|
|
|
|
|
|
|
|
This document has been placed in the public domain.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
..
|
|
|
|
|
Local Variables:
|
|
|
|
|
mode: indented-text
|
|
|
|
|
indent-tabs-mode: nil
|
|
|
|
|
sentence-end-double-space: t
|
|
|
|
|
fill-column: 70
|
|
|
|
|
coding: utf-8
|
|
|
|
|
End:
|