mercurial/help/subrepos.txt
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
Sat, 15 Oct 2011 19:07:51 +0200
changeset 15267 3bfdfefea2fc
parent 15213 15f15f3b405d
child 15410 9e99d2bbb1b1
child 15427 2a3ab9e81a3e
permissions -rw-r--r--
rebase: use revset as soon as possible in internal logic The buildstate function now take a set of revs. Logic related to --source and --base option have been moved in the main rebase function. In the process this fixes a bug where the wrong source changeset might be pick. This explain the changes in hgext/rebase.py
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
15213
15f15f3b405d subrepo: add git to the help topic
Matt Mackall <mpm@selenic.com>
parents: 13411
diff changeset
     3
group.
15f15f3b405d subrepo: add git to the help topic
Matt Mackall <mpm@selenic.com>
parents: 13411
diff changeset
     4
15f15f3b405d subrepo: add git to the help topic
Matt Mackall <mpm@selenic.com>
parents: 13411
diff changeset
     5
Mercurial currently supports Mercurial, Git, and Subversion
15f15f3b405d subrepo: add git to the help topic
Matt Mackall <mpm@selenic.com>
parents: 13411
diff changeset
     6
subrepositories.
12828
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
Subrepositories are made of three components:
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     9
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    10
1. Nested repository checkouts. They can appear anywhere in the
15213
15f15f3b405d subrepo: add git to the help topic
Matt Mackall <mpm@selenic.com>
parents: 13411
diff changeset
    11
   parent working directory.
12828
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    12
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    13
2. Nested repository references. They are defined in ``.hgsub`` and
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    14
   tell where the subrepository checkouts come from. Mercurial
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    15
   subrepositories are referenced like:
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    16
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    17
     path/to/nested = https://example.com/nested/repo/path
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    18
15213
15f15f3b405d subrepo: add git to the help topic
Matt Mackall <mpm@selenic.com>
parents: 13411
diff changeset
    19
   Git and Subversion subrepos are also supported:
15f15f3b405d subrepo: add git to the help topic
Matt Mackall <mpm@selenic.com>
parents: 13411
diff changeset
    20
15f15f3b405d subrepo: add git to the help topic
Matt Mackall <mpm@selenic.com>
parents: 13411
diff changeset
    21
     path/to/nested = [git]git://example.com/nested/repo/path
15f15f3b405d subrepo: add git to the help topic
Matt Mackall <mpm@selenic.com>
parents: 13411
diff changeset
    22
     path/to/nested = [svn]https://example.com/nested/trunk/path
15f15f3b405d subrepo: add git to the help topic
Matt Mackall <mpm@selenic.com>
parents: 13411
diff changeset
    23
12828
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    24
   where ``path/to/nested`` is the checkout location relatively to the
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    25
   parent Mercurial root, and ``https://example.com/nested/repo/path``
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    26
   is the source repository path. The source can also reference a
15213
15f15f3b405d subrepo: add git to the help topic
Matt Mackall <mpm@selenic.com>
parents: 13411
diff changeset
    27
   filesystem path.
12828
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
   Note that ``.hgsub`` does not exist by default in Mercurial
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    30
   repositories, you have to create and add it to the parent
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    31
   repository before using subrepositories.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    32
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    33
3. Nested repository states. They are defined in ``.hgsubstate`` and
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    34
   capture whatever information is required to restore the
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    35
   subrepositories to the state they were committed in a parent
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    36
   repository changeset. Mercurial automatically record the nested
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    37
   repositories states when committing in the parent repository.
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
   .. note::
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    40
      The ``.hgsubstate`` file should not be edited manually.
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
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    43
Adding a Subrepository
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    44
----------------------
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    45
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    46
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
    47
repository. Clone or checkout the external projects where you want it
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    48
to live in the parent repository. Edit ``.hgsub`` and add the
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    49
subrepository entry as described above. At this point, the
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
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
    51
``.hgsubstate`` and bind it to the committed changeset.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    52
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    53
Synchronizing a Subrepository
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    54
-----------------------------
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    55
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    56
Subrepos do not automatically track the latest changeset of their
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    57
sources. Instead, they are updated to the changeset that corresponds
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    58
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
    59
developers always get a consistent set of compatible code and
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    60
libraries when they update.
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
Thus, updating subrepos is a manual process. Simply check out target
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    63
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
    64
commit in the parent repository to record the new combination.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    65
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    66
Deleting a Subrepository
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
12860
db2ff771204d help: correct tip about deleting a subrepository
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 12828
diff changeset
    69
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
    70
reference from ``.hgsub``, then remove its files.
12828
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    71
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    72
Interaction with Mercurial Commands
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    73
-----------------------------------
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
:add: add does not recurse in subrepos unless -S/--subrepos is
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    76
    specified. Subversion subrepositories are currently silently
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    77
    ignored.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    78
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    79
:archive: archive does not recurse in subrepositories unless
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    80
    -S/--subrepos is specified.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    81
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    82
:commit: commit creates a consistent snapshot of the state of the
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    83
    entire project and its subrepositories. It does this by first
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    84
    attempting to commit all modified subrepositories, then recording
13411
d4de90a612f7 commit: abort if a subrepo is modified and ui.commitsubrepos=no
Patrick Mezard <pmezard@gmail.com>
parents: 12860
diff changeset
    85
    their state and finally committing it in the parent
d4de90a612f7 commit: abort if a subrepo is modified and ui.commitsubrepos=no
Patrick Mezard <pmezard@gmail.com>
parents: 12860
diff changeset
    86
    repository. Mercurial can be made to abort if any subrepository
d4de90a612f7 commit: abort if a subrepo is modified and ui.commitsubrepos=no
Patrick Mezard <pmezard@gmail.com>
parents: 12860
diff changeset
    87
    content is modified by setting "ui.commitsubrepos=no" in a
d4de90a612f7 commit: abort if a subrepo is modified and ui.commitsubrepos=no
Patrick Mezard <pmezard@gmail.com>
parents: 12860
diff changeset
    88
    configuration file (see :hg:`help config`).
12828
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    89
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    90
:diff: diff does not recurse in subrepos unless -S/--subrepos is
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    91
    specified. Changes are displayed as usual, on the subrepositories
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    92
    elements. Subversion subrepositories are currently silently
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    93
    ignored.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    94
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    95
:incoming: incoming does not recurse in subrepos unless -S/--subrepos
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    96
    is specified. Subversion subrepositories are currently silently
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    97
    ignored.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    98
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    99
:outgoing: outgoing does not recurse in subrepos unless -S/--subrepos
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   100
    is specified. Subversion subrepositories are currently silently
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   101
    ignored.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   102
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   103
: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
   104
    to running :hg:`update`. Listing and retrieving all
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   105
    subrepositories changes referenced by the parent repository pulled
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   106
    changesets is expensive at best, impossible in the Subversion
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   107
    case.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   108
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   109
:push: Mercurial will automatically push all subrepositories first
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   110
    when the parent repository is being pushed. This ensures new
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   111
    subrepository changes are available when referenced by top-level
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   112
    repositories.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   113
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   114
:status: status does not recurse into subrepositories unless
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   115
    -S/--subrepos is specified. Subrepository changes are displayed as
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   116
    regular Mercurial changes on the subrepository
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   117
    elements. Subversion subrepositories are currently silently
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   118
    ignored.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   119
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   120
:update: update restores the subrepos in the state they were
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   121
    originally committed in target changeset. If the recorded
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   122
    changeset is not available in the current subrepository, Mercurial
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   123
    will pull it in first before updating.  This means that updating
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   124
    can require network access when using subrepositories.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   125
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   126
Remapping Subrepositories Sources
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   127
---------------------------------
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   128
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   129
A subrepository source location may change during a project life,
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   130
invalidating references stored in the parent repository history. To
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   131
fix this, rewriting rules can be defined in parent repository ``hgrc``
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   132
file or in Mercurial configuration. See the ``[subpaths]`` section in
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   133
hgrc(5) for more details.
af1006d2f970 Add subrepos help topic
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   134