mercurial/help/subrepos.txt
author Kevin Bullock <kbullock@ringworld.org>
Tue, 21 Dec 2010 15:27:58 -0600
changeset 13196 592998ba3466
parent 12860 db2ff771204d
child 13411 d4de90a612f7
permissions -rw-r--r--
record: clean up command table The --force option to qnew has become a no-op, so qrecord doesn't need to use it. This allows record's command table to be simplified; in the process of doing so, this patch also cleans up the cmdtable visually.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12828
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
Subrepositories let you nest external repositories or projects into a
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     2
parent Mercurial repository, and make commands operate on them as a
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     3
group. External Mercurial and Subversion projects are currently
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     4
supported.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     5
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     6
Subrepositories are made of three components:
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     7
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     8
1. Nested repository checkouts. They can appear anywhere in the
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     9
   parent working directory, and are Mercurial clones or Subversion
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    10
   checkouts.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    11
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    12
2. Nested repository references. They are defined in ``.hgsub`` and
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    13
   tell where the subrepository checkouts come from. Mercurial
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    14
   subrepositories are referenced like:
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    15
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    16
     path/to/nested = https://example.com/nested/repo/path
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    17
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    18
   where ``path/to/nested`` is the checkout location relatively to the
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    19
   parent Mercurial root, and ``https://example.com/nested/repo/path``
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    20
   is the source repository path. The source can also reference a
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    21
   filesystem path. Subversion repositories are defined with:
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    22
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    23
     path/to/nested = [svn]https://example.com/nested/trunk/path
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    24
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    25
   Note that ``.hgsub`` does not exist by default in Mercurial
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    26
   repositories, you have to create and add it to the parent
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    27
   repository before using subrepositories.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    28
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    29
3. Nested repository states. They are defined in ``.hgsubstate`` and
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    30
   capture whatever information is required to restore the
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    31
   subrepositories to the state they were committed in a parent
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    32
   repository changeset. Mercurial automatically record the nested
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    33
   repositories states when committing in the parent repository.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    34
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    35
   .. note::
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    36
      The ``.hgsubstate`` file should not be edited manually.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    37
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    38
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    39
Adding a Subrepository
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    40
----------------------
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    41
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    42
If ``.hgsub`` does not exist, create it and add it to the parent
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    43
repository. Clone or checkout the external projects where you want it
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    44
to live in the parent repository. Edit ``.hgsub`` and add the
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    45
subrepository entry as described above. At this point, the
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    46
subrepository is tracked and the next commit will record its state in
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    47
``.hgsubstate`` and bind it to the committed changeset.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    48
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    49
Synchronizing a Subrepository
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
-----------------------------
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    51
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    52
Subrepos do not automatically track the latest changeset of their
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    53
sources. Instead, they are updated to the changeset that corresponds
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    54
with the changeset checked out in the top-level changeset. This is so
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    55
developers always get a consistent set of compatible code and
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    56
libraries when they update.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    57
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    58
Thus, updating subrepos is a manual process. Simply check out target
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    59
subrepo at the desired revision, test in the top-level repo, then
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    60
commit in the parent repository to record the new combination.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    61
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    62
Deleting a Subrepository
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    63
------------------------
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    64
12860
db2ff771204d help: correct tip about deleting a subrepository
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 12828
diff changeset
    65
To remove a subrepository from the parent repository, delete its
db2ff771204d help: correct tip about deleting a subrepository
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 12828
diff changeset
    66
reference from ``.hgsub``, then remove its files.
12828
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    67
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    68
Interaction with Mercurial Commands
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    69
-----------------------------------
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    70
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    71
:add: add does not recurse in subrepos unless -S/--subrepos is
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    72
    specified. Subversion subrepositories are currently silently
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    73
    ignored.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    74
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    75
:archive: archive does not recurse in subrepositories unless
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    76
    -S/--subrepos is specified.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    77
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    78
:commit: commit creates a consistent snapshot of the state of the
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    79
    entire project and its subrepositories. It does this by first
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    80
    attempting to commit all modified subrepositories, then recording
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    81
    their state and finally committing it in the parent repository.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    82
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    83
:diff: diff does not recurse in subrepos unless -S/--subrepos is
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    84
    specified. Changes are displayed as usual, on the subrepositories
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    85
    elements. Subversion subrepositories are currently silently
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    86
    ignored.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    87
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    88
:incoming: incoming does not recurse in subrepos unless -S/--subrepos
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    89
    is specified. Subversion subrepositories are currently silently
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    90
    ignored.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    91
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    92
:outgoing: outgoing does not recurse in subrepos unless -S/--subrepos
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    93
    is specified. Subversion subrepositories are currently silently
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    94
    ignored.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    95
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    96
:pull: pull is not recursive since it is not clear what to pull prior
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    97
    to running :hg:`update`. Listing and retrieving all
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    98
    subrepositories changes referenced by the parent repository pulled
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    99
    changesets is expensive at best, impossible in the Subversion
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   100
    case.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   101
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   102
:push: Mercurial will automatically push all subrepositories first
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   103
    when the parent repository is being pushed. This ensures new
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   104
    subrepository changes are available when referenced by top-level
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   105
    repositories.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   106
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   107
:status: status does not recurse into subrepositories unless
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   108
    -S/--subrepos is specified. Subrepository changes are displayed as
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   109
    regular Mercurial changes on the subrepository
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   110
    elements. Subversion subrepositories are currently silently
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   111
    ignored.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   112
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   113
:update: update restores the subrepos in the state they were
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   114
    originally committed in target changeset. If the recorded
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   115
    changeset is not available in the current subrepository, Mercurial
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   116
    will pull it in first before updating.  This means that updating
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   117
    can require network access when using subrepositories.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   118
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   119
Remapping Subrepositories Sources
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   120
---------------------------------
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   121
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   122
A subrepository source location may change during a project life,
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   123
invalidating references stored in the parent repository history. To
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   124
fix this, rewriting rules can be defined in parent repository ``hgrc``
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   125
file or in Mercurial configuration. See the ``[subpaths]`` section in
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   126
hgrc(5) for more details.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   127