##// END OF EJS Templates
i18n, convert: mark command line options for translation
Martin Geisler -
r6999:f1546aa9 default
parent child Browse files
Show More
@@ -1,196 +1,197 b''
1 # convert.py Foreign SCM converter
1 # convert.py Foreign SCM converter
2 #
2 #
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms
5 # This software may be used and distributed according to the terms
6 # of the GNU General Public License, incorporated herein by reference.
6 # of the GNU General Public License, incorporated herein by reference.
7 '''converting foreign VCS repositories to Mercurial'''
7 '''converting foreign VCS repositories to Mercurial'''
8
8
9 import convcmd
9 import convcmd
10 from mercurial import commands
10 from mercurial import commands
11 from mercurial.i18n import _
11
12
12 # Commands definition was moved elsewhere to ease demandload job.
13 # Commands definition was moved elsewhere to ease demandload job.
13
14
14 def convert(ui, src, dest=None, revmapfile=None, **opts):
15 def convert(ui, src, dest=None, revmapfile=None, **opts):
15 """Convert a foreign SCM repository to a Mercurial one.
16 """Convert a foreign SCM repository to a Mercurial one.
16
17
17 Accepted source formats [identifiers]:
18 Accepted source formats [identifiers]:
18 - Mercurial [hg]
19 - Mercurial [hg]
19 - CVS [cvs]
20 - CVS [cvs]
20 - Darcs [darcs]
21 - Darcs [darcs]
21 - git [git]
22 - git [git]
22 - Subversion [svn]
23 - Subversion [svn]
23 - Monotone [mtn]
24 - Monotone [mtn]
24 - GNU Arch [gnuarch]
25 - GNU Arch [gnuarch]
25
26
26 Accepted destination formats [identifiers]:
27 Accepted destination formats [identifiers]:
27 - Mercurial [hg]
28 - Mercurial [hg]
28 - Subversion [svn] (history on branches is not preserved)
29 - Subversion [svn] (history on branches is not preserved)
29
30
30 If no revision is given, all revisions will be converted. Otherwise,
31 If no revision is given, all revisions will be converted. Otherwise,
31 convert will only import up to the named revision (given in a format
32 convert will only import up to the named revision (given in a format
32 understood by the source).
33 understood by the source).
33
34
34 If no destination directory name is specified, it defaults to the
35 If no destination directory name is specified, it defaults to the
35 basename of the source with '-hg' appended. If the destination
36 basename of the source with '-hg' appended. If the destination
36 repository doesn't exist, it will be created.
37 repository doesn't exist, it will be created.
37
38
38 If <REVMAP> isn't given, it will be put in a default location
39 If <REVMAP> isn't given, it will be put in a default location
39 (<dest>/.hg/shamap by default). The <REVMAP> is a simple text
40 (<dest>/.hg/shamap by default). The <REVMAP> is a simple text
40 file that maps each source commit ID to the destination ID for
41 file that maps each source commit ID to the destination ID for
41 that revision, like so:
42 that revision, like so:
42 <source ID> <destination ID>
43 <source ID> <destination ID>
43
44
44 If the file doesn't exist, it's automatically created. It's updated
45 If the file doesn't exist, it's automatically created. It's updated
45 on each commit copied, so convert-repo can be interrupted and can
46 on each commit copied, so convert-repo can be interrupted and can
46 be run repeatedly to copy new commits.
47 be run repeatedly to copy new commits.
47
48
48 The [username mapping] file is a simple text file that maps each source
49 The [username mapping] file is a simple text file that maps each source
49 commit author to a destination commit author. It is handy for source SCMs
50 commit author to a destination commit author. It is handy for source SCMs
50 that use unix logins to identify authors (eg: CVS). One line per author
51 that use unix logins to identify authors (eg: CVS). One line per author
51 mapping and the line format is:
52 mapping and the line format is:
52 srcauthor=whatever string you want
53 srcauthor=whatever string you want
53
54
54 The filemap is a file that allows filtering and remapping of files
55 The filemap is a file that allows filtering and remapping of files
55 and directories. Comment lines start with '#'. Each line can
56 and directories. Comment lines start with '#'. Each line can
56 contain one of the following directives:
57 contain one of the following directives:
57
58
58 include path/to/file
59 include path/to/file
59
60
60 exclude path/to/file
61 exclude path/to/file
61
62
62 rename from/file to/file
63 rename from/file to/file
63
64
64 The 'include' directive causes a file, or all files under a
65 The 'include' directive causes a file, or all files under a
65 directory, to be included in the destination repository, and the
66 directory, to be included in the destination repository, and the
66 exclusion of all other files and dirs not explicitely included.
67 exclusion of all other files and dirs not explicitely included.
67 The 'exclude' directive causes files or directories to be omitted.
68 The 'exclude' directive causes files or directories to be omitted.
68 The 'rename' directive renames a file or directory. To rename from a
69 The 'rename' directive renames a file or directory. To rename from a
69 subdirectory into the root of the repository, use '.' as the path to
70 subdirectory into the root of the repository, use '.' as the path to
70 rename to.
71 rename to.
71
72
72 The splicemap is a file that allows insertion of synthetic
73 The splicemap is a file that allows insertion of synthetic
73 history, letting you specify the parents of a revision. This is
74 history, letting you specify the parents of a revision. This is
74 useful if you want to e.g. give a Subversion merge two parents, or
75 useful if you want to e.g. give a Subversion merge two parents, or
75 graft two disconnected series of history together. Each entry
76 graft two disconnected series of history together. Each entry
76 contains a key, followed by a space, followed by one or two
77 contains a key, followed by a space, followed by one or two
77 values, separated by spaces. The key is the revision ID in the
78 values, separated by spaces. The key is the revision ID in the
78 source revision control system whose parents should be modified
79 source revision control system whose parents should be modified
79 (same format as a key in .hg/shamap). The values are the revision
80 (same format as a key in .hg/shamap). The values are the revision
80 IDs (in either the source or destination revision control system)
81 IDs (in either the source or destination revision control system)
81 that should be used as the new parents for that node.
82 that should be used as the new parents for that node.
82
83
83 Mercurial Source
84 Mercurial Source
84 -----------------
85 -----------------
85
86
86 --config convert.hg.saverev=True (boolean)
87 --config convert.hg.saverev=True (boolean)
87 allow target to preserve source revision ID
88 allow target to preserve source revision ID
88 --config convert.hg.startrev=0 (hg revision identifier)
89 --config convert.hg.startrev=0 (hg revision identifier)
89 convert start revision and its descendants
90 convert start revision and its descendants
90
91
91 CVS Source
92 CVS Source
92 ----------
93 ----------
93
94
94 CVS source will use a sandbox (i.e. a checked-out copy) from CVS
95 CVS source will use a sandbox (i.e. a checked-out copy) from CVS
95 to indicate the starting point of what will be converted. Direct
96 to indicate the starting point of what will be converted. Direct
96 access to the repository files is not needed, unless of course
97 access to the repository files is not needed, unless of course
97 the repository is :local:. The conversion uses the top level
98 the repository is :local:. The conversion uses the top level
98 directory in the sandbox to find the CVS repository, and then uses
99 directory in the sandbox to find the CVS repository, and then uses
99 CVS rlog commands to find files to convert. This means that unless
100 CVS rlog commands to find files to convert. This means that unless
100 a filemap is given, all files under the starting directory will be
101 a filemap is given, all files under the starting directory will be
101 converted, and that any directory reorganisation in the CVS
102 converted, and that any directory reorganisation in the CVS
102 sandbox is ignored.
103 sandbox is ignored.
103
104
104 Because CVS does not have changesets, it is necessary to collect
105 Because CVS does not have changesets, it is necessary to collect
105 individual commits to CVS and merge them into changesets. CVS source
106 individual commits to CVS and merge them into changesets. CVS source
106 can use the external 'cvsps' program (this is a legacy option and may
107 can use the external 'cvsps' program (this is a legacy option and may
107 be removed in future) or use its internal changeset merging code.
108 be removed in future) or use its internal changeset merging code.
108 External cvsps is default, and options may be passed to it by setting
109 External cvsps is default, and options may be passed to it by setting
109 --config convert.cvsps='cvsps -A -u --cvs-direct -q'
110 --config convert.cvsps='cvsps -A -u --cvs-direct -q'
110 The options shown are the defaults.
111 The options shown are the defaults.
111
112
112 Internal cvsps is selected by setting
113 Internal cvsps is selected by setting
113 --config convert.cvsps=builtin
114 --config convert.cvsps=builtin
114 and has a few more configurable options:
115 and has a few more configurable options:
115 --config convert.cvsps.fuzz=60 (integer)
116 --config convert.cvsps.fuzz=60 (integer)
116 Specify the maximum time (in seconds) that is allowed between
117 Specify the maximum time (in seconds) that is allowed between
117 commits with identical user and log message in a single
118 commits with identical user and log message in a single
118 changeset. When very large files were checked in as part
119 changeset. When very large files were checked in as part
119 of a changeset then the default may not be long enough.
120 of a changeset then the default may not be long enough.
120 --config convert.cvsps.mergeto='{{mergetobranch ([-\w]+)}}'
121 --config convert.cvsps.mergeto='{{mergetobranch ([-\w]+)}}'
121 Specify a regular expression to which commit log messages are
122 Specify a regular expression to which commit log messages are
122 matched. If a match occurs, then the conversion process will
123 matched. If a match occurs, then the conversion process will
123 insert a dummy revision merging the branch on which this log
124 insert a dummy revision merging the branch on which this log
124 message occurs to the branch indicated in the regex.
125 message occurs to the branch indicated in the regex.
125 --config convert.cvsps.mergefrom='{{mergefrombranch ([-\w]+)}}'
126 --config convert.cvsps.mergefrom='{{mergefrombranch ([-\w]+)}}'
126 Specify a regular expression to which commit log messages are
127 Specify a regular expression to which commit log messages are
127 matched. If a match occurs, then the conversion process will
128 matched. If a match occurs, then the conversion process will
128 add the most recent revision on the branch indicated in the
129 add the most recent revision on the branch indicated in the
129 regex as the second parent of the changeset.
130 regex as the second parent of the changeset.
130
131
131 The hgext/convert/cvsps wrapper script allows the builtin changeset
132 The hgext/convert/cvsps wrapper script allows the builtin changeset
132 merging code to be run without doing a conversion. Its parameters and
133 merging code to be run without doing a conversion. Its parameters and
133 output are similar to that of cvsps 2.1.
134 output are similar to that of cvsps 2.1.
134
135
135 Subversion Source
136 Subversion Source
136 -----------------
137 -----------------
137
138
138 Subversion source detects classical trunk/branches/tags layouts.
139 Subversion source detects classical trunk/branches/tags layouts.
139 By default, the supplied "svn://repo/path/" source URL is
140 By default, the supplied "svn://repo/path/" source URL is
140 converted as a single branch. If "svn://repo/path/trunk" exists
141 converted as a single branch. If "svn://repo/path/trunk" exists
141 it replaces the default branch. If "svn://repo/path/branches"
142 it replaces the default branch. If "svn://repo/path/branches"
142 exists, its subdirectories are listed as possible branches. If
143 exists, its subdirectories are listed as possible branches. If
143 "svn://repo/path/tags" exists, it is looked for tags referencing
144 "svn://repo/path/tags" exists, it is looked for tags referencing
144 converted branches. Default "trunk", "branches" and "tags" values
145 converted branches. Default "trunk", "branches" and "tags" values
145 can be overriden with following options. Set them to paths
146 can be overriden with following options. Set them to paths
146 relative to the source URL, or leave them blank to disable
147 relative to the source URL, or leave them blank to disable
147 autodetection.
148 autodetection.
148
149
149 --config convert.svn.branches=branches (directory name)
150 --config convert.svn.branches=branches (directory name)
150 specify the directory containing branches
151 specify the directory containing branches
151 --config convert.svn.tags=tags (directory name)
152 --config convert.svn.tags=tags (directory name)
152 specify the directory containing tags
153 specify the directory containing tags
153 --config convert.svn.trunk=trunk (directory name)
154 --config convert.svn.trunk=trunk (directory name)
154 specify the name of the trunk branch
155 specify the name of the trunk branch
155
156
156 Source history can be retrieved starting at a specific revision,
157 Source history can be retrieved starting at a specific revision,
157 instead of being integrally converted. Only single branch
158 instead of being integrally converted. Only single branch
158 conversions are supported.
159 conversions are supported.
159
160
160 --config convert.svn.startrev=0 (svn revision number)
161 --config convert.svn.startrev=0 (svn revision number)
161 specify start Subversion revision.
162 specify start Subversion revision.
162
163
163 Mercurial Destination
164 Mercurial Destination
164 ---------------------
165 ---------------------
165
166
166 --config convert.hg.clonebranches=False (boolean)
167 --config convert.hg.clonebranches=False (boolean)
167 dispatch source branches in separate clones.
168 dispatch source branches in separate clones.
168 --config convert.hg.tagsbranch=default (branch name)
169 --config convert.hg.tagsbranch=default (branch name)
169 tag revisions branch name
170 tag revisions branch name
170 --config convert.hg.usebranchnames=True (boolean)
171 --config convert.hg.usebranchnames=True (boolean)
171 preserve branch names
172 preserve branch names
172
173
173 """
174 """
174 return convcmd.convert(ui, src, dest, revmapfile, **opts)
175 return convcmd.convert(ui, src, dest, revmapfile, **opts)
175
176
176 def debugsvnlog(ui, **opts):
177 def debugsvnlog(ui, **opts):
177 return convcmd.debugsvnlog(ui, **opts)
178 return convcmd.debugsvnlog(ui, **opts)
178
179
179 commands.norepo += " convert debugsvnlog"
180 commands.norepo += " convert debugsvnlog"
180
181
181 cmdtable = {
182 cmdtable = {
182 "convert":
183 "convert":
183 (convert,
184 (convert,
184 [('A', 'authors', '', 'username mapping filename'),
185 [('A', 'authors', '', _('username mapping filename')),
185 ('d', 'dest-type', '', 'destination repository type'),
186 ('d', 'dest-type', '', _('destination repository type')),
186 ('', 'filemap', '', 'remap file names using contents of file'),
187 ('', 'filemap', '', _('remap file names using contents of file')),
187 ('r', 'rev', '', 'import up to target revision REV'),
188 ('r', 'rev', '', _('import up to target revision REV')),
188 ('s', 'source-type', '', 'source repository type'),
189 ('s', 'source-type', '', _('source repository type')),
189 ('', 'splicemap', '', 'splice synthesized history into place'),
190 ('', 'splicemap', '', _('splice synthesized history into place')),
190 ('', 'datesort', None, 'try to sort changesets by date')],
191 ('', 'datesort', None, _('try to sort changesets by date'))],
191 'hg convert [OPTION]... SOURCE [DEST [REVMAP]]'),
192 _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]')),
192 "debugsvnlog":
193 "debugsvnlog":
193 (debugsvnlog,
194 (debugsvnlog,
194 [],
195 [],
195 'hg debugsvnlog'),
196 'hg debugsvnlog'),
196 }
197 }
General Comments 0
You need to be logged in to leave comments. Login now