hgext/convert/__init__.py
author Martin Geisler <mg@daimi.au.dk>
Sat, 03 Jan 2009 17:15:15 +0100
changeset 7598 26adfaccdf73
parent 7502 16905fc2690f
child 7735 2e48668b51f0
permissions -rw-r--r--
lowercase help output Changes docstrings to begin with a lowercase word. Only docstrings used in help output is changed. Scripts are not expected to grep the output of 'hg help' so this change should pose no problem with regard to the compatibility rules.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4513
ac2fe196ac9b Turns convert.py into a real extension
Edouard Gomez <ed.gomez@free.fr>
parents: 4512
diff changeset
     1
# convert.py Foreign SCM converter
3917
645e1dd4b8ae convert-repo: update usage information
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3911
diff changeset
     2
#
4635
63b9d2deed48 Updated copyright notices and add "and others" to "hg version"
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4591
diff changeset
     3
# Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
316
c48d069163d6 Add new convert-repo script
mpm@selenic.com
parents:
diff changeset
     4
#
4513
ac2fe196ac9b Turns convert.py into a real extension
Edouard Gomez <ed.gomez@free.fr>
parents: 4512
diff changeset
     5
# This software may be used and distributed according to the terms
ac2fe196ac9b Turns convert.py into a real extension
Edouard Gomez <ed.gomez@free.fr>
parents: 4512
diff changeset
     6
# of the GNU General Public License, incorporated herein by reference.
6666
53465a7464e2 convert comments to docstrings in a bunch of extensions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6306
diff changeset
     7
'''converting foreign VCS repositories to Mercurial'''
316
c48d069163d6 Add new convert-repo script
mpm@selenic.com
parents:
diff changeset
     8
5621
badbefa55972 convert: move commands definition to ease demandload job (issue 860)
Patrick Mezard <pmezard@gmail.com>
parents: 5521
diff changeset
     9
import convcmd
7502
16905fc2690f Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7236
diff changeset
    10
import cvsps
5621
badbefa55972 convert: move commands definition to ease demandload job (issue 860)
Patrick Mezard <pmezard@gmail.com>
parents: 5521
diff changeset
    11
from mercurial import commands
6999
f1546aa94362 i18n, convert: mark command line options for translation
Martin Geisler <mg@daimi.au.dk>
parents: 6976
diff changeset
    12
from mercurial.i18n import _
316
c48d069163d6 Add new convert-repo script
mpm@selenic.com
parents:
diff changeset
    13
5621
badbefa55972 convert: move commands definition to ease demandload job (issue 860)
Patrick Mezard <pmezard@gmail.com>
parents: 5521
diff changeset
    14
# Commands definition was moved elsewhere to ease demandload job.
694
51eb248d3348 Teach convert-repo about tags
mpm@selenic.com
parents: 692
diff changeset
    15
5281
a176f9c8b26e convert: rename a class and a function
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5256
diff changeset
    16
def convert(ui, src, dest=None, revmapfile=None, **opts):
7598
26adfaccdf73 lowercase help output
Martin Geisler <mg@daimi.au.dk>
parents: 7502
diff changeset
    17
    """convert a foreign SCM repository to a Mercurial one.
4513
ac2fe196ac9b Turns convert.py into a real extension
Edouard Gomez <ed.gomez@free.fr>
parents: 4512
diff changeset
    18
6976
b072266a83d1 convert: document source and sink identifiers, fix error message
Patrick Mezard <pmezard@gmail.com>
parents: 6923
diff changeset
    19
    Accepted source formats [identifiers]:
b072266a83d1 convert: document source and sink identifiers, fix error message
Patrick Mezard <pmezard@gmail.com>
parents: 6923
diff changeset
    20
    - Mercurial [hg]
b072266a83d1 convert: document source and sink identifiers, fix error message
Patrick Mezard <pmezard@gmail.com>
parents: 6923
diff changeset
    21
    - CVS [cvs]
b072266a83d1 convert: document source and sink identifiers, fix error message
Patrick Mezard <pmezard@gmail.com>
parents: 6923
diff changeset
    22
    - Darcs [darcs]
b072266a83d1 convert: document source and sink identifiers, fix error message
Patrick Mezard <pmezard@gmail.com>
parents: 6923
diff changeset
    23
    - git [git]
b072266a83d1 convert: document source and sink identifiers, fix error message
Patrick Mezard <pmezard@gmail.com>
parents: 6923
diff changeset
    24
    - Subversion [svn]
b072266a83d1 convert: document source and sink identifiers, fix error message
Patrick Mezard <pmezard@gmail.com>
parents: 6923
diff changeset
    25
    - Monotone [mtn]
b072266a83d1 convert: document source and sink identifiers, fix error message
Patrick Mezard <pmezard@gmail.com>
parents: 6923
diff changeset
    26
    - GNU Arch [gnuarch]
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents: 6999
diff changeset
    27
    - Bazaar [bzr]
4513
ac2fe196ac9b Turns convert.py into a real extension
Edouard Gomez <ed.gomez@free.fr>
parents: 4512
diff changeset
    28
6976
b072266a83d1 convert: document source and sink identifiers, fix error message
Patrick Mezard <pmezard@gmail.com>
parents: 6923
diff changeset
    29
    Accepted destination formats [identifiers]:
b072266a83d1 convert: document source and sink identifiers, fix error message
Patrick Mezard <pmezard@gmail.com>
parents: 6923
diff changeset
    30
    - Mercurial [hg]
b072266a83d1 convert: document source and sink identifiers, fix error message
Patrick Mezard <pmezard@gmail.com>
parents: 6923
diff changeset
    31
    - Subversion [svn] (history on branches is not preserved)
4513
ac2fe196ac9b Turns convert.py into a real extension
Edouard Gomez <ed.gomez@free.fr>
parents: 4512
diff changeset
    32
4760
07efcce17d28 convert: add -r argument specifying latest revision to convert
Brendan Cully <brendan@kublai.com>
parents: 4719
diff changeset
    33
    If no revision is given, all revisions will be converted. Otherwise,
07efcce17d28 convert: add -r argument specifying latest revision to convert
Brendan Cully <brendan@kublai.com>
parents: 4719
diff changeset
    34
    convert will only import up to the named revision (given in a format
07efcce17d28 convert: add -r argument specifying latest revision to convert
Brendan Cully <brendan@kublai.com>
parents: 4719
diff changeset
    35
    understood by the source).
07efcce17d28 convert: add -r argument specifying latest revision to convert
Brendan Cully <brendan@kublai.com>
parents: 4719
diff changeset
    36
4883
72ac66e88c43 convert: Use clone's behaviour for the default destionation name.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4719
diff changeset
    37
    If no destination directory name is specified, it defaults to the
4958
71fed370b7a7 Backout ad09ce1d393c and replace ''' with """ to make some highlighting happy.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4957
diff changeset
    38
    basename of the source with '-hg' appended.  If the destination
71fed370b7a7 Backout ad09ce1d393c and replace ''' with """ to make some highlighting happy.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4957
diff changeset
    39
    repository doesn't exist, it will be created.
4513
ac2fe196ac9b Turns convert.py into a real extension
Edouard Gomez <ed.gomez@free.fr>
parents: 4512
diff changeset
    40
6238
aac270593ef7 convert: rename MAPFILE into REVMAP to disambiguate with filemap
Patrick Mezard <pmezard@gmail.com>
parents: 6173
diff changeset
    41
    If <REVMAP> isn't given, it will be put in a default location
aac270593ef7 convert: rename MAPFILE into REVMAP to disambiguate with filemap
Patrick Mezard <pmezard@gmail.com>
parents: 6173
diff changeset
    42
    (<dest>/.hg/shamap by default).  The <REVMAP> is a simple text
4883
72ac66e88c43 convert: Use clone's behaviour for the default destionation name.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4719
diff changeset
    43
    file that maps each source commit ID to the destination ID for
72ac66e88c43 convert: Use clone's behaviour for the default destionation name.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4719
diff changeset
    44
    that revision, like so:
4513
ac2fe196ac9b Turns convert.py into a real extension
Edouard Gomez <ed.gomez@free.fr>
parents: 4512
diff changeset
    45
    <source ID> <destination ID>
ac2fe196ac9b Turns convert.py into a real extension
Edouard Gomez <ed.gomez@free.fr>
parents: 4512
diff changeset
    46
4958
71fed370b7a7 Backout ad09ce1d393c and replace ''' with """ to make some highlighting happy.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4957
diff changeset
    47
    If the file doesn't exist, it's automatically created.  It's updated
4513
ac2fe196ac9b Turns convert.py into a real extension
Edouard Gomez <ed.gomez@free.fr>
parents: 4512
diff changeset
    48
    on each commit copied, so convert-repo can be interrupted and can
ac2fe196ac9b Turns convert.py into a real extension
Edouard Gomez <ed.gomez@free.fr>
parents: 4512
diff changeset
    49
    be run repeatedly to copy new commits.
4589
451e91ed535e convert extension: Add support for username mapping
Edouard Gomez <ed.gomez@free.fr>
parents: 4588
diff changeset
    50
451e91ed535e convert extension: Add support for username mapping
Edouard Gomez <ed.gomez@free.fr>
parents: 4588
diff changeset
    51
    The [username mapping] file is a simple text file that maps each source
451e91ed535e convert extension: Add support for username mapping
Edouard Gomez <ed.gomez@free.fr>
parents: 4588
diff changeset
    52
    commit author to a destination commit author. It is handy for source SCMs
451e91ed535e convert extension: Add support for username mapping
Edouard Gomez <ed.gomez@free.fr>
parents: 4588
diff changeset
    53
    that use unix logins to identify authors (eg: CVS). One line per author
451e91ed535e convert extension: Add support for username mapping
Edouard Gomez <ed.gomez@free.fr>
parents: 4588
diff changeset
    54
    mapping and the line format is:
451e91ed535e convert extension: Add support for username mapping
Edouard Gomez <ed.gomez@free.fr>
parents: 4588
diff changeset
    55
    srcauthor=whatever string you want
5256
0b0caffcf175 convert: document filemap.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5204
diff changeset
    56
0b0caffcf175 convert: document filemap.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5204
diff changeset
    57
    The filemap is a file that allows filtering and remapping of files
0b0caffcf175 convert: document filemap.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5204
diff changeset
    58
    and directories.  Comment lines start with '#'.  Each line can
0b0caffcf175 convert: document filemap.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5204
diff changeset
    59
    contain one of the following directives:
0b0caffcf175 convert: document filemap.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5204
diff changeset
    60
0b0caffcf175 convert: document filemap.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5204
diff changeset
    61
      include path/to/file
0b0caffcf175 convert: document filemap.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5204
diff changeset
    62
0b0caffcf175 convert: document filemap.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5204
diff changeset
    63
      exclude path/to/file
0b0caffcf175 convert: document filemap.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5204
diff changeset
    64
0b0caffcf175 convert: document filemap.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5204
diff changeset
    65
      rename from/file to/file
5760
0145f9afb0e7 Removed tabs and trailing whitespace in python files
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5632
diff changeset
    66
5256
0b0caffcf175 convert: document filemap.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5204
diff changeset
    67
    The 'include' directive causes a file, or all files under a
5484
07bdb5e5d08c Update convert help text
"Rafael Villar Burke <pachi@rvburke.com>"
parents: 5441
diff changeset
    68
    directory, to be included in the destination repository, and the
5488
247af577fe29 fix typo in convert help text, update test
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5484
diff changeset
    69
    exclusion of all other files and dirs not explicitely included.
5484
07bdb5e5d08c Update convert help text
"Rafael Villar Burke <pachi@rvburke.com>"
parents: 5441
diff changeset
    70
    The 'exclude' directive causes files or directories to be omitted.
07bdb5e5d08c Update convert help text
"Rafael Villar Burke <pachi@rvburke.com>"
parents: 5441
diff changeset
    71
    The 'rename' directive renames a file or directory.  To rename from a
07bdb5e5d08c Update convert help text
"Rafael Villar Burke <pachi@rvburke.com>"
parents: 5441
diff changeset
    72
    subdirectory into the root of the repository, use '.' as the path to
07bdb5e5d08c Update convert help text
"Rafael Villar Burke <pachi@rvburke.com>"
parents: 5441
diff changeset
    73
    rename to.
5556
61fdf2558c0a convert: some tidyups, doc improvements, and test fixes
Bryan O'Sullivan <bos@serpentine.com>
parents: 5554
diff changeset
    74
6143
5b159ebb19cf convert: document splicemap, allow setting of multiple parents
Bryan O'Sullivan <bos@serpentine.com>
parents: 6035
diff changeset
    75
    The splicemap is a file that allows insertion of synthetic
5b159ebb19cf convert: document splicemap, allow setting of multiple parents
Bryan O'Sullivan <bos@serpentine.com>
parents: 6035
diff changeset
    76
    history, letting you specify the parents of a revision.  This is
5b159ebb19cf convert: document splicemap, allow setting of multiple parents
Bryan O'Sullivan <bos@serpentine.com>
parents: 6035
diff changeset
    77
    useful if you want to e.g. give a Subversion merge two parents, or
5b159ebb19cf convert: document splicemap, allow setting of multiple parents
Bryan O'Sullivan <bos@serpentine.com>
parents: 6035
diff changeset
    78
    graft two disconnected series of history together.  Each entry
5b159ebb19cf convert: document splicemap, allow setting of multiple parents
Bryan O'Sullivan <bos@serpentine.com>
parents: 6035
diff changeset
    79
    contains a key, followed by a space, followed by one or two
5b159ebb19cf convert: document splicemap, allow setting of multiple parents
Bryan O'Sullivan <bos@serpentine.com>
parents: 6035
diff changeset
    80
    values, separated by spaces.  The key is the revision ID in the
5b159ebb19cf convert: document splicemap, allow setting of multiple parents
Bryan O'Sullivan <bos@serpentine.com>
parents: 6035
diff changeset
    81
    source revision control system whose parents should be modified
5b159ebb19cf convert: document splicemap, allow setting of multiple parents
Bryan O'Sullivan <bos@serpentine.com>
parents: 6035
diff changeset
    82
    (same format as a key in .hg/shamap).  The values are the revision
5b159ebb19cf convert: document splicemap, allow setting of multiple parents
Bryan O'Sullivan <bos@serpentine.com>
parents: 6035
diff changeset
    83
    IDs (in either the source or destination revision control system)
5b159ebb19cf convert: document splicemap, allow setting of multiple parents
Bryan O'Sullivan <bos@serpentine.com>
parents: 6035
diff changeset
    84
    that should be used as the new parents for that node.
5b159ebb19cf convert: document splicemap, allow setting of multiple parents
Bryan O'Sullivan <bos@serpentine.com>
parents: 6035
diff changeset
    85
6169
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
    86
    Mercurial Source
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
    87
    -----------------
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
    88
7236
db6fbb785800 Remove trailing spaces.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 7231
diff changeset
    89
    --config convert.hg.ignoreerrors=False (boolean)
7231
8e7130a10f3b convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents: 7170
diff changeset
    90
        ignore integrity errors when reading. Use it to fix Mercurial
8e7130a10f3b convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents: 7170
diff changeset
    91
        repositories with missing revlogs, by converting from and to
8e7130a10f3b convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents: 7170
diff changeset
    92
        Mercurial.
6169
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
    93
    --config convert.hg.saverev=True          (boolean)
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
    94
        allow target to preserve source revision ID
6885
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents: 6798
diff changeset
    95
    --config convert.hg.startrev=0            (hg revision identifier)
6e253aa04ff7 convert: implement startrev for hg source
Patrick Mezard <pmezard@gmail.com>
parents: 6798
diff changeset
    96
        convert start revision and its descendants
6169
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
    97
6798
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
    98
    CVS Source
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
    99
    ----------
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   100
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   101
    CVS source will use a sandbox (i.e. a checked-out copy) from CVS
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   102
    to indicate the starting point of what will be converted. Direct
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   103
    access to the repository files is not needed, unless of course
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   104
    the repository is :local:. The conversion uses the top level
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   105
    directory in the sandbox to find the CVS repository, and then uses
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   106
    CVS rlog commands to find files to convert. This means that unless
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   107
    a filemap is given, all files under the starting directory will be
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   108
    converted, and that any directory reorganisation in the CVS
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   109
    sandbox is ignored.
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   110
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   111
    Because CVS does not have changesets, it is necessary to collect
7101
e786192d995d convert: make built-in cvsps the default
Patrick Mezard <pmezard@gmail.com>
parents: 7053
diff changeset
   112
    individual commits to CVS and merge them into changesets. CVS
e786192d995d convert: make built-in cvsps the default
Patrick Mezard <pmezard@gmail.com>
parents: 7053
diff changeset
   113
    source uses its internal changeset merging code by default but can
e786192d995d convert: make built-in cvsps the default
Patrick Mezard <pmezard@gmail.com>
parents: 7053
diff changeset
   114
    be configured to call the external 'cvsps' program by setting:
7170
aff204c9bdd6 convert documentation: --config argument with spaces needs quoting.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 7101
diff changeset
   115
        --config convert.cvsps='cvsps -A -u --cvs-direct -q'
7101
e786192d995d convert: make built-in cvsps the default
Patrick Mezard <pmezard@gmail.com>
parents: 7053
diff changeset
   116
    This is a legacy option and may be removed in future.
e786192d995d convert: make built-in cvsps the default
Patrick Mezard <pmezard@gmail.com>
parents: 7053
diff changeset
   117
6798
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   118
    The options shown are the defaults.
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   119
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   120
    Internal cvsps is selected by setting
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   121
        --config convert.cvsps=builtin
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   122
    and has a few more configurable options:
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   123
        --config convert.cvsps.fuzz=60   (integer)
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   124
            Specify the maximum time (in seconds) that is allowed between
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   125
            commits with identical user and log message in a single
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   126
            changeset. When very large files were checked in as part
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   127
            of a changeset then the default may not be long enough.
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   128
        --config convert.cvsps.mergeto='{{mergetobranch ([-\w]+)}}'
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   129
            Specify a regular expression to which commit log messages are
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   130
            matched. If a match occurs, then the conversion process will
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   131
            insert a dummy revision merging the branch on which this log
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   132
            message occurs to the branch indicated in the regex.
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   133
        --config convert.cvsps.mergefrom='{{mergefrombranch ([-\w]+)}}'
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   134
            Specify a regular expression to which commit log messages are
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   135
            matched. If a match occurs, then the conversion process will
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   136
            add the most recent revision on the branch indicated in the
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   137
            regex as the second parent of the changeset.
6923
ebf1462f2145 strip trailing whitespace, replace tabs by spaces
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6885
diff changeset
   138
6798
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   139
    The hgext/convert/cvsps wrapper script allows the builtin changeset
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   140
    merging code to be run without doing a conversion. Its parameters and
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   141
    output are similar to that of cvsps 2.1.
ceb28b67204e convert: add documentation for CVS source
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6666
diff changeset
   142
6169
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   143
    Subversion Source
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   144
    -----------------
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   145
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   146
    Subversion source detects classical trunk/branches/tags layouts.
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   147
    By default, the supplied "svn://repo/path/" source URL is
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   148
    converted as a single branch. If "svn://repo/path/trunk" exists
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   149
    it replaces the default branch. If "svn://repo/path/branches"
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   150
    exists, its subdirectories are listed as possible branches. If
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   151
    "svn://repo/path/tags" exists, it is looked for tags referencing
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   152
    converted branches. Default "trunk", "branches" and "tags" values
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   153
    can be overriden with following options. Set them to paths
6172
0cd6846e5200 convert: allow svn trunk/branches/tags detection to be skipped
Patrick Mezard <pmezard@gmail.com>
parents: 6169
diff changeset
   154
    relative to the source URL, or leave them blank to disable
0cd6846e5200 convert: allow svn trunk/branches/tags detection to be skipped
Patrick Mezard <pmezard@gmail.com>
parents: 6169
diff changeset
   155
    autodetection.
6169
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   156
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   157
    --config convert.svn.branches=branches    (directory name)
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   158
        specify the directory containing branches
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   159
    --config convert.svn.tags=tags            (directory name)
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   160
        specify the directory containing tags
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   161
    --config convert.svn.trunk=trunk          (directory name)
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   162
        specify the name of the trunk branch
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   163
6173
963000ed8cac convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents: 6172
diff changeset
   164
    Source history can be retrieved starting at a specific revision,
963000ed8cac convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents: 6172
diff changeset
   165
    instead of being integrally converted. Only single branch
963000ed8cac convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents: 6172
diff changeset
   166
    conversions are supported.
963000ed8cac convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents: 6172
diff changeset
   167
963000ed8cac convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents: 6172
diff changeset
   168
    --config convert.svn.startrev=0           (svn revision number)
963000ed8cac convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents: 6172
diff changeset
   169
        specify start Subversion revision.
963000ed8cac convert: add shallow, single branch svn conversions via svn.startrev
Patrick Mezard <pmezard@gmail.com>
parents: 6172
diff changeset
   170
6169
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   171
    Mercurial Destination
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   172
    ---------------------
5556
61fdf2558c0a convert: some tidyups, doc improvements, and test fixes
Bryan O'Sullivan <bos@serpentine.com>
parents: 5554
diff changeset
   173
61fdf2558c0a convert: some tidyups, doc improvements, and test fixes
Bryan O'Sullivan <bos@serpentine.com>
parents: 5554
diff changeset
   174
    --config convert.hg.clonebranches=False   (boolean)
6169
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   175
        dispatch source branches in separate clones.
5556
61fdf2558c0a convert: some tidyups, doc improvements, and test fixes
Bryan O'Sullivan <bos@serpentine.com>
parents: 5554
diff changeset
   176
    --config convert.hg.tagsbranch=default    (branch name)
6169
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   177
        tag revisions branch name
5556
61fdf2558c0a convert: some tidyups, doc improvements, and test fixes
Bryan O'Sullivan <bos@serpentine.com>
parents: 5554
diff changeset
   178
    --config convert.hg.usebranchnames=True   (boolean)
6169
55455556f921 convert: improve subversion source documentation
Patrick Mezard <pmezard@gmail.com>
parents: 6143
diff changeset
   179
        preserve branch names
5556
61fdf2558c0a convert: some tidyups, doc improvements, and test fixes
Bryan O'Sullivan <bos@serpentine.com>
parents: 5554
diff changeset
   180
4958
71fed370b7a7 Backout ad09ce1d393c and replace ''' with """ to make some highlighting happy.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4957
diff changeset
   181
    """
5621
badbefa55972 convert: move commands definition to ease demandload job (issue 860)
Patrick Mezard <pmezard@gmail.com>
parents: 5521
diff changeset
   182
    return convcmd.convert(ui, src, dest, revmapfile, **opts)
316
c48d069163d6 Add new convert-repo script
mpm@selenic.com
parents:
diff changeset
   183
5621
badbefa55972 convert: move commands definition to ease demandload job (issue 860)
Patrick Mezard <pmezard@gmail.com>
parents: 5521
diff changeset
   184
def debugsvnlog(ui, **opts):
badbefa55972 convert: move commands definition to ease demandload job (issue 860)
Patrick Mezard <pmezard@gmail.com>
parents: 5521
diff changeset
   185
    return convcmd.debugsvnlog(ui, **opts)
316
c48d069163d6 Add new convert-repo script
mpm@selenic.com
parents:
diff changeset
   186
7502
16905fc2690f Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7236
diff changeset
   187
def debugcvsps(ui, *args, **opts):
7598
26adfaccdf73 lowercase help output
Martin Geisler <mg@daimi.au.dk>
parents: 7502
diff changeset
   188
    '''create changeset information from CVS
7502
16905fc2690f Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7236
diff changeset
   189
16905fc2690f Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7236
diff changeset
   190
    This command is intended as a debugging tool for the CVS to Mercurial
16905fc2690f Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7236
diff changeset
   191
    converter, and can be used as a direct replacement for cvsps.
16905fc2690f Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7236
diff changeset
   192
16905fc2690f Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7236
diff changeset
   193
    Hg debugcvsps reads the CVS rlog for current directory (or any named
16905fc2690f Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7236
diff changeset
   194
    directory) in the CVS repository, and converts the log to a series of
16905fc2690f Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7236
diff changeset
   195
    changesets based on matching commit log entries and dates.'''
16905fc2690f Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7236
diff changeset
   196
    return cvsps.debugcvsps(ui, *args, **opts)
16905fc2690f Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7236
diff changeset
   197
16905fc2690f Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7236
diff changeset
   198
commands.norepo += " convert debugsvnlog debugcvsps"
5127
39b6eaee6fd7 convert: replace fork with subprocess call.
Patrick Mezard <pmezard@gmail.com>
parents: 5121
diff changeset
   199
4513
ac2fe196ac9b Turns convert.py into a real extension
Edouard Gomez <ed.gomez@free.fr>
parents: 4512
diff changeset
   200
cmdtable = {
4532
c3a78a49d7f0 Some small cleanups for convert extension:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4521
diff changeset
   201
    "convert":
5281
a176f9c8b26e convert: rename a class and a function
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5256
diff changeset
   202
        (convert,
6999
f1546aa94362 i18n, convert: mark command line options for translation
Martin Geisler <mg@daimi.au.dk>
parents: 6976
diff changeset
   203
         [('A', 'authors', '', _('username mapping filename')),
f1546aa94362 i18n, convert: mark command line options for translation
Martin Geisler <mg@daimi.au.dk>
parents: 6976
diff changeset
   204
          ('d', 'dest-type', '', _('destination repository type')),
f1546aa94362 i18n, convert: mark command line options for translation
Martin Geisler <mg@daimi.au.dk>
parents: 6976
diff changeset
   205
          ('', 'filemap', '', _('remap file names using contents of file')),
f1546aa94362 i18n, convert: mark command line options for translation
Martin Geisler <mg@daimi.au.dk>
parents: 6976
diff changeset
   206
          ('r', 'rev', '', _('import up to target revision REV')),
f1546aa94362 i18n, convert: mark command line options for translation
Martin Geisler <mg@daimi.au.dk>
parents: 6976
diff changeset
   207
          ('s', 'source-type', '', _('source repository type')),
f1546aa94362 i18n, convert: mark command line options for translation
Martin Geisler <mg@daimi.au.dk>
parents: 6976
diff changeset
   208
          ('', 'splicemap', '', _('splice synthesized history into place')),
f1546aa94362 i18n, convert: mark command line options for translation
Martin Geisler <mg@daimi.au.dk>
parents: 6976
diff changeset
   209
          ('', 'datesort', None, _('try to sort changesets by date'))],
f1546aa94362 i18n, convert: mark command line options for translation
Martin Geisler <mg@daimi.au.dk>
parents: 6976
diff changeset
   210
         _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]')),
5138
9cda2315c7a9 convert: Use debugsvnlog instead of git-like debug-svn-log.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5134
diff changeset
   211
    "debugsvnlog":
5127
39b6eaee6fd7 convert: replace fork with subprocess call.
Patrick Mezard <pmezard@gmail.com>
parents: 5121
diff changeset
   212
        (debugsvnlog,
39b6eaee6fd7 convert: replace fork with subprocess call.
Patrick Mezard <pmezard@gmail.com>
parents: 5121
diff changeset
   213
         [],
5138
9cda2315c7a9 convert: Use debugsvnlog instead of git-like debug-svn-log.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5134
diff changeset
   214
         'hg debugsvnlog'),
7502
16905fc2690f Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7236
diff changeset
   215
    "debugcvsps":
16905fc2690f Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7236
diff changeset
   216
        (debugcvsps,
16905fc2690f Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7236
diff changeset
   217
         [
16905fc2690f Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7236
diff changeset
   218
          # Main options shared with cvsps-2.1
7598
26adfaccdf73 lowercase help output
Martin Geisler <mg@daimi.au.dk>
parents: 7502
diff changeset
   219
          ('b', 'branches', [], _('only return changes on specified branches')),
26adfaccdf73 lowercase help output
Martin Geisler <mg@daimi.au.dk>
parents: 7502
diff changeset
   220
          ('p', 'prefix', '', _('prefix to remove from file names')),
26adfaccdf73 lowercase help output
Martin Geisler <mg@daimi.au.dk>
parents: 7502
diff changeset
   221
          ('r', 'revisions', [], _('only return changes after or between specified tags')),
26adfaccdf73 lowercase help output
Martin Geisler <mg@daimi.au.dk>
parents: 7502
diff changeset
   222
          ('u', 'update-cache', None, _("update cvs log cache")),
26adfaccdf73 lowercase help output
Martin Geisler <mg@daimi.au.dk>
parents: 7502
diff changeset
   223
          ('x', 'new-cache', None, _("create new cvs log cache")),
26adfaccdf73 lowercase help output
Martin Geisler <mg@daimi.au.dk>
parents: 7502
diff changeset
   224
          ('z', 'fuzz', 60, _('set commit time fuzz in seconds')),
26adfaccdf73 lowercase help output
Martin Geisler <mg@daimi.au.dk>
parents: 7502
diff changeset
   225
          ('', 'root', '', _('specify cvsroot')),
7502
16905fc2690f Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7236
diff changeset
   226
          # Options specific to builtin cvsps
7598
26adfaccdf73 lowercase help output
Martin Geisler <mg@daimi.au.dk>
parents: 7502
diff changeset
   227
          ('', 'parents', '', _('show parent changesets')),
26adfaccdf73 lowercase help output
Martin Geisler <mg@daimi.au.dk>
parents: 7502
diff changeset
   228
          ('', 'ancestors', '', _('show current changeset in ancestor branches')),
7502
16905fc2690f Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7236
diff changeset
   229
          # Options that are ignored for compatibility with cvsps-2.1
7598
26adfaccdf73 lowercase help output
Martin Geisler <mg@daimi.au.dk>
parents: 7502
diff changeset
   230
          ('A', 'cvs-direct', None, 'ignored for compatibility'),
7502
16905fc2690f Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7236
diff changeset
   231
         ],
16905fc2690f Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7236
diff changeset
   232
         'hg debugcvsps [OPTION]... [PATH]...'),
4513
ac2fe196ac9b Turns convert.py into a real extension
Edouard Gomez <ed.gomez@free.fr>
parents: 4512
diff changeset
   233
}