hgext/share.py
author Henrik Stuart <hg@hstuart.dk>
Sun, 07 Jun 2009 20:31:38 +0200
changeset 8846 b30775386d40
parent 8807 8bf6eb68ddaf
child 8873 e872ef2e6758
permissions -rw-r--r--
acl: support for getting authenticated user from web server (issue298) Previously, the acl extension just read the current system user, which is fine for direct file system access and SSH, but will not work for HTTP(S) as that would return the web server process user identity rather than the authenticated user. An empty user is returned if the user is not authenticated.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8801
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     1
# Mercurial extension to provide the 'hg share' command
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
# Copyright 2006, 2007 Matt Mackall <mpm@selenic.com>
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     4
#
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     5
# 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
     6
# GNU General Public License version 2, incorporated herein by reference.
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     7
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     8
import os
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     9
from mercurial.i18n import _
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    10
from mercurial import hg, commands
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    11
8807
8bf6eb68ddaf share: allow dest to default to the basename of source
Matt Mackall <mpm@selenic.com>
parents: 8801
diff changeset
    12
def share(ui, source, dest=None, noupdate=False):
8801
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    13
    """create a new shared repository (experimental)
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    14
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    15
    Initialize a new repository and working directory that shares its
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    16
    history with another repository.
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    17
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    18
    NOTE: actions that change history such as rollback or moving the
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    19
    source may confuse sharers.
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    20
    """
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    21
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    22
    return hg.share(ui, source, dest, not noupdate)
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    23
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    24
cmdtable = {
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    25
    "share":
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    26
    (share,
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    27
     [('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
    28
     _('[-U] SOURCE [DEST]')),
8801
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
28eaf6f8abce share: add experimental share extension
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    31
commands.norepo += " share"