# HG changeset patch # User Bryan O'Sullivan # Date 1241506358 25200 # Node ID 477d6a3e50232c27a6dff70a392cff37d09d6017 # Parent d2aacc06e562b175c4b1f8ac1d226255630d4bc4 Many final changes. diff -r d2aacc06e562 -r 477d6a3e5023 en/appB-mq-ref.xml --- a/en/appB-mq-ref.xml Sun May 03 20:27:28 2009 -0700 +++ b/en/appB-mq-ref.xml Mon May 04 23:52:38 2009 -0700 @@ -72,6 +72,16 @@ + <command role="hg-ext-mq">qfold</command>&emdash;move + applied patches into repository history + + The hg qfinish command converts the + specified applied patches into permanent changes by moving + them out of MQ's control so that they will be treated as + normal repository history. + + + <command role="hg-ext-mq">qfold</command>&emdash;merge (<quote>fold</quote>) several patches into one @@ -328,8 +338,8 @@ no such text, a default commit message is used that identifies the name of the patch. - If a patch contains a Mercurial patch header (XXX add - link), the information in the patch header overrides these + If a patch contains a Mercurial patch header, + the information in the patch header overrides these defaults. Options: @@ -435,21 +445,6 @@ - <command - role="hg-ext-mq">qrestore</command>&emdash;restore saved - queue state - - XXX No idea what this does. - - - - <command role="hg-ext-mq">qsave</command>&emdash;save - current queue state - - XXX Likewise. - - - <command role="hg-ext-mq">qseries</command>&emdash;print the entire patch series @@ -501,9 +496,7 @@ changesets in the backup bundle. : If a - branch has multiple heads, remove all heads. XXX This - should be renamed, and use -f to strip - revs when there are pending changes. + branch has multiple heads, remove all heads. : Do not save a backup bundle. diff -r d2aacc06e562 -r 477d6a3e5023 en/ch02-tour-merge.xml --- a/en/ch02-tour-merge.xml Sun May 03 20:27:28 2009 -0700 +++ b/en/ch02-tour-merge.xml Mon May 04 23:52:38 2009 -0700 @@ -146,6 +146,7 @@ &interaction.tour.merge.parents; + Committing the results of the merge @@ -292,8 +293,8 @@ strengths and weaknesses. Most are tuned for merging files containing plain text, while a few are aimed at specialised file formats (generally XML). + - A worked example @@ -365,6 +366,7 @@ + Simplifying the pull-merge-commit sequence @@ -421,7 +423,27 @@ the extension, but since the fetch extension is in the standard distribution, Mercurial knows where to search for it.) + + + Renaming, copying, and merging + + During the life of a project, we will often want to change + the layout of its files and directories. This can be as simple + as renaming a single file, or as complex as restructuring the + entire hierarchy of files within the project. + + Mercurial supports these kinds of complex changes fluently, + provided we tell it what we're doing. If we want to rename a + file, we should use the hg rename + If you're a Unix user, you'll be glad to know that the + hg rename command can be abbreviated as + hg mv. + command to rename it, so that Mercurial can do the + right thing later when we merge. + + We will cover the use of these commands in more detail in + . diff -r d2aacc06e562 -r 477d6a3e5023 en/ch03-concepts.xml --- a/en/ch03-concepts.xml Sun May 03 20:27:28 2009 -0700 +++ b/en/ch03-concepts.xml Mon May 04 23:52:38 2009 -0700 @@ -112,12 +112,15 @@ As the illustration shows, there is not a one to one relationship between revisions in the changelog, manifest, or - filelog. If the manifest hasn't changed between two - changesets, the changelog entries for those changesets will - point to the same revision of the manifest. If a file that + filelog. If a file that Mercurial tracks hasn't changed between two changesets, the entry for that file in the two revisions of the manifest will - point to the same revision of its filelog. + point to the same revision of its filelog + It is possible (though unusual) for the manifest to + remain the same between two changesets, in which case the + changelog entries for those changesets will point to the + same revision of the manifest. + . @@ -175,16 +178,18 @@ Fast retrieval - Mercurial cleverly avoids a pitfall common to all earlier - revision control systems: the problem of inefficient - retrieval. Most revision control systems store - the contents of a revision as an incremental series of - modifications against a snapshot. To - reconstruct a specific revision, you must first read the - snapshot, and then every one of the revisions between the - snapshot and your target revision. The more history that a - file accumulates, the more revisions you must read, hence the - longer it takes to reconstruct a particular revision. + Mercurial cleverly avoids a pitfall common to + all earlier revision control systems: the problem of + inefficient retrieval. Most revision + control systems store the contents of a revision as an + incremental series of modifications against a + snapshot. (Some base the snapshot on the + oldest revision, others on the newest.) To reconstruct a + specific revision, you must first read the snapshot, and then + every one of the revisions between the snapshot and your + target revision. The more history that a file accumulates, + the more revisions you must read, hence the longer it takes to + reconstruct a particular revision.
Snapshot of a revlog, with incremental deltas @@ -211,25 +216,15 @@ Aside: the influence of video compression - If you're familiar with video compression or have ever - watched a TV feed through a digital cable or satellite - service, you may know that most video compression schemes - store each frame of video as a delta against its predecessor - frame. In addition, these schemes use lossy - compression techniques to increase the compression ratio, so - visual errors accumulate over the course of a number of - inter-frame deltas. + If you're familiar with video compression or + have ever watched a TV feed through a digital cable or + satellite service, you may know that most video compression + schemes store each frame of video as a delta against its + predecessor frame. - Because it's possible for a video stream to drop - out occasionally due to signal glitches, and to - limit the accumulation of artefacts introduced by the lossy - compression process, video encoders periodically insert a - complete frame (called a key frame) into the - video stream; the next delta is generated against that - frame. This means that if the video signal gets - interrupted, it will resume once the next key frame is - received. Also, the accumulation of encoding errors - restarts anew with each key frame. + Mercurial borrows this idea to make it + possible to reconstruct a revision from a snapshot and a + small number of deltas. @@ -261,9 +256,9 @@ uncorrupted sections of the revlog, both before and after the corrupted section. This would not be possible with a delta-only storage model. - + Revision history, branching, and merging @@ -314,11 +309,15 @@ those files, with the same contents it had when the changeset was committed. - The dirstate contains Mercurial's - knowledge of the working directory. This details which - changeset the working directory is updated to, and all of the - files that Mercurial is tracking in the working - directory. + The dirstate is a special + structure that contains Mercurial's knowledge of the working + directory. It is maintained as a file named + .hg/dirstate inside a repository. The + dirstate details which changeset the working directory is + updated to, and all of the files that Mercurial is tracking in + the working directory. It also lets Mercurial quickly notice + changed files, by recording their checkout times and + sizes. Just as a revision of a revlog has room for two parents, so that it can represent either a normal revision (with one parent) @@ -426,9 +425,9 @@
- If you're new to Mercurial, you should keep in mind a - common error, which is to use the hg pull command without any + If you're new to Mercurial, you should keep + in mind a common error, which is to use the + hg pull command without any options. By default, the hg pull command does not update the working directory, so you'll bring new changesets @@ -436,16 +435,19 @@ synced at the same changeset as before the pull. If you make some changes and commit afterwards, you'll thus create a new head, because your working directory isn't synced to - whatever the current tip is. + whatever the current tip is. To combine the operation of a + pull, followed by an update, run hg pull + -u. - I put the word error in - quotes because all that you need to do to rectify this - situation is hg merge, then - hg commit. In other words, - this almost never has negative consequences; it's just - something of a surprise for newcomers. I'll discuss other - ways to avoid this behavior, and why Mercurial behaves in - this initially surprising way, later on. + I put the word error in quotes + because all that you need to do to rectify the situation + where you created a new head by accident is + hg merge, then hg commit. In other words, this + almost never has negative consequences; it's just something + of a surprise for newcomers. I'll discuss other ways to + avoid this behavior, and why Mercurial behaves in this + initially surprising way, later on.
@@ -511,13 +513,15 @@ working directory has two parents; these will become the parents of the new changeset. - Mercurial lets you perform multiple merges, but you must - commit the results of each individual merge as you go. This - is necessary because Mercurial only tracks two parents for - both revisions and the working directory. While it would be - technically possible to merge multiple changesets at once, the - prospect of user confusion and making a terrible mess of a - merge immediately becomes overwhelming. + Mercurial lets you perform multiple merges, but + you must commit the results of each individual merge as you + go. This is necessary because Mercurial only tracks two + parents for both revisions and the working directory. While + it would be technically feasible to merge multiple changesets + at once, Mercurial avoids this for simplicity. With multi-way + merges, the risks of user confusion, nasty conflict + resolution, and making a terrible mess of a merge would grow + intolerable. @@ -598,10 +602,17 @@ transferred, yielding better network performance over most kinds of network. - (If the connection is over ssh, - Mercurial doesn't recompress the - stream, because ssh can already do this - itself.) + If the connection is over + ssh, Mercurial + doesn't recompress the stream, because + ssh can already do this itself. You can + tell Mercurial to always use ssh's + compression feature by editing the + .hgrc file in your home directory as + follows. + + [ui] +ssh = ssh -C @@ -611,9 +622,8 @@ Appending to files isn't the whole story when it comes to guaranteeing that a reader won't see a partial write. If you recall , - revisions in - the changelog point to revisions in the manifest, and - revisions in the manifest point to revisions in filelogs. + revisions in the changelog point to revisions in the manifest, + and revisions in the manifest point to revisions in filelogs. This hierarchy is deliberate. A writer starts a transaction by writing filelog and @@ -637,7 +647,7 @@ being written to while the read is occurring. This has a big effect on scalability; you can have an arbitrary number of Mercurial processes safely reading data from a repository - safely all at once, no matter whether it's being written to or + all at once, no matter whether it's being written to or not. The lockless nature of reading means that if you're @@ -709,8 +719,8 @@ storage is cheap, and this method gives the highest performance while deferring most book-keeping to the operating system. An alternative scheme would most likely reduce - performance and increase the complexity of the software, each - of which is much more important to the feel of + performance and increase the complexity of the software, but + speed and simplicity are key to the feel of day-to-day use. @@ -731,18 +741,32 @@ dirstate so that it knows what to do with those files when you commit. - When Mercurial is checking the states of files in the - working directory, it first checks a file's modification time. - If that has not changed, the file must not have been modified. - If the file's size has changed, the file must have been - modified. If the modification time has changed, but the size - has not, only then does Mercurial need to read the actual - contents of the file to see if they've changed. Storing these - few extra pieces of information dramatically reduces the - amount of data that Mercurial needs to read, which yields - large performance improvements compared to other revision - control systems. + The dirstate helps Mercurial to efficiently + check the status of files in a repository. + + + When Mercurial checks the state of a file in the + working directory, it first checks a file's modification + time against the time in the dirstate that records when + Mercurial last wrote the file. If the last modified time + is the same as the time when Mercurial wrote the file, the + file must not have been modified, so Mercurial does not + need to check any further. + + + If the file's size has changed, the file must have + been modified. If the modification time has changed, but + the size has not, only then does Mercurial need to + actually read the contents of the file to see if it has + changed. + + + + Storing the modification time and size dramatically + reduces the number of read operations that Mercurial needs to + perform when we run commands like hg status. + This results in large performance improvements. diff -r d2aacc06e562 -r 477d6a3e5023 en/ch04-daily.xml --- a/en/ch04-daily.xml Sun May 03 20:27:28 2009 -0700 +++ b/en/ch04-daily.xml Mon May 04 23:52:38 2009 -0700 @@ -108,10 +108,11 @@ How to stop tracking a file - Once you decide that a file no longer belongs in your - repository, use the hg remove - command. This deletes the file, and tells Mercurial to stop - tracking it. A removed file is represented in the output of + Once you decide that a file no longer belongs in + your repository, use the hg + remove command. This deletes the file, and tells + Mercurial to stop tracking it (which will occur at the next + commit). A removed file is represented in the output of hg status with a R. @@ -214,7 +215,7 @@ - + Copying files Mercurial provides a hg @@ -535,11 +536,12 @@ hg revert to get rid of erroneous changes to a file. - It's good to remember that the hg - revert command is useful for changes that you have - not yet committed. Once you've committed a change, if you - decide it was a mistake, you can still do something about it, - though your options may be more limited. + It is helpful to remember that the hg revert command is useful for + changes that you have not yet committed. Once you've committed + a change, if you decide it was a mistake, you can still do + something about it, though your options may be more + limited. For more information about the hg revert command, and details about @@ -817,7 +819,7 @@ If you perform traditional backups of your master repositories to tape or disk, and you want to back up a - repository named myrepo. Use hg + repository named myrepo, use hg clone -U myrepo myrepo.bak to create a clone of myrepo before you start your backups. The option doesn't check out a diff -r d2aacc06e562 -r 477d6a3e5023 en/ch05-collab.xml --- a/en/ch05-collab.xml Sun May 03 20:27:28 2009 -0700 +++ b/en/ch05-collab.xml Mon May 04 23:52:38 2009 -0700 @@ -55,18 +55,12 @@ linkend="sec:collab:serve"/> below for details of how to use this command. - For longer-lived repositories that you'd like to have - permanently available, there are several public hosting services - available. - - - - Bitbucket, at http://bitbucket.org/, - provides free hosting for open source projects, and paid - hosting for commercial projects. - - + For longer-lived repositories that you'd like to + have permanently available, there are several public hosting + services available. Some are free to open source projects, + while others offer paid commercial hosting. An up-to-date list + is available at http://www.selenic.com/mercurial/wiki/index.cgi/MercurialHosting. If you would prefer to host your own repositories, Mercurial has built-in support for several popular hosting technologies, @@ -827,7 +821,7 @@ so that they only print output if they're run interactively. Otherwise these banners will at least clutter up Mercurial's output. Worse, they could potentially cause problems with - running Mercurial commands remotely. Mercurial makes tries to + running Mercurial commands remotely. Mercurial tries to detect and ignore banners in non-interactive ssh sessions, but it is not foolproof. (If you're editing your login scripts on your server, the usual @@ -1107,7 +1101,7 @@ directions inside it to correctly set your PYTHONPATH environment variable. - Finally, you are certain to by + Finally, you are certain to be served with another colourful Python backtrace: this one will complain that it can't find /path/to/repository. Edit diff -r d2aacc06e562 -r 477d6a3e5023 en/ch06-filenames.xml --- a/en/ch06-filenames.xml Sun May 03 20:27:28 2009 -0700 +++ b/en/ch06-filenames.xml Mon May 04 23:52:38 2009 -0700 @@ -358,10 +358,11 @@ interchangeable is also referred to as case folding. - Case sensitive. The case of a name is - significant at all times. The names foo - and {FoO} identify different files. This is the way Linux - and Unix systems normally work. + Case sensitive. The case of a name + is significant at all times. The names + foo and FoO + identify different files. This is the way Linux and Unix + systems normally work. On Unix-like systems, it is possible to have any or all of diff -r d2aacc06e562 -r 477d6a3e5023 en/ch07-branch.xml --- a/en/ch07-branch.xml Sun May 03 20:27:28 2009 -0700 +++ b/en/ch07-branch.xml Mon May 04 23:52:38 2009 -0700 @@ -183,15 +183,15 @@ after the revision you specified. This has an interaction with tags that can surprise the unwary. - Recall that a tag is stored as a revision to the .hgtags file, so that when you - create a tag, the changeset in which it's recorded necessarily - refers to an older changeset. When you run hg clone -r foo to clone a - repository as of tag foo, the new clone - will not contain the history that created the - tag that you used to clone the repository. The - result is that you'll get exactly the right subset of the + Recall that a tag is stored as a revision to + the .hgtags file. When you + create a tag, the changeset in which its recorded refers to an + older changeset. When you run hg clone + -r foo to clone a repository as of tag + foo, the new clone will not + contain any revision newer than the one the tag refers to, + including the revision where the tag was created. + The result is that you'll get exactly the right subset of the project's history in the new repository, but not the tag you might have expected. @@ -227,9 +227,10 @@ The flow of changes&emdash;big picture vs. little - To return to the outline I sketched at the beginning of a - chapter, let's think about a project that has multiple - concurrent pieces of work under development at once. + To return to the outline I sketched at the + beginning of the chapter, let's think about a project that has + multiple concurrent pieces of work under development at + once. There might be a push for a new main release; a new minor bugfix release to the last main release; and an @@ -416,7 +417,7 @@ If you have more than one named branch in a repository, Mercurial will remember the branch that your working directory - on when you start a command like hg + is on when you start a command like hg update or hg pull -u. It will update the working directory to the tip of this branch, no matter what the repo-wide tip diff -r d2aacc06e562 -r 477d6a3e5023 en/ch09-hook.xml --- a/en/ch09-hook.xml Sun May 03 20:27:28 2009 -0700 +++ b/en/ch09-hook.xml Mon May 04 23:52:38 2009 -0700 @@ -21,6 +21,12 @@ supports. We will revisit each of these hooks in more detail later, in . + Each of the hooks whose description begins with the word + Controlling has the ability to determine whether + an activity can proceed. If the hook succeeds, the activity may + proceed; if it fails, the activity is either not permitted or + undone, depending on the hook. + changegroup: This is run after a group of changesets has been brought into the @@ -87,12 +93,6 @@ finished. - Each of the hooks whose description begins with the word - Controlling has the ability to determine whether - an activity can proceed. If the hook succeeds, the activity may - proceed; if it fails, the activity is either not permitted or - undone, depending on the hook. - @@ -139,11 +139,11 @@ - XXX To see what hooks are defined in a repository, use the - hg config hooks command. If - you are working in one repository, but talking to another that - you do not own (e.g. using hg - pull or hg + To see what hooks are defined in a repository, + use the hg showconfig hooks + command. If you are working in one repository, but talking to + another that you do not own (e.g. using hg pull or hg incoming), remember that it is the other repository's hooks you should be checking, not your own. @@ -585,11 +585,11 @@ &interaction.ch09-hook.ws.better; - As a final aside, note in the example above the use of - perl's in-place editing feature to get rid - of trailing whitespace from a file. This is concise and - useful enough that I will reproduce it here. - + As a final aside, note in the example above the + use of sed's in-place editing feature to + get rid of trailing whitespace from a file. This is concise + and useful enough that I will reproduce it here (using + perl for good measure). perl -pi -e 's,\s+$,,' filename @@ -817,10 +817,7 @@ role="rc-item-bugzilla">version: The version of Bugzilla installed on the server. The database schema that Bugzilla uses changes occasionally, so this - hook has to know exactly which schema to use. At the - moment, the only version supported is - 2.16. - + hook has to know exactly which schema to use. host: The hostname of the MySQL server that stores your diff -r d2aacc06e562 -r 477d6a3e5023 en/examples/auto-snippets.xml --- a/en/examples/auto-snippets.xml Sun May 03 20:27:28 2009 -0700 +++ b/en/examples/auto-snippets.xml Mon May 04 23:52:38 2009 -0700 @@ -57,6 +57,15 @@ + + + + + + + + + @@ -88,6 +97,19 @@ + + + + + + + + + + + + + diff -r d2aacc06e562 -r 477d6a3e5023 en/examples/daily.copy --- a/en/examples/daily.copy Sun May 03 20:27:28 2009 -0700 +++ b/en/examples/daily.copy Mon May 04 23:52:38 2009 -0700 @@ -51,9 +51,9 @@ cd copy-example echo a > a echo b > b -mkdir c -mkdir c/a -echo c > c/a/c +mkdir z +mkdir z/a +echo c > z/a/c hg ci -Ama #$ name: simple @@ -70,13 +70,13 @@ #$ name: dir-src -hg copy c e +hg copy z e #$ name: dir-src-dest -hg copy c d +hg copy z d #$ name: after -cp a z -hg copy --after a z +cp a n +hg copy --after a n diff -r d2aacc06e562 -r 477d6a3e5023 en/examples/tour --- a/en/examples/tour Sun May 03 20:27:28 2009 -0700 +++ b/en/examples/tour Mon May 04 23:52:38 2009 -0700 @@ -151,13 +151,18 @@ cp hello.c ../new-hello.c sed -i '/printf("hello,/i\\tprintf("once more, hello.\\n");' ../new-hello.c +my-text-editor() +{ +cp ../new-hello.c hello.c +} + #$ name: merge.clone cd .. hg clone hello my-new-hello cd my-new-hello -# The file new-hello.c is lightly edited. -cp ../new-hello.c hello.c +# Make some simple edits to hello.c. +my-text-editor hello.c hg commit -m 'A new hello for a new day.' #$ name: merge.dummy2