Sophie

Sophie

distrib > Mageia > 6 > x86_64 > media > core-updates > by-pkgid > e37dff71c983ab6cce5a5adccef2041e > files > 507

tortoisehg-4.7.2-1.2.mga6.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>4. A Quick Start Guide to TortoiseHg &#8212; TortoiseHg 4.7.0 documentation</title>
    
    <link rel="stylesheet" href="_static/tortoisehg.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '4.7.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="top" title="TortoiseHg 4.7.0 documentation" href="index.html" />
    <link rel="next" title="5. TortoiseHg in daily use" href="daily.html" />
    <link rel="prev" title="3. What’s New" href="whatsnew.html" />
   
  <link rel="stylesheet" href="_static/custom.css" type="text/css" />
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

  </head>
  <body role="document">
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="module-tour">
<span id="a-quick-start-guide-to-tortoisehg"></span><h1>4. A Quick Start Guide to TortoiseHg<a class="headerlink" href="#module-tour" title="Permalink to this headline">¶</a></h1>
<p>Welcome to TortoiseHg and the Mercurial!  TortoiseHg is a set of graphical
applications and Windows Explorer shell extension that serve as a friendly
front-end to the Mercurial distributed version control system (DVCS).</p>
<p>All TortoiseHg functionality is reachable from 3 places:</p>
<ol class="arabic">
<li><p class="first">The <strong class="command">Workbench</strong> application</p>
<p>You can start the Workbench from the Start Menu, or by right clicking on the
Desktop and selecting <span class="menuselection">Hg Workbench</span>.</p>
<div class="figure" id="id1">
<img alt="Desktop Context Menu" src="_images/desktop-workbench.png" />
<p class="caption"><span class="caption-text">Start the Workbench from the Desktop</span></p>
</div>
</li>
<li><p class="first">The <strong class="command">Explorer</strong> context menu</p>
<p>All you have to do is right click on the right folder or files in Explorer,
and select a context menu entry.</p>
</li>
<li><p class="first">The <strong class="command">thg</strong> command line application</p>
<p>Type the appropriate commands from any command line interface, in the form
<code class="kbd docutils literal"><span class="pre">thg</span> <span class="pre">&lt;command&gt;</span> <span class="pre">[options]</span></code>.</p>
</li>
</ol>
<p>In this quick guide we would like to make you get started using the Workbench
application, but we will also indicate how to do the same with the other
possibilities.</p>
<p>Mercurial commands are also available from the standard <strong class="command">hg</strong> command
line application.</p>
<div class="section" id="configuring-tortoisehg">
<h2>4.1. Configuring TortoiseHg<a class="headerlink" href="#configuring-tortoisehg" title="Permalink to this headline">¶</a></h2>
<p>Your first step should be to make sure that you are correctly identified
to TortoiseHg.  You do this by opening the global settings dialog.</p>
<p>Workbench: select <span class="menuselection">File ‣ Settings...</span> from the menu</p>
<p>Explorer: choose <span class="menuselection">TortoiseHg ‣ Global Settings</span> from the
context menu</p>
<p>Command line: type <strong class="command">thg userconfig</strong></p>
<p>This opens the TortoiseHg settings dialog, editing your global
(user) configuration.</p>
<div class="figure" id="id2">
<img alt="Settings Dialog" src="_images/settings.png" />
<p class="caption"><span class="caption-text">TortoiseHg Settings Dialog</span></p>
</div>
<p>First select the <span class="guilabel">Commit</span> page and enter a name in the
<span class="guilabel">Username</span> field.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If you neglect to configure a username TortoiseHg will ask you to
enter one when you try to <em>commit</em>, which is the first time a
username is actually required.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>There are no hard fast rules on how to format your username, the
field is free form, but the following convention is commonly used:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">FullName</span> <span class="o">&lt;</span><span class="n">email</span><span class="o">&gt;</span>
</pre></div>
</div>
<p>for example</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">Donald</span> <span class="n">Duck</span> <span class="o">&lt;</span><span class="n">donaldduck</span><span class="nd">@example</span><span class="o">.</span><span class="n">net</span><span class="o">&gt;</span>
</pre></div>
</div>
<p class="last">The email address is stripped when viewing history in the revision history
viewer, and the built-in web server obfuscates email addresses to
prevent SPAM.</p>
</div>
<p>Next, select the <span class="guilabel">TortoiseHg</span> page and select the
<span class="guilabel">Three-way Merge Tool</span> entry.  In the drop down list you will
find all of the merge tools detected on your computer (kdiff3 is
provided by the Windows installer) and a number of internal merge
behaviors.  Select your preferred merge tool.</p>
<p>If you prefer for TortoiseHg to also use your selected merge tool for
visual diffs, you can leave the <span class="guilabel">Visual Diff Tool</span>
unspecified.  Otherwise, select your favorite visual diff tool from the
drop down list of detected visual diff tools.</p>
<p>If there are no options in either drop-down list, you must install a
diff/merge tool that is supported by our mergetools.rc or configure your
own tool.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If you installed TortoiseHg from source, you need to add our
<code class="file docutils literal"><span class="pre">contrib/mergetools.ini</span></code> file to your HGRC path in some way.  One
approach is to <em>%include</em> it from your <code class="file docutils literal"><span class="pre">~/.hgrc</span></code> file.</p>
</div>
<p>Feel free to configure other global settings while you have the dialog
open.  You will have the chance later to override these global settings
with repository local settings, if required.</p>
<p>Click the <span class="guilabel">OK</span> button to save the changes you have made and
close the settings dialog.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Most TortoiseHg settings changes are noticed immediately, but
loading or unloading extensions usually requires restarting all open
applications for the changes to take effect.</p>
</div>
</div>
<div class="section" id="getting-acquainted">
<h2>4.2. Getting Acquainted<a class="headerlink" href="#getting-acquainted" title="Permalink to this headline">¶</a></h2>
<p>Mercurial supports many different
<a class="reference external" href="https://tortoisehg.bitbucket.io/hgbook/1.7/collaborating-with-other-people.html">collaboration models</a>.
This chapter describes just one of those models: a single central repository.
The central repository model does not scale as well as other models, but
it is the most familiar to those coming from other revision tools and
thus is the most common approach people start with.</p>
<p>To get started, suppose you volunteer to create the central repository.
There are ways to <a class="reference external" href="https://www.mercurial-scm.org/wiki/RepositoryConversion">convert</a>
non-Mercurial repositories into Mercurial repositories, but this example
assumes you are starting from scratch.</p>
</div>
<div class="section" id="initialize-the-repository">
<h2>4.3. Initialize the repository<a class="headerlink" href="#initialize-the-repository" title="Permalink to this headline">¶</a></h2>
<p>Create the initial repository on your local machine:</p>
<p>Workbench: select <span class="menuselection">File ‣ New Repository...</span> from the menu</p>
<p>Explorer: select <span class="menuselection">TortoiseHg ‣ Create Repository Here</span> from
the context menu</p>
<p>Command line: type <strong class="command">thg init</strong></p>
<p>You can do this from within the folder you want to create the repository in, or
enter the correct path in the dialog. You only need to do this once in the root
folder of your project.</p>
<div class="figure" id="id3">
<img alt="Init dialog" src="_images/init.png" />
<p class="caption"><span class="caption-text">Repository Init Dialog</span></p>
</div>
<p>We suggest you keep <span class="guilabel">Create special files (.hgignore, ...)</span>
checked, and do not check <span class="guilabel">Make repo compatible with Mercurial &lt; 1.7</span>,
unless you have a strong reason to do so.</p>
<p>After pressing <span class="guilabel">Create</span>, Mercurial creates a subdirectory in
your project folder named <code class="file docutils literal"><span class="pre">.hg</span></code>.  This is where Mercurial keeps all
its version data.  It is called the <em>repository</em> or <em>store</em>, while the
directory containing the source files is called the <em>working directory</em>.
You never need to specify the <code class="file docutils literal"><span class="pre">.hg</span></code> directory when running
commands, you only need to specify the working directory root.  It is
mentioned here just so you better understand how Mercurial works.</p>
<p>The new repository will also be added to the RepoRegistry when you perform this
operation from the Workbench.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">It is dangerous to manually edit the files in <code class="file docutils literal"><span class="pre">.hg</span></code> directory,
repository corruption can occur.  <code class="file docutils literal"><span class="pre">.hg/hgrc</span></code> is perhaps the
only exception to this rule.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Perhaps you already created one or more repositories.  As you can manage
multiple repositories in the Workbench at the same time, you can add these
existing repositories by selecting <span class="menuselection">File ‣ Open Repository...</span>
from its menu, and selecting their folder.  Or you could drag their folder
from Explorer into the RepoRegistry pane.</p>
</div>
</div>
<div class="section" id="add-files">
<h2>4.4. Add files<a class="headerlink" href="#add-files" title="Permalink to this headline">¶</a></h2>
<p>Now it&#8217;s time to tell Mercurial which files must be tracked. There are various
ways to do this:</p>
<ol class="arabic simple">
<li>Workbench: goto the Commit task tab, rightclick on the file, and select
<span class="menuselection">Add</span> from the context menu. This will change the status
indication of that file into &#8216;A&#8217; and the filename will turn green.</li>
<li>Explorer: select <span class="menuselection">TortoiseHg ‣ Add Files...</span> in the context
menu. A dialog will open for you to check the selected files and accept the
add operation. You can also open the status tool by selecting
<span class="menuselection">TortoiseHg ‣ View File Status</span>. Check the files you want
to add and select <span class="guilabel">Add</span> from the file context menu.</li>
<li>Command line: type <strong class="command">thg status</strong></li>
<li>Or skip adding new files as a separate step and have the commit tool add them
implicitly.  The commit tool is very similar to the status tool and allows
you to do all of the same tasks. In this tool you can add and commit an
untracked file by just checking the file and pressing <span class="guilabel">Commit</span>.</li>
</ol>
</div>
<div class="section" id="ignore-files">
<h2>4.5. Ignore files<a class="headerlink" href="#ignore-files" title="Permalink to this headline">¶</a></h2>
<p>You may have some files in the foldertree of your repository that you don&#8217;t want
to track. These can be intermediate results from builds f.i. that you do not
wish to always delete immediately, or files your editor generates, etc. You can
mark these files as ignored in some different ways too.</p>
<ol class="arabic simple">
<li>Workbench: goto the Commit task tab, rightclick on the file, and select
<span class="menuselection">Ignore...</span> from the context menu to open the ignore filter
dialog.</li>
<li>Explorer: select <span class="menuselection">TortoiseHg ‣ Edit Ignore Filter</span>.</li>
<li>Command line: type <strong class="command">thg hgignore</strong> to bring up the ignore filter dialog.</li>
<li>You can also launch the ignore filter from the status tool (the menu option
is named <span class="guilabel">Ignore</span>).</li>
</ol>
<p>Choose a file from the list or manually type in a <em>Glob</em> or <em>Regular expression</em>
filter and then press <span class="guilabel">Add</span>. Changes to the ignore filter take effect
immediately.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The <code class="file docutils literal"><span class="pre">.hgignore</span></code> file, contained in the working directory root,
is typically tracked (checked in).</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">It is good practice to not have many <em>unknown</em> files in your working
directory, as it makes it too easy to forget to add vital new files.
It is recommended that you keep your <code class="file docutils literal"><span class="pre">.hgignore</span></code> file up to
date.</p>
</div>
</div>
<div class="section" id="commit">
<h2>4.6. Commit<a class="headerlink" href="#commit" title="Permalink to this headline">¶</a></h2>
<p>Commit your local repository now:</p>
<p>Workbench: click on the Working Directory revision which also selects the Commit
task tab, or directly select the Commit task tab</p>
<p>Explorer: right-clicking anywhere in the folder, or on the folder itself, and
then selecting <span class="guilabel">Hg Commit...</span></p>
<p>Command line: type <strong class="command">thg commit</strong></p>
<p>Write a commit message, select the files you wish to commit, then press
<span class="guilabel">Commit</span>.  Your previous commit message will be in the message history
drop-down, so you do not have to type it in again from scratch.</p>
<div class="figure" id="id4">
<img alt="Commit dialog" src="_images/commit.png" />
<p class="caption"><span class="caption-text">Commit Tool</span></p>
</div>
</div>
<div class="section" id="share-the-repository">
<h2>4.7. Share the repository<a class="headerlink" href="#share-the-repository" title="Permalink to this headline">¶</a></h2>
<p>Now you are ready to share your work. You do this by making a copy of
your repository in a public location that everyone in your group can
read. Mercurial calls this copy operation <em>cloning your repository</em>.</p>
<p>To clone your repository to a shared drive:</p>
<p>Workbench: select <span class="menuselection">File ‣ Clone Repository...</span> from the menu</p>
<p>Explorer: select <span class="menuselection">TortoiseHg ‣ Clone...</span> from
the context menu</p>
<p>Command line: type <strong class="command">thg clone</strong></p>
<p>Then enter the destination path, and click <span class="guilabel">Clone</span>.</p>
<div class="figure" id="id5">
<img alt="Clone dialog" src="_images/share.png" />
<p class="caption"><span class="caption-text">Clone Dialog</span></p>
</div>
<p>When you create a clone for the purposes of generating a <em>central
repository</em> there is no reason for that clone to have a working
directory.  Checking <span class="guilabel">Do not update the new working directory</span> under
<span class="guilabel">Options</span> will prevent Mercurial from checking out a working copy of
the repository in the central repository clone.  It will only have the
<code class="file docutils literal"><span class="pre">.hg</span></code> directory, which stores the entire revision history of the project.</p>
<p>Other team members can clone from this clone with or without a checked
out working directory.</p>
</div>
<div class="section" id="fetching-from-the-group-repository">
<h2>4.8. Fetching from the group repository<a class="headerlink" href="#fetching-from-the-group-repository" title="Permalink to this headline">¶</a></h2>
<p>You want to start collaborating with your team.  They tell you something
like <em>fetch the repository from x</em>.  What does that mean? It means that
you want to make a copy of the repository located at x on your local machine.
Mercurial calls this cloning and TortoiseHg has a dialog for it.</p>
<p>Workbench: select <span class="menuselection">File ‣ Clone Repository...</span> from the menu</p>
<p>Explorer: select <span class="menuselection">TortoiseHg ‣ Clone...</span> from
the context menu</p>
<p>Command line: type <strong class="command">thg clone</strong></p>
<p>Then enter the destination path, and click <span class="guilabel">OK</span>.</p>
<div class="figure" id="id6">
<img alt="Clone dialog" src="_images/clone.png" />
<p class="caption"><span class="caption-text">Clone Dialog</span></p>
</div>
<p>This time you do want to update the working directory because you want
to work on the project, under <span class="guilabel">Options</span> uncheck
<span class="guilabel">Do not update the new working directory</span> so Mercurial updates
the working directory with the <em>tip</em> revision in your new clone.</p>
</div>
<div class="section" id="working-with-your-repository">
<h2>4.9. Working with your repository<a class="headerlink" href="#working-with-your-repository" title="Permalink to this headline">¶</a></h2>
<p>Suppose you&#8217;ve introduced some changes.  It is easy to discover what pending
changes there are in the repository.</p>
<p>Workbench: go to the Commit task tab and inspect the filelist at the left</p>
<p>Any files marked with &#8216;A&#8217; (added, green), with &#8216;?&#8217; (unversioned but not ignored,
fuchsia), with &#8216;M&#8217; (modified, blue), or with &#8216;!&#8217; (removed, red) indicate pending
changes that should be committed.</p>
<p>The Commit task tab in the Workbench gives you a way to see differences within
the files, or you can use your visual difference tool (kdiff3).  Mercurial
allows you to commit many changes before you decide to synchronize (share
changes) with the group repository.</p>
<p>Explorer: inspect the icons on the folders and files in your repository</p>
<p>Folders or files in Explorer marked with one of the icons below are another way of
indicating pending changes.  You can traverse the directories to find specific
changes and commit them from Explorer. Though it might be quicker to do that
from the Commit task tab in the Workbench.</p>
<div class="figure" id="id7">
<img alt="Overlay Icons" src="_images/overlayicons.png" />
<p class="caption"><span class="caption-text">Overlay Icons on Vista</span></p>
</div>
<p>Command line: type <strong class="command">thg commit</strong></p>
<p>When you&#8217;re ready to publish your changes, you</p>
<ol class="arabic simple">
<li>Commit your changes to your local repository (see above).</li>
<li>Pull changes from the group repository into your repository using
<span class="menuselection">TortoiseHg ‣ Workbench</span> or <strong class="command">thg log</strong>, select the
Sync task tab, choose the path to the group repository in the syncbar and
then click the <span class="guilabel">Pull</span> button.</li>
<li>If some changesets were pulled, merge those changes with your local
changes and then commit the merge into your local repository. From
the revision history viewer (<span class="menuselection">TortoiseHg ‣ Workbench</span>
or <strong class="command">thg log</strong>) open the context menu over the changeset
which you want to merge and select <span class="guilabel">Merge with local...</span>.
Finally, in the merge dialog, press <span class="guilabel">Merge</span> and then
<span class="guilabel">Commit</span>.</li>
<li>Ensure your merged work still builds and passes your extensive test suite.</li>
<li>Push your changes to the group repository,
<span class="menuselection">TortoiseHg ‣ Workbench</span> or <strong class="command">thg log</strong>,
select the path to group repository and then click the <span class="guilabel">Push</span>
button.</li>
</ol>
<p>Which may sound complicated, but is easier than it sounds.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Merges can be safely restarted if necessary.</p>
</div>
<p>Mercurial makes collaboration easy, fast, and productive.
Learn more at Mercurial&#8217;s <a class="reference external" href="https://www.mercurial-scm.org/wiki/">wiki</a>.</p>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="index.html">
              <img class="logo" src="_static/thg_logo_92x50.png" alt="Logo"/>
            </a></p>
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">4. A Quick Start Guide to TortoiseHg</a><ul>
<li><a class="reference internal" href="#configuring-tortoisehg">4.1. Configuring TortoiseHg</a></li>
<li><a class="reference internal" href="#getting-acquainted">4.2. Getting Acquainted</a></li>
<li><a class="reference internal" href="#initialize-the-repository">4.3. Initialize the repository</a></li>
<li><a class="reference internal" href="#add-files">4.4. Add files</a></li>
<li><a class="reference internal" href="#ignore-files">4.5. Ignore files</a></li>
<li><a class="reference internal" href="#commit">4.6. Commit</a></li>
<li><a class="reference internal" href="#share-the-repository">4.7. Share the repository</a></li>
<li><a class="reference internal" href="#fetching-from-the-group-repository">4.8. Fetching from the group repository</a></li>
<li><a class="reference internal" href="#working-with-your-repository">4.9. Working with your repository</a></li>
</ul>
</li>
</ul>
<div class="relations">
<h3>Related Topics</h3>
<ul>
  <li><a href="index.html">Documentation overview</a><ul>
      <li>Previous: <a href="whatsnew.html" title="previous chapter">3. What&#8217;s New</a></li>
      <li>Next: <a href="daily.html" title="next chapter">5. TortoiseHg in daily use</a></li>
  </ul></li>
</ul>
</div>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="_sources/quick.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <div><input type="text" name="q" /></div>
      <div><input type="submit" value="Go" /></div>
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
      &copy;2010-2018, Steve Borho and others.
      
      |
      Powered by <a href="http://sphinx-doc.org/">Sphinx 1.4.9</a>
      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.8</a>
      
      |
      <a href="_sources/quick.txt"
          rel="nofollow">Page source</a>
    </div>

    

    
  </body>
</html>