comparison hgext/convert/__init__.py @ 9058:b10cee4bd2c1

convert: wrapped docstrings at 78 characters
author Martin Geisler <mg@lazybytes.net>
date Tue, 07 Jul 2009 23:54:42 +0200
parents f87884329419
children f459f09b4214
comparison
equal deleted inserted replaced
9057:07788bbb35e4 9058:b10cee4bd2c1
31 31
32 Accepted destination formats [identifiers]: 32 Accepted destination formats [identifiers]:
33 - Mercurial [hg] 33 - Mercurial [hg]
34 - Subversion [svn] (history on branches is not preserved) 34 - Subversion [svn] (history on branches is not preserved)
35 35
36 If no revision is given, all revisions will be converted. 36 If no revision is given, all revisions will be converted. Otherwise,
37 Otherwise, convert will only import up to the named revision 37 convert will only import up to the named revision (given in a format
38 (given in a format understood by the source). 38 understood by the source).
39 39
40 If no destination directory name is specified, it defaults to the 40 If no destination directory name is specified, it defaults to the basename
41 basename of the source with '-hg' appended. If the destination 41 of the source with '-hg' appended. If the destination repository doesn't
42 repository doesn't exist, it will be created. 42 exist, it will be created.
43 43
44 By default, all sources except Mercurial will use 44 By default, all sources except Mercurial will use --branchsort. Mercurial
45 --branchsort. Mercurial uses --sourcesort to preserve original 45 uses --sourcesort to preserve original revision numbers order. Sort modes
46 revision numbers order. Sort modes have the following effects: 46 have the following effects:
47 --branchsort: convert from parent to child revision when 47 --branchsort: convert from parent to child revision when possible, which
48 possible, which means branches are usually converted one after 48 means branches are usually converted one after the other. It generates
49 the other. It generates more compact repositories. 49 more compact repositories.
50 --datesort: sort revisions by date. Converted repositories have 50 --datesort: sort revisions by date. Converted repositories have
51 good-looking changelogs but are often an order of magnitude 51 good-looking changelogs but are often an order of magnitude larger
52 larger than the same ones generated by --branchsort. 52 than the same ones generated by --branchsort.
53 --sourcesort: try to preserve source revisions order, only 53 --sourcesort: try to preserve source revisions order, only supported by
54 supported by Mercurial sources. 54 Mercurial sources.
55 55
56 If <REVMAP> isn't given, it will be put in a default location 56 If <REVMAP> isn't given, it will be put in a default location
57 (<dest>/.hg/shamap by default). The <REVMAP> is a simple text file 57 (<dest>/.hg/shamap by default). The <REVMAP> is a simple text file that
58 that maps each source commit ID to the destination ID for that 58 maps each source commit ID to the destination ID for that revision, like
59 revision, like so: 59 so:
60
60 <source ID> <destination ID> 61 <source ID> <destination ID>
61 62
62 If the file doesn't exist, it's automatically created. It's 63 If the file doesn't exist, it's automatically created. It's updated on
63 updated on each commit copied, so convert-repo can be interrupted 64 each commit copied, so convert-repo can be interrupted and can be run
64 and can be run repeatedly to copy new commits. 65 repeatedly to copy new commits.
65 66
66 The [username mapping] file is a simple text file that maps each 67 The [username mapping] file is a simple text file that maps each source
67 source commit author to a destination commit author. It is handy 68 commit author to a destination commit author. It is handy for source SCMs
68 for source SCMs that use unix logins to identify authors (eg: 69 that use unix logins to identify authors (eg: CVS). One line per author
69 CVS). One line per author mapping and the line format is: 70 mapping and the line format is: srcauthor=whatever string you want
70 srcauthor=whatever string you want 71
71 72 The filemap is a file that allows filtering and remapping of files and
72 The filemap is a file that allows filtering and remapping of files 73 directories. Comment lines start with '#'. Each line can contain one of
73 and directories. Comment lines start with '#'. Each line can 74 the following directives:
74 contain one of the following directives:
75 75
76 include path/to/file 76 include path/to/file
77 77
78 exclude path/to/file 78 exclude path/to/file
79 79
80 rename from/file to/file 80 rename from/file to/file
81 81
82 The 'include' directive causes a file, or all files under a 82 The 'include' directive causes a file, or all files under a directory, to
83 directory, to be included in the destination repository, and the 83 be included in the destination repository, and the exclusion of all other
84 exclusion of all other files and directories not explicitly included. 84 files and directories not explicitly included. The 'exclude' directive
85 The 'exclude' directive causes files or directories to be omitted. 85 causes files or directories to be omitted. The 'rename' directive renames
86 The 'rename' directive renames a file or directory. To rename from 86 a file or directory. To rename from a subdirectory into the root of the
87 a subdirectory into the root of the repository, use '.' as the 87 repository, use '.' as the path to rename to.
88 path to rename to. 88
89 89 The splicemap is a file that allows insertion of synthetic history,
90 The splicemap is a file that allows insertion of synthetic 90 letting you specify the parents of a revision. This is useful if you want
91 history, letting you specify the parents of a revision. This is 91 to e.g. give a Subversion merge two parents, or graft two disconnected
92 useful if you want to e.g. give a Subversion merge two parents, or 92 series of history together. Each entry contains a key, followed by a
93 graft two disconnected series of history together. Each entry 93 space, followed by one or two comma-separated values. The key is the
94 contains a key, followed by a space, followed by one or two 94 revision ID in the source revision control system whose parents should be
95 comma-separated values. The key is the revision ID in the source 95 modified (same format as a key in .hg/shamap). The values are the revision
96 revision control system whose parents should be modified (same 96 IDs (in either the source or destination revision control system) that
97 format as a key in .hg/shamap). The values are the revision IDs
98 (in either the source or destination revision control system) that
99 should be used as the new parents for that node. 97 should be used as the new parents for that node.
100 98
101 The branchmap is a file that allows you to rename a branch when it is 99 The branchmap is a file that allows you to rename a branch when it is
102 being brought in from whatever external repository. When used in 100 being brought in from whatever external repository. When used in
103 conjunction with a splicemap, it allows for a powerful combination 101 conjunction with a splicemap, it allows for a powerful combination to help
104 to help fix even the most badly mismanaged repositories and turn them 102 fix even the most badly mismanaged repositories and turn them into nicely
105 into nicely structured Mercurial repositories. The branchmap contains 103 structured Mercurial repositories. The branchmap contains lines of the
106 lines of the form "original_branch_name new_branch_name". 104 form "original_branch_name new_branch_name". "original_branch_name" is the
107 "original_branch_name" is the name of the branch in the source 105 name of the branch in the source repository, and "new_branch_name" is the
108 repository, and "new_branch_name" is the name of the branch is the 106 name of the branch is the destination repository. This can be used to (for
109 destination repository. This can be used to (for instance) move code 107 instance) move code in one repository from "default" to a named branch.
110 in one repository from "default" to a named branch.
111 108
112 Mercurial Source 109 Mercurial Source
113 ----------------- 110 -----------------
114 111
115 --config convert.hg.ignoreerrors=False (boolean) 112 --config convert.hg.ignoreerrors=False (boolean)
116 ignore integrity errors when reading. Use it to fix Mercurial 113 ignore integrity errors when reading. Use it to fix Mercurial
117 repositories with missing revlogs, by converting from and to 114 repositories with missing revlogs, by converting from and to
118 Mercurial. 115 Mercurial.
119 --config convert.hg.saverev=False (boolean) 116 --config convert.hg.saverev=False (boolean)
120 store original revision ID in changeset (forces target IDs to 117 store original revision ID in changeset (forces target IDs to change)
121 change)
122 --config convert.hg.startrev=0 (hg revision identifier) 118 --config convert.hg.startrev=0 (hg revision identifier)
123 convert start revision and its descendants 119 convert start revision and its descendants
124 120
125 CVS Source 121 CVS Source
126 ---------- 122 ----------
127 123
128 CVS source will use a sandbox (i.e. a checked-out copy) from CVS 124 CVS source will use a sandbox (i.e. a checked-out copy) from CVS to
129 to indicate the starting point of what will be converted. Direct 125 indicate the starting point of what will be converted. Direct access to
130 access to the repository files is not needed, unless of course the 126 the repository files is not needed, unless of course the repository is
131 repository is :local:. The conversion uses the top level directory 127 :local:. The conversion uses the top level directory in the sandbox to
132 in the sandbox to find the CVS repository, and then uses CVS rlog 128 find the CVS repository, and then uses CVS rlog commands to find files to
133 commands to find files to convert. This means that unless a 129 convert. This means that unless a filemap is given, all files under the
134 filemap is given, all files under the starting directory will be 130 starting directory will be converted, and that any directory
135 converted, and that any directory reorganization in the CVS 131 reorganization in the CVS sandbox is ignored.
136 sandbox is ignored.
137 132
138 Because CVS does not have changesets, it is necessary to collect 133 Because CVS does not have changesets, it is necessary to collect
139 individual commits to CVS and merge them into changesets. CVS 134 individual commits to CVS and merge them into changesets. CVS source uses
140 source uses its internal changeset merging code by default but can 135 its internal changeset merging code by default but can be configured to
141 be configured to call the external 'cvsps' program by setting: 136 call the external 'cvsps' program by setting:
137
142 --config convert.cvsps='cvsps -A -u --cvs-direct -q' 138 --config convert.cvsps='cvsps -A -u --cvs-direct -q'
139
143 This option is deprecated and will be removed in Mercurial 1.4. 140 This option is deprecated and will be removed in Mercurial 1.4.
144 141
145 The options shown are the defaults. 142 The options shown are the defaults.
146 143
147 Internal cvsps is selected by setting 144 Internal cvsps is selected by setting
145
148 --config convert.cvsps=builtin 146 --config convert.cvsps=builtin
147
149 and has a few more configurable options: 148 and has a few more configurable options:
150 --config convert.cvsps.cache=True (boolean) 149 --config convert.cvsps.cache=True (boolean)
151 Set to False to disable remote log caching, for testing and 150 Set to False to disable remote log caching, for testing and
152 debugging purposes. 151 debugging purposes.
153 --config convert.cvsps.fuzz=60 (integer) 152 --config convert.cvsps.fuzz=60 (integer)
154 Specify the maximum time (in seconds) that is allowed 153 Specify the maximum time (in seconds) that is allowed between
155 between commits with identical user and log message in a 154 commits with identical user and log message in a single changeset.
156 single changeset. When very large files were checked in as 155 When very large files were checked in as part of a changeset then
157 part of a changeset then the default may not be long 156 the default may not be long enough.
158 enough.
159 --config convert.cvsps.mergeto='{{mergetobranch ([-\\w]+)}}' 157 --config convert.cvsps.mergeto='{{mergetobranch ([-\\w]+)}}'
160 Specify a regular expression to which commit log messages 158 Specify a regular expression to which commit log messages are
161 are matched. If a match occurs, then the conversion 159 matched. If a match occurs, then the conversion process will
162 process will insert a dummy revision merging the branch on 160 insert a dummy revision merging the branch on which this log
163 which this log message occurs to the branch indicated in 161 message occurs to the branch indicated in the regex.
164 the regex.
165 --config convert.cvsps.mergefrom='{{mergefrombranch ([-\\w]+)}}' 162 --config convert.cvsps.mergefrom='{{mergefrombranch ([-\\w]+)}}'
166 Specify a regular expression to which commit log messages 163 Specify a regular expression to which commit log messages are
167 are matched. If a match occurs, then the conversion 164 matched. If a match occurs, then the conversion process will add
168 process will add the most recent revision on the branch 165 the most recent revision on the branch indicated in the regex as
169 indicated in the regex as the second parent of the 166 the second parent of the changeset.
170 changeset. 167
171 168 The hgext/convert/cvsps wrapper script allows the builtin changeset
172 The hgext/convert/cvsps wrapper script allows the builtin 169 merging code to be run without doing a conversion. Its parameters and
173 changeset merging code to be run without doing a conversion. Its 170 output are similar to that of cvsps 2.1.
174 parameters and output are similar to that of cvsps 2.1.
175 171
176 Subversion Source 172 Subversion Source
177 ----------------- 173 -----------------
178 174
179 Subversion source detects classical trunk/branches/tags layouts. 175 Subversion source detects classical trunk/branches/tags layouts. By
180 By default, the supplied "svn://repo/path/" source URL is 176 default, the supplied "svn://repo/path/" source URL is converted as a
181 converted as a single branch. If "svn://repo/path/trunk" exists it 177 single branch. If "svn://repo/path/trunk" exists it replaces the default
182 replaces the default branch. If "svn://repo/path/branches" exists, 178 branch. If "svn://repo/path/branches" exists, its subdirectories are
183 its subdirectories are listed as possible branches. If 179 listed as possible branches. If "svn://repo/path/tags" exists, it is
184 "svn://repo/path/tags" exists, it is looked for tags referencing 180 looked for tags referencing converted branches. Default "trunk",
185 converted branches. Default "trunk", "branches" and "tags" values 181 "branches" and "tags" values can be overridden with following options. Set
186 can be overridden with following options. Set them to paths 182 them to paths relative to the source URL, or leave them blank to disable
187 relative to the source URL, or leave them blank to disable auto 183 auto detection.
188 detection.
189 184
190 --config convert.svn.branches=branches (directory name) 185 --config convert.svn.branches=branches (directory name)
191 specify the directory containing branches 186 specify the directory containing branches
192 --config convert.svn.tags=tags (directory name) 187 --config convert.svn.tags=tags (directory name)
193 specify the directory containing tags 188 specify the directory containing tags
194 --config convert.svn.trunk=trunk (directory name) 189 --config convert.svn.trunk=trunk (directory name)
195 specify the name of the trunk branch 190 specify the name of the trunk branch
196 191
197 Source history can be retrieved starting at a specific revision, 192 Source history can be retrieved starting at a specific revision, instead
198 instead of being integrally converted. Only single branch 193 of being integrally converted. Only single branch conversions are
199 conversions are supported. 194 supported.
200 195
201 --config convert.svn.startrev=0 (svn revision number) 196 --config convert.svn.startrev=0 (svn revision number)
202 specify start Subversion revision. 197 specify start Subversion revision.
203 198
204 Perforce Source 199 Perforce Source
205 --------------- 200 ---------------
206 201
207 The Perforce (P4) importer can be given a p4 depot path or a 202 The Perforce (P4) importer can be given a p4 depot path or a client
208 client specification as source. It will convert all files in the 203 specification as source. It will convert all files in the source to a flat
209 source to a flat Mercurial repository, ignoring labels, branches 204 Mercurial repository, ignoring labels, branches and integrations. Note
210 and integrations. Note that when a depot path is given you then 205 that when a depot path is given you then usually should specify a target
211 usually should specify a target directory, because otherwise the 206 directory, because otherwise the target may be named ...-hg.
212 target may be named ...-hg. 207
213 208 It is possible to limit the amount of source history to be converted by
214 It is possible to limit the amount of source history to be 209 specifying an initial Perforce revision.
215 converted by specifying an initial Perforce revision.
216 210
217 --config convert.p4.startrev=0 (perforce changelist number) 211 --config convert.p4.startrev=0 (perforce changelist number)
218 specify initial Perforce revision. 212 specify initial Perforce revision.
219 213
220 214
235 return subversion.debugsvnlog(ui, **opts) 229 return subversion.debugsvnlog(ui, **opts)
236 230
237 def debugcvsps(ui, *args, **opts): 231 def debugcvsps(ui, *args, **opts):
238 '''create changeset information from CVS 232 '''create changeset information from CVS
239 233
240 This command is intended as a debugging tool for the CVS to 234 This command is intended as a debugging tool for the CVS to Mercurial
241 Mercurial converter, and can be used as a direct replacement for 235 converter, and can be used as a direct replacement for cvsps.
242 cvsps. 236
243 237 Hg debugcvsps reads the CVS rlog for current directory (or any named
244 Hg debugcvsps reads the CVS rlog for current directory (or any 238 directory) in the CVS repository, and converts the log to a series of
245 named directory) in the CVS repository, and converts the log to a 239 changesets based on matching commit log entries and dates.
246 series of changesets based on matching commit log entries and 240 '''
247 dates.'''
248 return cvsps.debugcvsps(ui, *args, **opts) 241 return cvsps.debugcvsps(ui, *args, **opts)
249 242
250 commands.norepo += " convert debugsvnlog debugcvsps" 243 commands.norepo += " convert debugsvnlog debugcvsps"
251 244
252 cmdtable = { 245 cmdtable = {