diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 21:46:22 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 21:46:22 -0500 |
commit | a065e04d529da1d847b5062a12c46d916408bf32 (patch) | |
tree | fe0f8bcec1ff39a3c499a2708222dcf15224ff70 /files/zh-cn/mozilla/mercurial | |
parent | 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 (diff) | |
download | translated-content-a065e04d529da1d847b5062a12c46d916408bf32.tar.gz translated-content-a065e04d529da1d847b5062a12c46d916408bf32.tar.bz2 translated-content-a065e04d529da1d847b5062a12c46d916408bf32.zip |
update based on https://github.com/mdn/yari/issues/2028
Diffstat (limited to 'files/zh-cn/mozilla/mercurial')
-rw-r--r-- | files/zh-cn/mozilla/mercurial/basics/index.html | 56 | ||||
-rw-r--r-- | files/zh-cn/mozilla/mercurial/index.html | 43 | ||||
-rw-r--r-- | files/zh-cn/mozilla/mercurial/installing_mercurial/index.html | 145 |
3 files changed, 0 insertions, 244 deletions
diff --git a/files/zh-cn/mozilla/mercurial/basics/index.html b/files/zh-cn/mozilla/mercurial/basics/index.html deleted file mode 100644 index 26c4d7cb03..0000000000 --- a/files/zh-cn/mozilla/mercurial/basics/index.html +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: Mercurial basics -slug: Mozilla/Mercurial/Basics -translation_of: Mozilla/Mercurial/Basics ---- -<p>我要跟你啰嗦一些关于Mercurial的东西,它可以帮助您少入坑。本页言辞较喷且是以生存型为导向(什么是生存型请自行渡娘)。但我依然坚信Mercurial要比CVS强。——Jorendorff于2008年5月12日16:06(PDT)</p> - -<h3 id="Expectations" name="Expectations">期望什么</h3> - -<p><strong>Mercurial is not CVS.</strong> The commands aren't the same. The concepts aren't the same. <a href="/en/Mozilla/Mercurial/How_Is_Mercurial_different_from_CVS" title="en/Mozilla/Mercurial/How_Is_Mercurial_different_from_CVS">How is Mercurial different from CVS?</a></p> - -<p><strong>This gun is loaded.</strong> You can shoot yourself in the foot. You can lose work. The tool tries to protect you, but it can happen anyway. The two common failure modes are: (a) you run a command without knowing what it's going to do; (b) you <code>hg commit</code> or <code>hg qrefresh</code> with a mistaken understanding of the state of your working directory. So you accidentally commit changes that you didn't want to commit; or you accidentally commit a broken merge; etc. Often it's not immediately obvious that anything is wrong.</p> - -<p>Forewarned is forearmed. Don't do these things. Don't run commands without knowing what they're going to do—<code>hg help</code> is your friend. Don't commit without diffing and thinking. And don't let yourself get into "play mode" and stop paying attention to the fact that what you're playing with is your own uncommitted work.</p> - -<p><strong>Mercurial is not magic dust.</strong> Mercurial is flexible, powerful, and fun. It lets you attempt stuff you never would have tried in CVS. But of course not everything turns out to have been a good idea. (For example, we tried sharing patch queues. It sort of sucked.)</p> - -<h3 id="Avoiding_trouble" name="Avoiding_trouble">避免入坑</h3> - -<p><strong>Use the latest stable release of Mercurial.</strong></p> - -<p><strong>Learn how to get your bearings.</strong> Use read-only commands (like <code>hg status</code>, <code>hg head</code>, <code>hg parents</code>, <code>hg log</code>, <code>hg diff</code>, <code>hg outgoing</code>) to check the status of your repository. This is a key skill.</p> - -<p><strong>Configure a <a class="external" href="https://www.mercurial-scm.org/wiki/MergeToolConfiguration">merge program</a> and make sure you know how to use it. DO IT NOW.</strong> Otherwise you will likely screw up your repository at some point.</p> - -<p>Mercurial doesn't leave conflict markers in your files; instead, it wants you to fix the conflicts <em>immediately</em>, using a merge program (like <code>kdiff3</code>) which it can launch for you.</p> - -<p>This can be error-prone. By default, Mercurial uses the first merge program it finds on your system, and merge programs can have a learning curve. Mercurial does not do a good job of detecting busted merges and refusing to proceed, so just by closing a window you can unwittingly put yourself in a bad state. Bad merges may lead to seemingly inexplicable Mercurial behavior in the future.</p> - -<p><strong>If a merge fails, make sure Mercurial knows that it has failed.</strong> When you're first learning the ropes, merges often go wrong. You might see this message:</p> - -<pre class="eval">0 files updated, 0 files merged, 0 files removed, 1 files unresolved -There are unresolved merges, you can redo the full merge using: - hg update -C 2 - hg merge 1 -</pre> - -<p>This means some conflicts weren't resolved during the merge. If you don't know exactly what they are and how to fix them, use that <code>hg update -C</code> command to tell Mercurial that you've given up on that merge.</p> - -<p>If you don't, Mercurial won't know, and the next time you commit, it'll make a merge changeset. This is bad. The result can look a lot like accidentally destroying a bunch of work, actually, but the damage can be undone.</p> - -<p>If <code>hg parents</code> shows two parents, you're merging.</p> - -<p><strong>If you use <a href="/en/Mercurial_Queues" title="Mercurial_Queues">Mercurial Queues</a>, back up your work.</strong> <code>hg qrefresh</code> destructively replaces the old patch with the new one! Use <code>hg qinit -c</code> to create a separate backup repository for your patches and <code>hg commit --mq -m backup</code> regularly.</p> - -<p><strong>Don't use Mercurial Queues in a repository that someone might pull from since applied (non-public) patches would also be pulled.</strong></p> - -<h3 id="Recovering" name="Recovering">Recovering</h3> - -<p>握了个草! Mercurial 这么宝——Mercurial剁你手!</p> - -<p><strong>千万别轻易试玩(亵玩)</strong>Mercurial<strong>哦.</strong> 想想你的手,想想你的臂膀,别呀,你还可有个完整.</p> - -<p><strong>寻求帮助IRC频道.</strong> 在 Mozilla IRC 或 <a class="link-irc" href="irc://irc.freenode.net/mercurial">#mercurial on freenode</a> 中输入 <a class="link-irc" href="irc://irc.mozilla.org/hg">#hg</a> 或者 <a class="link-irc" href="irc://irc.mozilla.org/developers">#developers</a> .</p> - -<p> </p> diff --git a/files/zh-cn/mozilla/mercurial/index.html b/files/zh-cn/mozilla/mercurial/index.html deleted file mode 100644 index 64029a1d1e..0000000000 --- a/files/zh-cn/mozilla/mercurial/index.html +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: Mercurial -slug: Mozilla/Mercurial -tags: - - Developing Mozilla - - Mercurial - - NeedsTranslation - - TopicStub -translation_of: Mozilla/Mercurial ---- -<p> </p> - -<div class="note"> -<p><a href="https://mozilla-version-control-tools.readthedocs.org/en/latest/hgmozilla/index.html">Please refer to Mercurial For Mozillians at ReadTheDocs</a> for current best-practices around Mercurial, including many helpful extra tools and guidelines that make using Mercurial fast and easy.</p> -</div> - -<p><a class="external" href="https://www.mercurial-scm.org/"><strong>Mercurial</strong></a> (also known as "hg"), is the <a class="external" href="https://en.wikipedia.org/wiki/Distributed_revision_control">distributed version control</a> software used for the development of Firefox, Thunderbird, and the shared Gecko core. It replaced <a href="/en-US/docs/Developer_Guide/Source_Code/CVS" title="en-US/docs/Developer_Guide/Source_Code/CVS">CVS</a> after Mozilla 1.9 was branched.</p> - -<p><strong><code>hg</code></strong> is the Mercurial command-line tool, Hg being the chemical symbol for the element mercury.</p> - -<h2 id="Learning_to_use_Mercurial" name="Learning_to_use_Mercurial">Installation, configuration, and getting the source</h2> - -<p>See <a href="/en-US/docs/Installing_Mercurial" title="/en-US/docs/Installing_Mercurial">Installing Mercurial</a> for installation and configuration tips.</p> - -<p>See <a href="/en-US/docs/Developer_Guide/Source_Code/Mercurial" title="en-US/docs/Developer_Guide/Source_Code/Mercurial">Getting Mozilla Source Code Using Mercurial</a> for getting a tree to build.</p> - -<h2 id="Learning_to_use_Mercurial" name="Learning_to_use_Mercurial">Learning to use Mercurial</h2> - -<p>If you are new to Mercurial, you should start with the <a href="https://www.mercurial-scm.org/guide">official guide</a>.</p> - -<p>Then, move on to <a href="/en-US/docs/Mercurial_basics" title="en-US/docs/Mercurial_basics">Mercurial basics</a> and <a href="/en-US/docs/Mercurial_FAQ" title="en-US/docs/Mercurial_FAQ">Mercurial FAQ</a> and the <a href="https://mozilla-version-control-tools.readthedocs.org/en/latest/hgmozilla/">version control tool docs</a> for Mozilla-centric Mercurial information.</p> - -<h2 id="Further_reading" name="Further_reading">Further reading</h2> - -<p>The <a href="https://developer.mozilla.org/en-US/docs/tag/Mercurial" title="https://developer.mozilla.org/en-US/docs/tag/Mercurial">Mercurial tag</a> lists the Mercurial-related articles on MDN.</p> - -<p>And on wiki.mozilla.org, these helpful pages:</p> - -<ul> - <li>{{ interwiki('wikimo', 'Using_Mercurial_locally_with_CVS', 'Using Mercurial locally with CVS') }}, a how-to. (Note that this is only useful for code that's still exclusively in CVS.)</li> - <li>{{ interwiki('wikimo', 'Mercurial_on_Windows', 'Mercurial on Windows') }}</li> - <li><a href="/en-US/docs/Creating_Mercurial_User_Repositories" title="en-US/docs/Creating_Mercurial_User_Repositories">Creating Mercurial User Repositories</a> - If you have a LDAP account that allows you to push to hg.mozilla.org you can also create your own user repositories on the server to share work.</li> -</ul> diff --git a/files/zh-cn/mozilla/mercurial/installing_mercurial/index.html b/files/zh-cn/mozilla/mercurial/installing_mercurial/index.html deleted file mode 100644 index 1ea2cc22e3..0000000000 --- a/files/zh-cn/mozilla/mercurial/installing_mercurial/index.html +++ /dev/null @@ -1,145 +0,0 @@ ---- -title: Installing Mercurial -slug: Mozilla/Mercurial/Installing_Mercurial -translation_of: Mozilla/Mercurial/Installing_Mercurial ---- -<p>{{ Note('If you have not yet read the <a href="/en-US/docs/Mercurial_basics">Mercurial basics</a> do so now, or see <a href="/en-US/docs/Mercurial">Mercurial</a> for other resources.') }}</p> - -<div class="note"> -<p>Please refer to <a href="https://mozilla-version-control-tools.readthedocs.org/en/latest/hgmozilla/index.html"> Mercurial For Mozillians at ReadTheDocs</a> for current best-practices around Mercurial, including many helpful extra tools and guidelines that make using Mercurial fast and easy.</p> -</div> - -<h2 id="Installing" name="Installing">安装</h2> - -<p>See <a href="http://mozilla-version-control-tools.readthedocs.org/en/latest/hgmozilla/installing.html">Installing Mercurial</a> from the Mozilla Version Control Guide.</p> - -<h2 id="基本设置">基本设置</h2> - -<p>You should configure Mercurial before submitting patches to Mozilla.</p> - -<p>If you will be pulling the Firefox source code or one of the derived repositories, the easiest way to configure Mercurial is to run the <em>mercurial-setup</em> mach command:</p> - -<pre>./mach mercurial-setup</pre> - -<p>This command starts an interactive wizard that will help ensure your Mercurial is configured with the latest recommended settings. This command will not change any files on your machine without your consent.</p> - -<p>If you don't have the Firefox source code available, you should edit your Mercurial configuration file to look like the following:</p> - -<pre class="eval">[ui] -username = Your Real Name <<a class="link-mailto" href="mailto:user@example.com" rel="freelink">user@example.com</a>> -merge = <em>your-merge-program</em> (or internal:merge) - -[diff] -git = 1 -showfunc = 1 -unified = 8 - -[defaults] -commit = -v -</pre> - -<p>On Windows, these settings can be added to <code>$HOME\.hgrc</code> or <code>$HOME\Mercurial.ini</code>, or, if you'd like global settings, <code>C:\mozilla-build\hg\Mercurial.ini</code> or <code>C:\Program Files\Mercurial\Mercurial.ini</code>. On UNIX-like systems, they should be in your <code>$HOME/.hgrc</code> file.</p> - -<p>You can configure the editor to use for commit messages using the <code>editor</code> option in the <code>[ui]</code> section or by setting the <code>EDITOR</code> environment variable.</p> - -<p>If you are trying to access the repository through a proxy server, see <a class="external" href="http://www.selenic.com/mercurial/hgrc.5.html#http-proxy" title="http://www.selenic.com/mercurial/hgrc.5.html#http-proxy">these instructions</a>.</p> - -<h2 id="其他设置">其他设置</h2> - -<h3 id="Merge_program" name="Merge_program">Merge 合并程序</h3> - -<p>After installing, <strong>choose a <a class="external" href="https://www.mercurial-scm.org/wiki/MergeToolConfiguration">merge program</a></strong>. Seriously. Do it now. If you don't, Mercurial will choose one for you and spring it on you when you least expect it.</p> - -<p>A reasonable thing to do is to set <code>ui.merge=internal:merge</code> in the Mercurial configuration file (see below), which makes Mercurial try to merge changes and add the conflict markers (a la CVS) to the files that couldn't be merged.</p> - -<p>Under Ubuntu, you can install meld package, then in in the Mercurial configuration file (see below) set <code>ui.merge=meld</code></p> - -<p>You can see the list of merge conflicts by looking for "merging ... failed!" in the update output.</p> - -<h4 id="配置_kdiff3_作为合并工具">配置 kdiff3 作为合并工具</h4> - -<p>If you're on Linux and you have kdiff3 installed, you probably want to configure kdiff3 as a merge tool. (It's better than meld because it will actually resolve a bunch of the conflicts without prompting you, generally quite accurately.) You can do this by adding the following lines (which come from <code>contrib/mergetools.hgrc</code> in the Mercurial distribution):</p> - -<pre>[merge-tools] -kdiff3.args=--auto -L1 base --L2 local --L3 other $base $local $other -o $output -kdiff3.regkey=Software\KDiff3 -kdiff3.regappend=\kdiff3.exe -kdiff3.fixeol=True -kdiff3.gui=True - -</pre> - -<h3 id="Extensions">Extensions</h3> - -<p>There's a number of extensions you can enable. See <a href="http://mercurial.selenic.com/wiki/UsingExtensions" title="http://mercurial.selenic.com/wiki/UsingExtensions">http://mercurial.selenic.com/wiki/UsingExtensions</a>. Almost everyone should probably enable the following:</p> - -<ul> - <li>color - Colorize terminal output</li> - <li>histedit - Provides <em>git rebase --interactive</em> behavior.</li> - <li>pager - Feed command output into a pager (like <em>less</em>)</li> - <li>progress - Draw progress bars on long-running operations.</li> - <li>rebase - Ability to easily rebase patches on top of other heads.</li> - <li>transplant - Easily move patches between repositories, branches, etc.</li> -</ul> - -<p>These can all be turned on by just adding this to your .hgrc file:</p> - -<pre>[extensions] -color = -rebase = -histedit = -progress = -transplant = -pager = -</pre> - -<p>In addition, there are some 3rd party extensions that are incredibly useful for basic development:</p> - -<dl> - <dt><a href="https://hg.mozilla.org/hgcustom/version-control-tools/file/default/hgext/mozext" title="https://hg.mozilla.org/users/gszorc_mozilla.com/hgext-gecko-dev">mozext</a></dt> - <dd>Mozilla-specific functionality to aid in developing Firefox/Gecko.</dd> - <dt><a href="https://github.com/pbiggar/trychooser">trychooser</a></dt> - <dd>Automatically creates a try commit message and then pushes changes to Mozilla's Try infrastructure. Just run: - <pre>hg trychooser</pre> - </dd> - <dt><a href="https://hg.mozilla.org/users/robarnold_cmu.edu/qimportbz">qimportbz</a></dt> - <dd>Import patches from Bugzilla. Creates a filename and commit message for you based on the bug's metadata. - <pre>hg qimport bz://1234567 - </pre> - </dd> - <dt><a href="https://hg.mozilla.org/users/tmielczarek_mozilla.com/bzexport">bzexport</a></dt> - <dd>Export patches to Bugzilla. There are quite a few optional arguments here to create new or update existing bugs with the attment, as well as auto matically request reviews. Type hg help bzexport for a full list but the basic syntax is: - <pre>hg bzexport -i 1234567</pre> - </dd> -</dl> - -<p>Installing these is fairly easy. You'll just need to find a place on your system to store the extensions, and clone the extension repos into it:</p> - -<pre>hg clone https://bitbucket.org/edgimar/crecord -hg clone https://bitbucket.org/sfink/mqext -hg clone https://hg.mozilla.org/users/robarnold_cmu.edu/qimportbz -git clone https://github.com/pbiggar/trychooser -</pre> - -<p>And then add then to your .hgrc file</p> - -<pre>[extensions] -qcrecord = /path/to/crecord/crecord -mqext = path/to/mqext -qimportbz = path/to/qimportbz -trychooser = path/to/trychooser/trychooser -</pre> - -<h3 id="Configuring_the_try_repository">Configuring the try repository</h3> - -<p>If you have access to the <a class="link-https" href="https://wiki.mozilla.org/Build:TryServer" title="https://wiki.mozilla.org/Build:TryServer">try server</a> you may want to configure Mercurial so you can refer to it simply as "try", since it can be useful from all your trees. This can be done by adding this to your ~/.hgrc (or Mercurial.ini):</p> - -<p> </p> - -<pre>[paths] -try = ssh://hg.mozilla.org/try/ -</pre> - -<p>You can also configure short names like this that are specific to a particular repository by adding a [paths] section to the .hg/hgrc file within a repository. There are two magic names, "default" and "default-push", which are used as the default push/pull targets. (If "default" is specified and "default-push" is not, "default" is used for both.)</p> - -<p>Alternatively, you can install the <a class="link-https" href="https://bitbucket.org/sfink/trychooser" title="https://bitbucket.org/sfink/trychooser">trychooser extension</a> (<a class="link-https" href="https://github.com/pbiggar/trychooser" title="https://github.com/pbiggar/trychooser">older version</a>).</p> |