author | Greg Ward <greg-hg@gerg.ca> |
Wed, 13 Jan 2010 22:05:06 -0500 | |
branch | stable |
changeset 10256 | 279c8a73fde1 |
parent 9273 | 4b8b0c124b99 |
child 10263 | 25e572394f5c |
permissions | -rw-r--r-- |
8801
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
1 |
# Copyright 2006, 2007 Matt Mackall <mpm@selenic.com> |
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
2 |
# |
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
3 |
# This software may be used and distributed according to the terms of the |
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
4 |
# GNU General Public License version 2, incorporated herein by reference. |
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
5 |
|
8894
868670dbc237
extensions: improve the consistency of synopses
Cédric Duval <cedricduval@free.fr>
parents:
8873
diff
changeset
|
6 |
'''share a common history between several working directories''' |
8873
e872ef2e6758
help: add/fix docstrings for a bunch of extensions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8807
diff
changeset
|
7 |
|
8801
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
8 |
from mercurial.i18n import _ |
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
9 |
from mercurial import hg, commands |
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
10 |
|
8807
8bf6eb68ddaf
share: allow dest to default to the basename of source
Matt Mackall <mpm@selenic.com>
parents:
8801
diff
changeset
|
11 |
def share(ui, source, dest=None, noupdate=False): |
8801
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
12 |
"""create a new shared repository (experimental) |
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
13 |
|
9273
4b8b0c124b99
share: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents:
9075
diff
changeset
|
14 |
Initialize a new repository and working directory that shares its |
4b8b0c124b99
share: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents:
9075
diff
changeset
|
15 |
history with another repository. |
8801
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
16 |
|
10256
279c8a73fde1
share: be more explicit about the dangers of rollback.
Greg Ward <greg-hg@gerg.ca>
parents:
9273
diff
changeset
|
17 |
NOTE: using rollback or extensions that destroy/modify history |
279c8a73fde1
share: be more explicit about the dangers of rollback.
Greg Ward <greg-hg@gerg.ca>
parents:
9273
diff
changeset
|
18 |
(mq, rebase, etc.) can cause considerable confusion with shared |
279c8a73fde1
share: be more explicit about the dangers of rollback.
Greg Ward <greg-hg@gerg.ca>
parents:
9273
diff
changeset
|
19 |
clones. In particular, if two shared clones are both updated to |
279c8a73fde1
share: be more explicit about the dangers of rollback.
Greg Ward <greg-hg@gerg.ca>
parents:
9273
diff
changeset
|
20 |
the same changeset, and one of them destroys that changeset with |
279c8a73fde1
share: be more explicit about the dangers of rollback.
Greg Ward <greg-hg@gerg.ca>
parents:
9273
diff
changeset
|
21 |
rollback, the other clone will suddenly stop working: all |
279c8a73fde1
share: be more explicit about the dangers of rollback.
Greg Ward <greg-hg@gerg.ca>
parents:
9273
diff
changeset
|
22 |
operations will fail with "abort: working directory has unknown |
279c8a73fde1
share: be more explicit about the dangers of rollback.
Greg Ward <greg-hg@gerg.ca>
parents:
9273
diff
changeset
|
23 |
parent". The only known workaround is to use debugsetparents on |
279c8a73fde1
share: be more explicit about the dangers of rollback.
Greg Ward <greg-hg@gerg.ca>
parents:
9273
diff
changeset
|
24 |
the broken clone to reset it to a changeset that still exists |
279c8a73fde1
share: be more explicit about the dangers of rollback.
Greg Ward <greg-hg@gerg.ca>
parents:
9273
diff
changeset
|
25 |
(e.g. tip). |
8801
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
26 |
""" |
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
27 |
|
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
28 |
return hg.share(ui, source, dest, not noupdate) |
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
29 |
|
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
30 |
cmdtable = { |
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
31 |
"share": |
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
32 |
(share, |
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
33 |
[('U', 'noupdate', None, _('do not create a working copy'))], |
8807
8bf6eb68ddaf
share: allow dest to default to the basename of source
Matt Mackall <mpm@selenic.com>
parents:
8801
diff
changeset
|
34 |
_('[-U] SOURCE [DEST]')), |
8801
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
35 |
} |
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
36 |
|
28eaf6f8abce
share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
37 |
commands.norepo += " share" |