# HG changeset patch # User Bryan O'Sullivan # Date 1240813348 25200 # Node ID 75ccc1e89aefb3ed8eec4cda7d89a1ceccd6020f # Parent 0ffae4ee4c47870e23c55ee2cff04bf3b6d99d4d Add paragraph IDS diff -r 0ffae4ee4c47 -r 75ccc1e89aef en/appA-svn.xml --- a/en/appA-svn.xml Sun Apr 26 23:22:04 2009 -0700 +++ b/en/appA-svn.xml Sun Apr 26 23:22:28 2009 -0700 @@ -4,66 +4,66 @@ Migrating to Mercurial - A common way to test the waters with a new revision control + A common way to test the waters with a new revision control tool is to experiment with switching an existing project, rather than starting a new project from scratch. - In this appendix, we discuss how to import a project's history + In this appendix, we discuss how to import a project's history into Mercurial, and what to look out for if you are used to a different revision control system. Importing history from another system - Mercurial ships with an extension named + Mercurial ships with an extension named convert, which can import project history from most popular revision control systems. At the time this book was written, it could import history from the following systems: - Subversion + Subversion - CVS + CVS - git + git - Darcs + Darcs - Bazaar + Bazaar - Monotone + Monotone - GNU Arch + GNU Arch - Mercurial + Mercurial - (To see why Mercurial itself is supported as a source, see + (To see why Mercurial itself is supported as a source, see .) - You can enable the extension in the usual way, by editing + You can enable the extension in the usual way, by editing your ~/.hgrc file. [extensions] convert = - This will make a hg convert command + This will make a hg convert command available. The command is easy to use. For instance, this command will import the Subversion history for the Nose unit testing framework into Mercurial. $ hg convert http://python-nose.googlecode.com/svn/trunk - The convert extension operates + The convert extension operates incrementally. In other words, after you have run hg convert once, running it again will import any new revisions committed after the first run began. Incremental @@ -78,13 +78,13 @@ Mapping user names - Some revision control tools save only short usernames with + Some revision control tools save only short usernames with commits, and these can be difficult to interpret. The norm with Mercurial is to save a committer's name and email address, which is much more useful for talking to them after the fact. - If you are converting a tree from a revision control + If you are converting a tree from a revision control system that uses short names, you can map those names to longer equivalents by passing a option to hg convert. This option accepts @@ -94,7 +94,7 @@ arist = Aristotle <aristotle@phil.example.gr> soc = Socrates <socrates@phil.example.gr> - Whenever convert encounters a commit + Whenever convert encounters a commit with the username arist in the source repository, it will use the name Aristotle <aristotle@phil.example.gr> in the converted @@ -105,19 +105,19 @@ Tidying up the tree - Not all projects have pristine history. There may be a + Not all projects have pristine history. There may be a directory that should never have been checked in, a file that is too big, or a whole hierarchy that needs to be refactored. - The convert extension supports the idea + The convert extension supports the idea of a file map that can reorganize the files and directories in a project as it imports the project's history. This is useful not only when importing history from other revision control systems, but also to prune or refactor a Mercurial tree. - To specify a file map, use the + To specify a file map, use the option and supply a file name. A file map contains lines of the following forms. @@ -131,14 +131,14 @@ rename from/some/path to/some/other/place - The include directive causes a file, or + The include directive causes a file, or all files under a directory, to be included in the destination repository. This also excludes all other files and dirs not explicitely included. The exclude directive causes files or directories to be omitted, and others not explicitly mentioned to be included. - To move a file or directory from one location to another, + To move a file or directory from one location to another, use the rename directive. If you need to move a file or directory from a subdirectory into the root of the repository, use . as the second @@ -149,7 +149,7 @@ Migrating from Subversion - Subversion is currently the most popular open source + Subversion is currently the most popular open source revision control system. Although there are many differences between Mercurial and Subversion, making the transition from Subversion to Mercurial is not particularly difficult. The two @@ -159,7 +159,7 @@ Philosophical differences - The fundamental difference between Subversion and + The fundamental difference between Subversion and Mercurial is of course that Subversion is centralized, while Mercurial is distributed. Since Mercurial stores all of a project's history on your local drive, it only needs to @@ -168,7 +168,7 @@ stores very little information locally, and the client must thus contact its server for many common operations. - Subversion more or less gets away without a well-defined + Subversion more or less gets away without a well-defined notion of a branch: which portion of a server's namespace qualifies as a branch is a matter of convention, with the software providing no enforcement. Mercurial treats a @@ -177,14 +177,14 @@ Scope of commands - Since Subversion doesn't know what parts of its + Since Subversion doesn't know what parts of its namespace are really branches, it treats most commands as requests to operate at and below whatever directory you are currently visiting. For instance, if you run svn log, you'll get the history of whatever part of the tree you're looking at, not the tree as a whole. - Mercurial's commands behave differently, by defaulting + Mercurial's commands behave differently, by defaulting to operating over an entire repository. Run hg log and it will tell you the history of the entire tree, no matter what part of the working directory @@ -192,7 +192,7 @@ just a particular file or directory, simply supply it by name, e.g. hg log src. - From my own experience, this difference in default + From my own experience, this difference in default behaviors is probably the most likely to trip you up if you have to switch back and forth frequently between the two tools. @@ -201,7 +201,7 @@ Multi-user operation and safety - With Subversion, it is normal (though slightly frowned + With Subversion, it is normal (though slightly frowned upon) for multiple people to collaborate in a single branch. If Alice and Bob are working together, and Alice commits some changes to their shared branch, Bob must update his @@ -210,7 +210,7 @@ made, he can corrupt or lose his modifications during and after his update. - Mercurial encourages a commit-then-merge model instead. + Mercurial encourages a commit-then-merge model instead. Bob commits his changes locally before pulling changes from, or pushing them to, the server that he shares with Alice. If Alice pushed her changes before Bob tries to push his, he @@ -219,7 +219,7 @@ he makes a mistake during the merge, he still has the option of reverting to the commit that recorded his changes. - It is worth emphasizing that these are the common ways + It is worth emphasizing that these are the common ways of working with these tools. Subversion supports a safer work-in-your-own-branch model, but it is cumbersome enough in practice to not be widely used. Mercurial can support @@ -231,15 +231,15 @@ Published vs local changes - A Subversion svn commit command + A Subversion svn commit command immediately publishes changes to a server, where they can be seen by everyone who has read access. - With Mercurial, commits are always local, and must be + With Mercurial, commits are always local, and must be published via a hg push command afterwards. - Each approach has its advantages and disadvantages. The + Each approach has its advantages and disadvantages. The Subversion model means that changes are published, and hence reviewable and usable, immediately. On the other hand, this means that a user must have commit access to a repository in @@ -247,7 +247,7 @@ is not lightly given out by most open source projects. - The Mercurial approach allows anyone who can clone a + The Mercurial approach allows anyone who can clone a repository to commit changes without the need for someone else's permission, and they can then publish their changes and continue to participate however they see fit. The @@ -408,7 +408,7 @@ Useful tips for newcomers - Under some revision control systems, printing a diff for a + Under some revision control systems, printing a diff for a single committed revision can be painful. For instance, with Subversion, to see what changed in revision 104654, you must type svn diff -r104653:104654. Mercurial @@ -417,7 +417,7 @@ a log message followed by a diff, hg log -r104654 -p. - When you run hg status without any + When you run hg status without any arguments, it prints the status of the entire tree, with paths relative to the root of the repository. This makes it tricky to copy a file name from the output of hg status