aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/mozilla/mercurial/basics/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/mozilla/mercurial/basics/index.html')
-rw-r--r--files/zh-cn/mozilla/mercurial/basics/index.html56
1 files changed, 56 insertions, 0 deletions
diff --git a/files/zh-cn/mozilla/mercurial/basics/index.html b/files/zh-cn/mozilla/mercurial/basics/index.html
new file mode 100644
index 0000000000..26c4d7cb03
--- /dev/null
+++ b/files/zh-cn/mozilla/mercurial/basics/index.html
@@ -0,0 +1,56 @@
+---
+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>