Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

使用 Mercurial

安装和配置 Mercurial

See Installing Mercurial. Even if you already have Mercurial installed, make sure

  • you're running the most recent version, and
  • it's configured appropriately (see the instructions on the installation page).

我应如何...

我怎么才能一窥 Mozilla?

To clone the main development repository for Gecko and Firefox use:

hg clone https://hg.mozilla.org/mozilla-central/ src
cd src

For the list of other repositories see Getting Mozilla Source Code Using Mercurial.

如何编辑和更新文件?

You can randomly edit files in the working directory, just like with CVS.

The common command to update a tree is:

hg pull -u

It is not possible to update only one directory; you have to update the entire tree.

如何才能 diff 和 patch 文件?

  • hg diff diffs the entire tree by default. Use hg diff <dir> to diff only the given directory. Don't forget to hg add any new files you are adding before generating the patch.
  • If you are changing binary files or renaming files you may want to use git style patches with hg diff -g to retain that sort of information in the patch.
  • When applying a patch generated by Mercurial, use patch -p1, not patch -p0. (This is due to a quirk of Mercurial diff output—it refers to fictional "a" and "b" directories. Don't ask.).
  • If you have a git style patch with renames and/or binary changes you can use hg import --no-commit to apply the patch to your tree or use hg qimport to import the patch to mq.
  • There's hg qimportbz extension (blog post) that lets you import patches directly from bugzilla to mq.   (Since that blog post was written, the command syntax has changed.  It is now: hg qimport bz://1234567)
  • If you have it, git-apply can also be used to apply patches. It can handle most forms of Mercurial diff output, but it won't automatically tell Mercurial about added, copied, removed or renamed files, and it cannot reverse binary changes (except to remove added binary files).

Preferred diff options are hg diff -p -U 8 which includes 8 lines of context and shows the relevant function for the block. You can make these options default in the Mercurial configuration file.

How can I generate a patch for somebody else to check-in for me?

If you don't have commit access yourself, you need to attach your patches to a bug for somebody to check in.  In order to do that, you should make sure that your patch has the following conditions:

  1. It has a correctly formatted author name.
  2. It has a correctly formatted commit message.
  3. It is generated in git style.

Here is a very easy way to get this setup working using mq.  First, you need to edit your ~/.hgrc file.  You only need to do this once.  Your hgrc file should have the following contents at least:

[ui]
username = John Smith <[email protected]>

[defaults]
qnew = -Ue

[extensions]
mq =

[diff]
git = 1
showfunc = 1
unified = 8 

Now, in order to create a patch, you should enter:

hg qnew name.patch

which opens up your favorite editor so that you can enter a good commit message.  A good sample commit message looks like: "Bug 123456 - Change this thing to work better by doing something; r=reviewers".  You don't need to enter the final commit message (for example, if you haven't received reviews yet).  You can edit the commit message of the current mq patch at any time using hg qref -e.

The ~/.hgrc default -U argument for the qnew command add the author information to the patch (using a From: header), and the default -e argument opens up the editor for you to type in a commit message.

Now, after editing some source code, you can use hg qref to update your patch file.

To attach the patch to the bug, you can use the file named name.patch located in your <repository>/.hg/patches directory directly.

I'm all used to git, but how can I provide Mercurial-ready patches ?

Please refer to https://github.com/jlebar/moz-git-tools and especially the git-patch-to-hg-patch tool, that provides an easy way to convert from git-generated patch to Mercurial-ready ones.

Usage is pretty straight-forward:

$ git-patch-to-hg-patch YourGitGeneratedPatch.patch

How do I check stuff in?

Required configuration

Before committing any changes, add these lines to your ~/.hgrc file:

[ui]
username = Your Name <[email protected]>

To push to mozilla-central and other mozilla-hosted repositories you have to have committer access, and you must edit the file (your-local-hg-root)/.hg/hgrc (note, this is NOT your ~/.hgrc) to add this line:

[paths]
default = https://hg.mozilla.org/mozilla-central/
default-push = ssh://hg.mozilla.org/mozilla-central/

You also have to tell ssh what username to use when connecting to hg.mozilla.org. This should be the username associated with your Mozilla LDAP account. You can do this either by making the default-push path above more complicated ([email protected]@hg.mozilla.org) or by adding lines to your ~/.ssh/config :

Host hg.mozilla.org
User [email protected]

Check what you're going to commit

Next, to check if you're really committing what you want to commit (especially important when doing merges or other trickier commits):

hg status
hg diff

status shows the files that have changed in your working directory compared to what's in your repository (the parent revisions, which you can see by using hg parents). hg diff shows the actual changes in those files, as unified diffs. You can add a -U8 option to see more context.

Commit to the local repository

As the next step, you will commit your changes to your local repository:

hg commit

This commits every change reported by hg status. You can limit the commit to specific files or directories using hg commit filenames. You can commit on behalf of someone else using hg commit -u "Someone Else <[email protected]>". See hg help commit for more details.

To add new files to the repository and to remove obsolete ones use

hg addremove

Check what you're going to push

Before you push, you likely want to check what changesets will be pushed. You can do this using the outgoing command:

hg outgoing

This will give you a list of changesets that will be pushed to the default remote repository. Add a repository argument to see outgoing changesets for another repository.

Push to the central repository

To push those changes upstream to the central repository:

hg push

Preventing accidental pushes

Since the qpush command can easily be mistyped as push, it can cause an accidental push when applying an MQ patch was intended instead. To prevent accidental pushes you can add the following hook in your ~/.hgrc file:

[hooks]
pre-push = printf 'Are you sure you want to push to remote? (y/n): '; read R; [ x"$R" == "xy" ]

This will cause the push command to request confirmation each time it is invoked and abort if the user types anything but y.

How do I deal with "abort: push creates new remote heads!"?

Whatever you do, don't do 'push -f' like the message suggests. (It'll probably fail anyway, but don't try it.)

Someone pushed new commits upstream since your last pull. You then committed your patch locally and are trying to push that commit upstream; that upstream has a different tip commit that you started from.

  YOU ---> o  9123b7791b52 - Kaitlin Jones <[email protected]> - Bug 123456 - Trebled fromps (r=gavin)
           | 
TRUNK ---> | o  306726089e22 - Robert Longson <[email protected]> - Bug 437448. New-style nsSVGString
           | | 
           | o  ba9b9a7c52a5 - Robert Longson <[email protected]> - Bug 437448. New-style nsSVGString
           |/
           o  f8f4360bf155 - Robert O'Callahan <[email protected]> - Bug 421436. Remove hack that gives

There are three things you can do. In all cases, you are strongly encouraged to take steps to back up your patch (perhaps by obtaining a diff: hg log -p -r 12345 to show the patch for rev 12345).

Using hg merge

Run hg pull, then hg merge. If there are any merge conflicts, hg will open a merge program to try to help you resolve them manually. (If you fail to make sense of the merge tool, that's OK.  Just close it; hg will detect that the conflicts weren't all resolved and spit out some hg update -C commands that you can use to undo and then retry the busted merge.)

Even if there were no conflicts, you have to commit the merge: hg commit -m "Merge bug 123456".

  YOU ---> o 1fe7659c29a9 - Kaitlin Jones <[email protected]> - Merge bug 123456.
           |\
           o | 9123b7791b52 - Kaitlin Jones <[email protected]> - Bug 123456 - Trebled fromps (r=gavin)
           | |
TRUNK ---> | o  306726089e22 - Robert Longson <[email protected]> - Bug 437448. New-style nsSVGString
           | | 
           | o  ba9b9a7c52a5 - Robert Longson <[email protected]> - Bug 437448. New-style nsSVGString
           |/
           o  f8f4360bf155 - Robert O'Callahan <[email protected]> - Bug 421436. Remove hack that gives

Now you can hg push as normal.

This leaves a merge commit in the log, which some people find annoying, so it's usually better to avoid this solution.

If you decide to use this method, it is advantageous to enable the Mercurial fetch extension (by means of a fetch = line in the [extensions] section of your <repository>/.hg/hgrc or your $HOME/.hgrc file) so you can do the pull + merge + commit sequence in one step (assuming no merge conflicts) by using the hg fetch command.

Using Mercurial queues

A way to solve your problem without leaving a merge commit is to import your commit into mq control, pop it off the queue, update, and then commit it again before pushing:

% hg log -l 5
415[tip]   d1accb6ee840   2008-04-30 09:57 -0700   vladimir
  b=430873; fast path drawImage with a canvas as source
414   3a3ecbb4873e   2008-04-30 09:55 -0700   vladimir
  cvs sync
% hg qimport -r 415
Turn the new commit you made into a MQ patch
% hg qtop
415.diff
% hg qpop
Patch queue now empty
Pop the MQ patch off the stack. At this point, the tip of your tree is also in the remote repository
% hg pull -u
... various pull/update messages ...
% hg qpush
applying 415.diff
Now at: 415.diff
Fix up conficts as necessary; if you fixed up any, run hg qrefresh first
% hg incoming
comparing with ssh://hg.mozilla.org/mozilla-central/
searching for changes
no changes found
Make sure	nobody pushed while you were merging. Otherwise, qpop, pull and qpush again
% hg qfinish 415.diff
Turn the MQ patch into a regular revision
% hg log -l 5
verify that the log looks good, with your commit on top
% hg push

If you already use mq to manage your patches, then just make sure you pull/update right before committing and pushing your patch. If you have problems with the above, it's ok to just do a simple merge as described previously.

In this case, if there are merge conflicts, MQ will produce .rej files. Some people prefer this over being thrown into a merge program.

Using hg rebase

(Requires Mercurial 1.1 or higher)

This is the simplest and easiest way to deal with the problem. You can rebase your local changesets (including mq patches) on top of the tip using the rebase extension. To do this, simply enable the extension by adding this to the following section of your .hgrc:

[extensions]
hgext.rebase =

Now, type hg pull --rebase to pull and rebase your local changesets at the same time. More details and options can be found at the Mercurial wiki.

If you have conflicting changes, you'll be thrown into your preferred merge tool.

Note: As of Mercurial 1.1, rebasing (especially with mq patches) might lose rename data; this is a known bug that has been fixed in Mercurial 1.3. 
Note: If you had done a normal hg pull without --rebase after your hg commit, you will have to first undo that by doing hg rollback. Only the very last action can be undone, so if you did anything else after the hg pull, you're out of luck.
Note: If you have local changes, hg pull --rebase (just like hg merge) will refuse to work, so you'll have to revert your local changes first:
hg diff > old.diff
hg revert .
hg pull --rebase
hg push
patch -p 1 -i old.diff
rm old.diff

How do I see what these commands will do before I do them?

If you want to see what hg commit will commit, run hg diff first.

If you want to see what hg push will push, run hg outgoing first.

If you want to see what hg pull will pull, run hg incoming first.

These pairs of commands all take similar arguments, for good reason. These are a good idea to use all the time when you're learning mercurial. And even once you're an expert, always doing outgoing before push is a good idea.

How can I customize the format of the patches Mercurial creates?

Edit your ~/.hgrc file and add some lines like these:

[defaults]
diff=-U 8 -p
qdiff=-U 8
#for Mercurial 1.1 use:
#qdiff=-U 8 -p
[diff]
git=true

The [defaults] section affects the default output of the hg diff and hg qdiff commands. The options behave the same as they would on the command line. Try hg help diff for more info.

The [diff] section affects all patches generated by Mercurial, even hg export and those generated for Mercurial's internal use. You need to be a lot more careful with this, but git=true is recommended. Without it, Mercurial cannot diff binary files and does not track the execute mode bit.  You may want to add showfunc=true here to get diffs that show the function being changed in each hunk, and you may want to add unified=8 to make all diffs (including the internal ones mq uses) have 8 lines of context. Note that this may increase the risk of mq patches failing to apply!

How do I get a diff -w?

There is a known issue where hg diff -w doesn't work.

To get around this add the following to your ~/.hgrc file, editing existing sections where applicable:

[extensions]
hgext.extdiff =

[extdiff]
cmd.diffw = diff
opts.diffw = -w -r -N -p -U 8

You can, of course, add your other favourite diff options to opts.diffw. Once you've added this, you will now have a new hg command, hg diffw.

hg diffw -r -2 is the equivalent of hq qdiff -w for the topmost patch in the queue.

How do I generate a bundle?

Sometimes the tree will be under sheriff control, and they will specifically ask for a bundle.  If you don't have sufficient rights to push to mozilla-central, you might also generate bundles and attach them to bugs when you add checkin-needed to a bug after it has the necessary reviews and approval.

Creating a bundle is quite simple.  Once you have your changes all done, commit them to your local repository.  You can also commit more than one changeset.  Once you have everything committed, instead of pushing you'll run hg bundle:

hg bundle outputfile.hg

By default, hg bundle will bundle everything that hg outgoing would display (and what you would push with hg push).  You can limit how far forward you want to bundle as well by specifying a revision with -r.  That will take all changes up until that revision.

Backing out changes

Reverting the whole tree to a known-good revision

It's easy, like using a sledgehammer is easy. But this is usually overkill.

$ hg pull -u
$ hg revert --all -r a0193d83c208       # use your known-good revision id here
$ hg commit                             # be kind, include the revision id in your commit message
$ hg push

There's a more precise alternative:

Backing out a single changeset

Suppose changeset f8f4360bf155 broke something.

$ hg pull -u
$ hg backout f8f4360bf155               # use the revision id of the bad change here

This creates and commits a new changeset that reverts all the changes in that revision.

If you see this message:

the backout changeset is a new head - do not forget to merge

That means you need to merge, because your history now looks like this:

  YOU ---> o  9123b7791b52 - Kaitlin Jones <[email protected]> - Backed out changeset f8f4360bf155
           | 
TRUNK ---> | o  4e5bfb83643f - Simon Montagu <[email protected]> - imported patch 435856
           | | 
           | o  6ee23de41631 - Phil Ringnalda <[email protected]> - Bug 438526 - Opening links w
           | | 
           | o  22baa05d0e8a - Robert O'Callahan <[email protected]> - Remove DOM testcase from exclusi
           | | 
           | o  c1aec2094f7e - Robert Longson <[email protected]> - Bug 437448. New-style nsSVGString
           | | 
           | o  306726089e22 - Robert Longson <[email protected]> - Bug 437448. New-style nsSVGString
           | | 
           | o  ba9b9a7c52a5 - Robert Longson <[email protected]> - Bug 437448. New-style nsSVGString
           |/
           o  f8f4360bf155 - Robert O'Callahan <[email protected]> - Bug 421436. Remove hack that gives
           |
           ⋮ (the past)

Your backout changeset is based on an old revision. It doesn't contain more recent changes.

Handle this like any other merge. If you've never done a merge before, get help. (It could be trivial or it could be a huge headache. There's plenty about merging elsewhere in this FAQ.)

Backing out multiple changesets that are not at tip

Your push of many changesets was bad, but you didn't find out until after a lot of subsequent activity. You want to back out the bad but keep the probably-good changesets from the subsequent activity.

NB: this is hard, error-prone, and will likely b0rk your local tree if you mess up. If in doubt, ask someone else to do it for you.

What one would really like to do is

hg backout --from-rev $FIRST_BAD --to-rev $LAST_BAD

or, if local hg could access pushlog

hg backout --push $LAST_BAD

but, since hg can't do either (yet), we're stuck. What we'll do instead is travel back in hg-time to the last bad cset, revert all changes between last-bad and last-good, then merge that reversion to the current tip. Your tree might look like

 MERGE_TO ---> @  c6abfc89215a - Chris Pearce <[email protected]> - Bug 485288 - Replace all usage of video  autobuffer attribute with preload=auto. a=test-fix
               |
               o  d6e8fddeb95b - Chris Pearce <[email protected]> - Bug 548523 - Disable test_preload_actions.html case 9 until bug 568402 is fixed. a=test-fix
               |
               o  571d2664ead0 - Chris Pearce <[email protected]> - Bug 548523 - Don't show throbber on video controls if we're not loading a resource. r=dolske a=blocking2.0
               |
               o  3f7dfabab5e4 - Rich Dougherty <[email protected]>, Chris Pearce <[email protected]> - Bug 548523 - Replace HTMLMediaElement.autobuffer attribute with 'preload'. r=roc a=blocking2.0
               |
               o  d7d9cf4ab76a - Chris Pearce <[email protected]> - Bug 519897 - Supported indexed Ogg files. r=doublec
               |
               o    2a0e5811ece9 - Chris Pearce <[email protected]> - Commit merge of backout of 66dcf25705f9. a=backout
               |\
               | o  958a30df30dd - Chris Pearce <[email protected]> - Backed out changeset 66dcf25705f9
               | |
               o |  6eead86e13dd - Michael Wu <[email protected]> - Bug 556644 - Yet another removed-files.in update, r=rs a=blocking-beta5
               | |
               o |  69c6ce104f45 - Chris Jones <[email protected]> - Bug 588216: Avoid race between IO-thread loop->PostTask() and main-thread loop->SetNestableTasksAllowed() that led to Tasks being ignored. r=bent
               | |
               o |  73899b33ca4b - Ben Turner <[email protected]> - Bug 576716 - 'Crash [@ TypedArrayTemplate<int>::init] or [@ TypedArrayTemplate<int>::create]'. Adding a test, r=vlad a=blocker
               | |
               o |  3bd62d459019 - Mark Banner <[email protected]> - Follow up to bug 587984 bustage fix for l10n repacks. r=Pike,ted,a=bustage-fix
               | |
               o |  e1ca9091e5a6 - Benjamin Stover <[email protected]> - Bug 575731: Make test more stable in the face of various themes. r,a=sicking
               | |
               o |  bb200e1f52b4 - Jonas Sicking <[email protected]> - Bug 550959: Require version 2.5 of python. r=ted a=sicking
               | |
               o |  992491c618de - Zack Weinberg <[email protected]> - Bug 576044 (12/12): fix assertions in nsStyleAnimation triggered by part 3.  r=dbaron  a2.0=dbaron
               | |
               o |  2f078585a0f6 - Zack Weinberg <[email protected]> - Bug 576044 (11/12): Make all assertions fatal in Declaration.h, Declaration.cpp, nsCSSDataBlock.h, nsCSSDataBlock.cpp, nsCSSValue.h, nsCSSValue.cpp, nsCSSProps.h, and nsCSSProps.cpp.  r=dbaron  a2.0=dbaron
               | |
               o |  5a9bd15fd7a8 - Zack Weinberg <[email protected]> - Bug 576044 (10/12): Don't directly manipulate the contents of mTempData in the CSS parser.  r=dbaron  a2.0=dbaron
               | |
               o |  4bb2e0074aeb - Zack Weinberg <[email protected]> - Bug 576044 (9/12): Add an AddLonghandProperty method to nsCSSExpandedDataBlock.  r=dbaron  a2.0=dbaron
               | |
               o |  659a0864e035 - Zack Weinberg <[email protected]> - Bug 576044 (8/12): remove the last MoveValue call from the CSS parser.  r=dbaron  a2.0=dbaron
               | |
               o |  980f0170d982 - Zack Weinberg <[email protected]> - Bug 576044 (7/12): cleanup pass on css/Declaration.{h,cpp} and nsCSSDataBlock.{h,cpp}.  r=dbaron  a2.0=dbaron
               | |
               o |  f09c1638d3c1 - Zack Weinberg <[email protected]> - Bug 576044 (6/12): remove vestiges of nsCSSType.  r=dbaron  a2.0=dbaron
               | |
               o |  b88472b0af90 - Zack Weinberg <[email protected]> - Bug 576044 (5/12): eliminate ValueList as a storage type.  r=dbaron  a2.0=dbaron
               | |
               o |  a3e21759b570 - Zack Weinberg <[email protected]> - Bug 576044 (4/12): eliminate ValuePairList as a storage type.  r=dbaron  a2.0=dbaron
               | |
               o |  ed89c9e297ab - Zack Weinberg <[email protected]> - Bug 576044 (3/12): eliminate Rect as a storage type.  r=dbaron  a2.0=dbaron
               | |
               o |  4fc85e572c38 - Zack Weinberg <[email protected]> - Bug 576044 (2/12): eliminate ValuePair as a storage type.  r=dbaron  a2.0=dbaron
               | |
               o |  301875d4f9b6 - Zack Weinberg <[email protected]> - Bug 576044 (1/12): Move all the CSS 'storage types' (rect, value pair, etc) to nsCSSValue.h and their code to nsCSSValue.cpp.  r=dbaron  a2.0=dbaron
               | |
 LAST_BAD ---> o |  90ad165ae21b - Chris Jones <[email protected]> - Bug 582057, part i: Use nsIWidget::CreateChild in nsIView::CreateWidget* (where possible). r=roc a=blocking-fennecb1
               | |
               o |  037a5d6b376a - Chris Jones <[email protected]> - Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
               | |
               o |  f1af117d4598 - Chris Jones <[email protected]> - Bug 582057, part g: Split nsIView::CreateWidget into CreateWidget, CreateWidgetForParent, and CreateWidgetForPopup in preparation of eliminating IIDs here. sr=roc
               | |
               o |  5bf0b315a5aa - Chris Jones <[email protected]> - Bug 582057, part f: Split out window initialization code in preparation for multiple CreateWidget* methods. r=roc
               | |
               o |  353da995af6f - Chris Jones <[email protected]> - Bug 582057, part e: Simplify the logic for creating popup widgets. r=roc
               | |
               o |  7735c00eabe9 - Chris Jones <[email protected]> - Bug 582057, part d: Simplify nsView::LoadWidget and return early if it fails. r=roc
               | |
               o |  7b17bcefb174 - Chris Jones <[email protected]> - Bug 582057, part c: Initialize default widget init data earlier so that it's always available. r=roc
               | |
               o |  c5945b6a97ed - Chris Jones <[email protected]> - Bug 582057, part b: Remove nsIDeviceContext::SupportsNativeWidgets because it's not used meaningfully, and will be confusing in content processes. sr=roc
               | |
               o |  5452db293694 - Chris Jones <[email protected]> - Bug 582057, part a: Add nsIView::Impl() and nsView::CreateWidget() to get rid of |static_cast<nsview*>(this)|. r=roc
               | |
               o |  9407827b5166 - Chris Jones <[email protected]> - Bug 582075, part 0.5: Add support for aInitData=NULL to the Windows nsWindow implementation. r=dougt
               | |
               o |  88a279b64473 - Chris Jones <[email protected]> - Bug 582057, part 0: Log the repaint region bounding rect in DumpPaintEvent. r=roc
               | |
               o |  cebb111fbfc4 - Robert O'Callahan <[email protected]> - Bug 585817. Part 3: Remove nsSVGUtils::GetThebesComputationalSurface and use gfxPlatform::ScreenReferenceSurface instead. r=jwatt
               | |
               o |  7b3726c3a580 - Robert O'Callahan <[email protected]> - Bug 585817. Part 2: Change nsIPresShell::CreateRenderingContext to GetReferenceRenderingContext, that uses the shared 1x1 surface, and use it all over the place. r=mats,sr=dbaron
               | |
FIRST_BAD ---> o |  b3e968d831ec - Robert O'Callahan <[email protected]> - Bug 585817. Part 1: Create a single static 1x1 surface in gfxPlatform that can be used to create contexts for text measurement etc. r=vlad
               | |
LAST_GOOD ---> o |  55ef0e0529bc - Mounir Lamouri <[email protected]> - Bug 506554 - Implement the CSS3 pseudo-classes :required and :optional for HTML. r=sicking sr=bz a2.0=blocking
               | |
</int></int>

We want to erase all changes between $FIRST_BAD and $LAST_BAD, then merge to $MERGE_TO

$ MERGE_TO="c6abfc89215a"
$ LAST_BAD="90ad165ae21b"
$ LAST_GOOD="55ef0e0529bc"
$ hg up -r $LAST_BAD
90 files updated, 0 files merged, 4 files removed, 0 files unresolved

We just traveled back in time to the last cset we want to nuke. Now we'll revert the changes between $FIRST_BAD and $LAST_BAD.

$ hg revert --all --no-backup -r $LAST_GOOD
reverting accessible/src/msaa/nsTextAccessibleWrap.cpp
reverting content/svg/content/src/SVGMotionSMILPathUtils.h
reverting content/svg/content/src/nsSVGPathElement.cpp
reverting gfx/src/nsIDeviceContext.h
reverting gfx/src/thebes/nsThebesDeviceContext.cpp
reverting gfx/src/thebes/nsThebesDeviceContext.h
reverting gfx/thebes/gfxPlatform.cpp
reverting gfx/thebes/gfxPlatform.h
reverting layout/base/nsCSSFrameConstructor.cpp
reverting layout/base/nsDocumentViewer.cpp
reverting layout/base/nsIPresShell.h
reverting layout/base/nsPresShell.cpp
reverting layout/build/nsLayoutStatics.cpp
reverting layout/generic/nsFrameFrame.cpp
reverting layout/generic/nsObjectFrame.cpp
reverting layout/generic/nsSimplePageSequence.cpp
reverting layout/generic/nsTextFrameThebes.cpp
reverting layout/inspector/src/inFlasher.cpp
reverting layout/printing/nsPrintEngine.cpp
reverting layout/svg/base/src/nsSVGForeignObjectFrame.cpp
reverting layout/svg/base/src/nsSVGGlyphFrame.cpp
reverting layout/svg/base/src/nsSVGImageFrame.cpp
reverting layout/svg/base/src/nsSVGPathGeometryFrame.cpp
reverting layout/svg/base/src/nsSVGUtils.cpp
reverting layout/svg/base/src/nsSVGUtils.h
reverting layout/xul/base/src/nsMenuPopupFrame.cpp
reverting layout/xul/base/src/nsSplitterFrame.cpp
reverting layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
reverting view/public/nsIView.h
reverting view/src/nsView.cpp
reverting view/src/nsView.h
reverting widget/public/nsIWidget.h
reverting widget/src/beos/nsWindow.h
reverting widget/src/cocoa/nsChildView.h
reverting widget/src/cocoa/nsCocoaWindow.h
reverting widget/src/windows/nsWindow.cpp
reverting widget/src/xpwidgets/nsBaseWidget.cpp
reverting widget/src/xpwidgets/nsBaseWidget.h
$ hg commit -m 'Back out bug 585817 and bug 582057'
created new head

After committing the reversion, we now have a new head that doesn't include the probably-good changes after $LAST_BAD.

@  1767c1fb9418 - Chris Jones <[email protected]> - Back out bug 585817 and bug 582057
|
| o  c6abfc89215a - Chris Pearce <[email protected]> - Bug 485288 - Replace all usage of video  autobuffer attribute with preload=auto. a=test-fix
| |
| o  d6e8fddeb95b - Chris Pearce <[email protected]> - Bug 548523 - Disable test_preload_actions.html case 9 until bug 568402 is fixed. a=test-fix
| |
| o  571d2664ead0 - Chris Pearce <[email protected]> - Bug 548523 - Don't show throbber on video controls if we're not loading a resource. r=dolske a=blocking2.0
| |
| o  3f7dfabab5e4 - Rich Dougherty <[email protected]>, Chris Pearce <[email protected]> - Bug 548523 - Replace HTMLMediaElement.autobuffer attribute with 'preload'. r=roc a=blocking2.0
| |
| o  d7d9cf4ab76a - Chris Pearce <[email protected]> - Bug 519897 - Supported indexed Ogg files. r=doublec
| |
| o    2a0e5811ece9 - Chris Pearce <[email protected]> - Commit merge of backout of 66dcf25705f9. a=backout
| |\
| | o  958a30df30dd - Chris Pearce <[email protected]> - Backed out changeset 66dcf25705f9
| | |
| o |  6eead86e13dd - Michael Wu <[email protected]> - Bug 556644 - Yet another removed-files.in update, r=rs a=blocking-beta5
| | |
| o |  69c6ce104f45 - Chris Jones <[email protected]> - Bug 588216: Avoid race between IO-thread loop->PostTask() and main-thread loop->SetNestableTasksAllowed() that led to Tasks being ignored. r=bent
| | |
| o |  73899b33ca4b - Ben Turner <[email protected]> - Bug 576716 - 'Crash [@ TypedArrayTemplate<int>::init] or [@ TypedArrayTemplate<int>::create]'. Adding a test, r=vlad a=blocker
| | |
| o |  3bd62d459019 - Mark Banner <[email protected]> - Follow up to bug 587984 bustage fix for l10n repacks. r=Pike,ted,a=bustage-fix
| | |
| o |  e1ca9091e5a6 - Benjamin Stover <[email protected]> - Bug 575731: Make test more stable in the face of various themes. r,a=sicking
| | |
| o |  bb200e1f52b4 - Jonas Sicking <[email protected]> - Bug 550959: Require version 2.5 of python. r=ted a=sicking
| | |
| o |  992491c618de - Zack Weinberg <[email protected]> - Bug 576044 (12/12): fix assertions in nsStyleAnimation triggered by part 3.  r=dbaron  a2.0=dbaron
| | |
| o |  2f078585a0f6 - Zack Weinberg <[email protected]> - Bug 576044 (11/12): Make all assertions fatal in Declaration.h, Declaration.cpp, nsCSSDataBlock.h, nsCSSDataBlock.cpp, nsCSSValue.h, nsCSSValue.cpp, nsCSSProps.h, and nsCSSProps.cpp.  r=dbaron  a2.0=dbaron
| | |
| o |  5a9bd15fd7a8 - Zack Weinberg <[email protected]> - Bug 576044 (10/12): Don't directly manipulate the contents of mTempData in the CSS parser.  r=dbaron  a2.0=dbaron
| | |
| o |  4bb2e0074aeb - Zack Weinberg <[email protected]> - Bug 576044 (9/12): Add an AddLonghandProperty method to nsCSSExpandedDataBlock.  r=dbaron  a2.0=dbaron
| | |
| o |  659a0864e035 - Zack Weinberg <[email protected]> - Bug 576044 (8/12): remove the last MoveValue call from the CSS parser.  r=dbaron  a2.0=dbaron
| | |
| o |  980f0170d982 - Zack Weinberg <[email protected]> - Bug 576044 (7/12): cleanup pass on css/Declaration.{h,cpp} and nsCSSDataBlock.{h,cpp}.  r=dbaron  a2.0=dbaron
| | |
| o |  f09c1638d3c1 - Zack Weinberg <[email protected]> - Bug 576044 (6/12): remove vestiges of nsCSSType.  r=dbaron  a2.0=dbaron
| | |
| o |  b88472b0af90 - Zack Weinberg <[email protected]> - Bug 576044 (5/12): eliminate ValueList as a storage type.  r=dbaron  a2.0=dbaron
| | |
| o |  a3e21759b570 - Zack Weinberg <[email protected]> - Bug 576044 (4/12): eliminate ValuePairList as a storage type.  r=dbaron  a2.0=dbaron
| | |
| o |  ed89c9e297ab - Zack Weinberg <[email protected]> - Bug 576044 (3/12): eliminate Rect as a storage type.  r=dbaron  a2.0=dbaron
| | |
| o |  4fc85e572c38 - Zack Weinberg <[email protected]> - Bug 576044 (2/12): eliminate ValuePair as a storage type.  r=dbaron  a2.0=dbaron
| | |
| o |  301875d4f9b6 - Zack Weinberg <[email protected]> - Bug 576044 (1/12): Move all the CSS 'storage types' (rect, value pair, etc) to nsCSSValue.h and their code to nsCSSValue.cpp.  r=dbaron  a2.0=dbaron
|/ /
o |  90ad165ae21b - Chris Jones <[email protected]> - Bug 582057, part i: Use nsIWidget::CreateChild in nsIView::CreateWidget* (where possible). r=roc a=blocking-fennecb1
| |
o |  037a5d6b376a - Chris Jones <[email protected]> - Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
| |
o |  f1af117d4598 - Chris Jones <[email protected]> - Bug 582057, part g: Split nsIView::CreateWidget into CreateWidget, CreateWidgetForParent, and CreateWidgetForPopup in preparation of eliminating IIDs here. sr=roc
| |
o |  5bf0b315a5aa - Chris Jones <[email protected]> - Bug 582057, part f: Split out window initialization code in preparation for multiple CreateWidget* methods. r=roc
| |
o |  353da995af6f - Chris Jones <[email protected]> - Bug 582057, part e: Simplify the logic for creating popup widgets. r=roc
| |
o |  7735c00eabe9 - Chris Jones <[email protected]> - Bug 582057, part d: Simplify nsView::LoadWidget and return early if it fails. r=roc
| |
o |  7b17bcefb174 - Chris Jones <[email protected]> - Bug 582057, part c: Initialize default widget init data earlier so that it's always available. r=roc
| |
o |  c5945b6a97ed - Chris Jones <[email protected]> - Bug 582057, part b: Remove nsIDeviceContext::SupportsNativeWidgets because it's not used meaningfully, and will be confusing in content processes. sr=roc
| |
o |  5452db293694 - Chris Jones <[email protected]> - Bug 582057, part a: Add nsIView::Impl() and nsView::CreateWidget() to get rid of |static_cast<nsview*>(this)|. r=roc
| |
o |  9407827b5166 - Chris Jones <[email protected]> - Bug 582075, part 0.5: Add support for aInitData=NULL to the Windows nsWindow implementation. r=dougt
| |
o |  88a279b64473 - Chris Jones <[email protected]> - Bug 582057, part 0: Log the repaint region bounding rect in DumpPaintEvent. r=roc
| |
o |  cebb111fbfc4 - Robert O'Callahan <[email protected]> - Bug 585817. Part 3: Remove nsSVGUtils::GetThebesComputationalSurface and use gfxPlatform::ScreenReferenceSurface instead. r=jwatt
| |
o |  7b3726c3a580 - Robert O'Callahan <[email protected]> - Bug 585817. Part 2: Change nsIPresShell::CreateRenderingContext to GetReferenceRenderingContext, that uses the shared 1x1 surface, and use it all over the place. r=mats,sr=dbaron
| |
o |  b3e968d831ec - Robert O'Callahan <[email protected]> - Bug 585817. Part 1: Create a single static 1x1 surface in gfxPlatform that can be used to create contexts for text measurement etc. r=vlad
| |
o |  55ef0e0529bc - Mounir Lamouri <[email protected]> - Bug 506554 - Implement the CSS3 pseudo-classes :required and :optional for HTML. r=sicking sr=bz a2.0=blocking
| |
</int></int>

We want to merge with those probably-good changesets. Note that if any of those probably-good changesets touched code you backed out, you'll need to resolve merge conflicts.

$ hg merge $MERGE_TO
92 files updated, 0 files merged, 2 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg commit -m 'Merge backout'

OK, good to go. Your tree should look something like

@    8fccc434c295 - Chris Jones <[email protected]> - Merge backout
|\
| o  1767c1fb9418 - Chris Jones <[email protected]> - Back out bug 585817 and bug 582057
| |
o |  c6abfc89215a - Chris Pearce <[email protected]> - Bug 485288 - Replace all usage of video  autobuffer attribute with preload=auto. a=test-fix
| |
o |  d6e8fddeb95b - Chris Pearce <[email protected]> - Bug 548523 - Disable test_preload_actions.html case 9 until bug 568402 is fixed. a=test-fix
| |
o |  571d2664ead0 - Chris Pearce <[email protected]> - Bug 548523 - Don't show throbber on video controls if we're not loading a resource. r=dolske a=blocking2.0
| |
o |  3f7dfabab5e4 - Rich Dougherty <[email protected]>, Chris Pearce <[email protected]> - Bug 548523 - Replace HTMLMediaElement.autobuffer attribute with 'preload'. r=roc a=blocking2.0
| |
o |  d7d9cf4ab76a - Chris Pearce <[email protected]> - Bug 519897 - Supported indexed Ogg files. r=doublec
| |
o |    2a0e5811ece9 - Chris Pearce <[email protected]> - Commit merge of backout of 66dcf25705f9. a=backout
|\ \
| o |  958a30df30dd - Chris Pearce <[email protected]> - Backed out changeset 66dcf25705f9
| | |
o | |  6eead86e13dd - Michael Wu <[email protected]> - Bug 556644 - Yet another removed-files.in update, r=rs a=blocking-beta5
| | |
o | |  69c6ce104f45 - Chris Jones <[email protected]> - Bug 588216: Avoid race between IO-thread loop->PostTask() and main-thread loop->SetNestableTasksAllowed() that led to Tasks being ignored. r=bent
| | |
o | |  73899b33ca4b - Ben Turner <[email protected]> - Bug 576716 - 'Crash [@ TypedArrayTemplate<int>::init] or [@ TypedArrayTemplate<int>::create]'. Adding a test, r=vlad a=blocker
| | |
o | |  3bd62d459019 - Mark Banner <[email protected]> - Follow up to bug 587984 bustage fix for l10n repacks. r=Pike,ted,a=bustage-fix
| | |
o | |  e1ca9091e5a6 - Benjamin Stover <[email protected]> - Bug 575731: Make test more stable in the face of various themes. r,a=sicking
| | |
o | |  bb200e1f52b4 - Jonas Sicking <[email protected]> - Bug 550959: Require version 2.5 of python. r=ted a=sicking
| | |
o | |  992491c618de - Zack Weinberg <[email protected]> - Bug 576044 (12/12): fix assertions in nsStyleAnimation triggered by part 3.  r=dbaron  a2.0=dbaron
| | |
o | |  2f078585a0f6 - Zack Weinberg <[email protected]> - Bug 576044 (11/12): Make all assertions fatal in Declaration.h, Declaration.cpp, nsCSSDataBlock.h, nsCSSDataBlock.cpp, nsCSSValue.h, nsCSSValue.cpp, nsCSSProps.h, and nsCSSProps.cpp.  r=dbaron  a2.0=dbaron
| | |
o | |  5a9bd15fd7a8 - Zack Weinberg <[email protected]> - Bug 576044 (10/12): Don't directly manipulate the contents of mTempData in the CSS parser.  r=dbaron  a2.0=dbaron
| | |
o | |  4bb2e0074aeb - Zack Weinberg <[email protected]> - Bug 576044 (9/12): Add an AddLonghandProperty method to nsCSSExpandedDataBlock.  r=dbaron  a2.0=dbaron
| | |
o | |  659a0864e035 - Zack Weinberg <[email protected]> - Bug 576044 (8/12): remove the last MoveValue call from the CSS parser.  r=dbaron  a2.0=dbaron
| | |
o | |  980f0170d982 - Zack Weinberg <[email protected]> - Bug 576044 (7/12): cleanup pass on css/Declaration.{h,cpp} and nsCSSDataBlock.{h,cpp}.  r=dbaron  a2.0=dbaron
| | |
o | |  f09c1638d3c1 - Zack Weinberg <[email protected]> - Bug 576044 (6/12): remove vestiges of nsCSSType.  r=dbaron  a2.0=dbaron
| | |
o | |  b88472b0af90 - Zack Weinberg <[email protected]> - Bug 576044 (5/12): eliminate ValueList as a storage type.  r=dbaron  a2.0=dbaron
| | |
o | |  a3e21759b570 - Zack Weinberg <[email protected]> - Bug 576044 (4/12): eliminate ValuePairList as a storage type.  r=dbaron  a2.0=dbaron
| | |
o | |  ed89c9e297ab - Zack Weinberg <[email protected]> - Bug 576044 (3/12): eliminate Rect as a storage type.  r=dbaron  a2.0=dbaron
| | |
o | |  4fc85e572c38 - Zack Weinberg <[email protected]> - Bug 576044 (2/12): eliminate ValuePair as a storage type.  r=dbaron  a2.0=dbaron
| | |
o---+  301875d4f9b6 - Zack Weinberg <[email protected]> - Bug 576044 (1/12): Move all the CSS 'storage types' (rect, value pair, etc) to nsCSSValue.h and their code to nsCSSValue.cpp.  r=dbaron  a2.0=dbaron
 / /
| o  90ad165ae21b - Chris Jones <[email protected]> - Bug 582057, part i: Use nsIWidget::CreateChild in nsIView::CreateWidget* (where possible). r=roc a=blocking-fennecb1
| |
| o  037a5d6b376a - Chris Jones <[email protected]> - Bug 582057, part h: Add an nsIWidget::CreateChild interface to sweep (relevant to this bug) code dealing with native widgets under the widget/src/* rug. sr=roc
| |
| o  f1af117d4598 - Chris Jones <[email protected]> - Bug 582057, part g: Split nsIView::CreateWidget into CreateWidget, CreateWidgetForParent, and CreateWidgetForPopup in preparation of eliminating IIDs here. sr=roc
| |
| o  5bf0b315a5aa - Chris Jones <[email protected]> - Bug 582057, part f: Split out window initialization code in preparation for multiple CreateWidget* methods. r=roc
| |
| o  353da995af6f - Chris Jones <[email protected]> - Bug 582057, part e: Simplify the logic for creating popup widgets. r=roc
| |
| o  7735c00eabe9 - Chris Jones <[email protected]> - Bug 582057, part d: Simplify nsView::LoadWidget and return early if it fails. r=roc
| |
| o  7b17bcefb174 - Chris Jones <[email protected]> - Bug 582057, part c: Initialize default widget init data earlier so that it's always available. r=roc
| |
| o  c5945b6a97ed - Chris Jones <[email protected]> - Bug 582057, part b: Remove nsIDeviceContext::SupportsNativeWidgets because it's not used meaningfully, and will be confusing in content processes. sr=roc
| |
| o  5452db293694 - Chris Jones <[email protected]> - Bug 582057, part a: Add nsIView::Impl() and nsView::CreateWidget() to get rid of |static_cast<nsview*>(this)|. r=roc
| |
| o  9407827b5166 - Chris Jones <[email protected]> - Bug 582075, part 0.5: Add support for aInitData=NULL to the Windows nsWindow implementation. r=dougt
| |
| o  88a279b64473 - Chris Jones <[email protected]> - Bug 582057, part 0: Log the repaint region bounding rect in DumpPaintEvent. r=roc
| |
| o  cebb111fbfc4 - Robert O'Callahan <[email protected]> - Bug 585817. Part 3: Remove nsSVGUtils::GetThebesComputationalSurface and use gfxPlatform::ScreenReferenceSurface instead. r=jwatt
| |
| o  7b3726c3a580 - Robert O'Callahan <[email protected]> - Bug 585817. Part 2: Change nsIPresShell::CreateRenderingContext to GetReferenceRenderingContext, that uses the shared 1x1 surface, and use it all over the place. r=mats,sr=dbaron
| |
| o  b3e968d831ec - Robert O'Callahan <[email protected]> - Bug 585817. Part 1: Create a single static 1x1 surface in gfxPlatform that can be used to create contexts for text measurement etc. r=vlad
| |
| o  55ef0e0529bc - Mounir Lamouri <[email protected]> - Bug 506554 - Implement the CSS3 pseudo-classes :required and :optional for HTML. r=sicking sr=bz a2.0=blocking
| |
$ hg out
comparing with https://hg.mozilla.org/mozilla-central
searching for changes
1767c1fb9418 - Chris Jones <[email protected]> - Back out bug 585817 and bug 582057
8fccc434c295 - Chris Jones <[email protected]> - Merge backout
</int></int>

Maintaining a branch of mozilla-central

Let foo be the project you are working on. We assume that the project directory will be https://hg.mozilla.org/projects/foo and is a branch of mozilla-central. We also assume that you want to push some patches on foo and periodically synchronize both repositories.

Modify hgrc

To make things simpler, you can modify the hgrc file in the repository. You can find it here: /path/to/repository/.hg/hgrc

Change it to:

[paths]
default = https://hg.mozilla.org/projects/foo
m-c = ssh://hg.mozilla.org/mozilla-central
default-push = ssh://hg.mozilla.org/projects/foo 

Synchronize mozilla-central and foo project

You can push to foo as you would push to any repository but you might want to keep in sync both repositories. To do that, you can run these commands:

hg pull -u   # Get all the changes to foo in your repo.
hg pull m-c  # Get all the changes to mozilla-central in your repo.
hg merge     # Here, the things might be complex and would need extra carefulness.
# resolve merge conflicts, if any
hg commit -m "Merge foo with mozilla-central."
hg push      # Push the merge to foo.
hg push m-c  # Push the changes to mozilla-central.

Help

Help, I can't push!

If you're trying to push, and you can't, first try this:

$ ssh hg.mozilla.org

If you see output like:

Permission denied (publickey,gssapi-with-mic).

it may have the following reasons:

If you see output like:

You are not allowed to use this system, go away!

then you need to file a bug in mozilla.org:Server Operations.

You should expect the ssh command to disconnect you immediately, since you're not supposed to have shell access. It may give the output:

Could not chdir to home directory : No such file or directory

which is harmless (although some people see it and some people don't).

If you see output like:

ssl required

then you need to configure your default-push correctly.

Branch merges

As part of the rapid release process, the contents of e.g. mozilla-aurora and mozilla-beta are subject to merge events that happen according to the planned branch migration dates. After a branch merge event occurred, if you attempt to use "hg update" in your local tree, you may get error messages such as "abort: crosses branches". In order to fix it, first make sure you don't have local changes, then run "hg update -C -r default".

Other

What's the difference between hg pull and hg update?

hg-diagram.png

hg pull copies changesets from one repository to another.  It only brings changes into your local repository, not your working copy.  It will touch the network if you're pulling from a remote repository.

hg update updates your working copy.  It only modifies your working copy.  It will not touch the network (unless your directory is on a network filesystem).

How does Mercurial handle line endings?

The Windows version of Mercurial does not automatically convert line endings between Windows and Unix styles. All our repositories use Unix line endings. We need a story for Windows, but right now I have no ideas.

(How about a pre-commit hook that rejects pushes containing CR with a suitably informative error message? We possibly want to make exceptions for certain types of files (at least binary files of course), but we can tweak the hook as necessary as these crop up. Mercurial 1.0 adds a standard hook for this in the win32text extension that we could use/adapt. --jwatt)

See Also

文档标签和贡献者

 此页面的贡献者: guoyunhebrave
 最后编辑者: guoyunhebrave,