|
1 # Copyright 2006, 2007 Matt Mackall <mpm@selenic.com> |
|
2 # |
|
3 # This software may be used and distributed according to the terms of the |
|
4 # GNU General Public License version 2 or any later version. |
|
5 |
|
6 '''share a common history between several working directories''' |
|
7 |
|
8 from mercurial.i18n import _ |
|
9 from mercurial import hg, commands |
|
10 |
|
11 def share(ui, source, dest=None, noupdate=False): |
|
12 """create a new shared repository |
|
13 |
|
14 Initialize a new repository and working directory that shares its |
|
15 history with another repository. |
|
16 |
|
17 .. note:: |
|
18 using rollback or extensions that destroy/modify history (mq, |
|
19 rebase, etc.) can cause considerable confusion with shared |
|
20 clones. In particular, if two shared clones are both updated to |
|
21 the same changeset, and one of them destroys that changeset |
|
22 with rollback, the other clone will suddenly stop working: all |
|
23 operations will fail with "abort: working directory has unknown |
|
24 parent". The only known workaround is to use debugsetparents on |
|
25 the broken clone to reset it to a changeset that still exists |
|
26 (e.g. tip). |
|
27 """ |
|
28 |
|
29 return hg.share(ui, source, dest, not noupdate) |
|
30 |
|
31 cmdtable = { |
|
32 "share": |
|
33 (share, |
|
34 [('U', 'noupdate', None, _('do not create a working copy'))], |
|
35 _('[-U] SOURCE [DEST]')), |
|
36 } |
|
37 |
|
38 commands.norepo += " share" |