Show More
@@ -1,470 +1,470 b'' | |||
|
1 | 1 | # convcmd - convert extension commands definition |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from common import NoRepo, MissingTool, SKIPREV, mapfile |
|
9 | 9 | from cvs import convert_cvs |
|
10 | 10 | from darcs import darcs_source |
|
11 | 11 | from git import convert_git |
|
12 | 12 | from hg import mercurial_source, mercurial_sink |
|
13 | 13 | from subversion import svn_source, svn_sink |
|
14 | 14 | from monotone import monotone_source |
|
15 | 15 | from gnuarch import gnuarch_source |
|
16 | 16 | from bzr import bzr_source |
|
17 | 17 | from p4 import p4_source |
|
18 | 18 | import filemap, common |
|
19 | 19 | |
|
20 | 20 | import os, shutil |
|
21 | 21 | from mercurial import hg, util, encoding |
|
22 | 22 | from mercurial.i18n import _ |
|
23 | 23 | |
|
24 | 24 | orig_encoding = 'ascii' |
|
25 | 25 | |
|
26 | 26 | def recode(s): |
|
27 | 27 | if isinstance(s, unicode): |
|
28 | 28 | return s.encode(orig_encoding, 'replace') |
|
29 | 29 | else: |
|
30 | 30 | return s.decode('utf-8').encode(orig_encoding, 'replace') |
|
31 | 31 | |
|
32 | 32 | source_converters = [ |
|
33 | 33 | ('cvs', convert_cvs, 'branchsort'), |
|
34 | 34 | ('git', convert_git, 'branchsort'), |
|
35 | 35 | ('svn', svn_source, 'branchsort'), |
|
36 | 36 | ('hg', mercurial_source, 'sourcesort'), |
|
37 | 37 | ('darcs', darcs_source, 'branchsort'), |
|
38 | 38 | ('mtn', monotone_source, 'branchsort'), |
|
39 | 39 | ('gnuarch', gnuarch_source, 'branchsort'), |
|
40 | 40 | ('bzr', bzr_source, 'branchsort'), |
|
41 | 41 | ('p4', p4_source, 'branchsort'), |
|
42 | 42 | ] |
|
43 | 43 | |
|
44 | 44 | sink_converters = [ |
|
45 | 45 | ('hg', mercurial_sink), |
|
46 | 46 | ('svn', svn_sink), |
|
47 | 47 | ] |
|
48 | 48 | |
|
49 | 49 | def convertsource(ui, path, type, rev): |
|
50 | 50 | exceptions = [] |
|
51 | 51 | if type and type not in [s[0] for s in source_converters]: |
|
52 | 52 | raise util.Abort(_('%s: invalid source repository type') % type) |
|
53 | 53 | for name, source, sortmode in source_converters: |
|
54 | 54 | try: |
|
55 | 55 | if not type or name == type: |
|
56 | 56 | return source(ui, path, rev), sortmode |
|
57 | 57 | except (NoRepo, MissingTool), inst: |
|
58 | 58 | exceptions.append(inst) |
|
59 | 59 | if not ui.quiet: |
|
60 | 60 | for inst in exceptions: |
|
61 | 61 | ui.write("%s\n" % inst) |
|
62 | 62 | raise util.Abort(_('%s: missing or unsupported repository') % path) |
|
63 | 63 | |
|
64 | 64 | def convertsink(ui, path, type): |
|
65 | 65 | if type and type not in [s[0] for s in sink_converters]: |
|
66 | 66 | raise util.Abort(_('%s: invalid destination repository type') % type) |
|
67 | 67 | for name, sink in sink_converters: |
|
68 | 68 | try: |
|
69 | 69 | if not type or name == type: |
|
70 | 70 | return sink(ui, path) |
|
71 | 71 | except NoRepo, inst: |
|
72 | 72 | ui.note(_("convert: %s\n") % inst) |
|
73 | 73 | except MissingTool, inst: |
|
74 | 74 | raise util.Abort('%s\n' % inst) |
|
75 | 75 | raise util.Abort(_('%s: unknown repository type') % path) |
|
76 | 76 | |
|
77 | 77 | class progresssource(object): |
|
78 | 78 | def __init__(self, ui, source, filecount): |
|
79 | 79 | self.ui = ui |
|
80 | 80 | self.source = source |
|
81 | 81 | self.filecount = filecount |
|
82 | 82 | self.retrieved = 0 |
|
83 | 83 | |
|
84 | 84 | def getfile(self, file, rev): |
|
85 | 85 | self.retrieved += 1 |
|
86 | 86 | self.ui.progress(_('getting files'), self.retrieved, |
|
87 | 87 | item=file, total=self.filecount) |
|
88 | 88 | return self.source.getfile(file, rev) |
|
89 | 89 | |
|
90 | 90 | def lookuprev(self, rev): |
|
91 | 91 | return self.source.lookuprev(rev) |
|
92 | 92 | |
|
93 | 93 | def close(self): |
|
94 | 94 | self.ui.progress(_('getting files'), None) |
|
95 | 95 | |
|
96 | 96 | class converter(object): |
|
97 | 97 | def __init__(self, ui, source, dest, revmapfile, opts): |
|
98 | 98 | |
|
99 | 99 | self.source = source |
|
100 | 100 | self.dest = dest |
|
101 | 101 | self.ui = ui |
|
102 | 102 | self.opts = opts |
|
103 | 103 | self.commitcache = {} |
|
104 | 104 | self.authors = {} |
|
105 | 105 | self.authorfile = None |
|
106 | 106 | |
|
107 | 107 | # Record converted revisions persistently: maps source revision |
|
108 | 108 | # ID to target revision ID (both strings). (This is how |
|
109 | 109 | # incremental conversions work.) |
|
110 | 110 | self.map = mapfile(ui, revmapfile) |
|
111 | 111 | |
|
112 | 112 | # Read first the dst author map if any |
|
113 | 113 | authorfile = self.dest.authorfile() |
|
114 | 114 | if authorfile and os.path.exists(authorfile): |
|
115 | 115 | self.readauthormap(authorfile) |
|
116 | 116 | # Extend/Override with new author map if necessary |
|
117 | 117 | if opts.get('authormap'): |
|
118 | 118 | self.readauthormap(opts.get('authormap')) |
|
119 | 119 | self.authorfile = self.dest.authorfile() |
|
120 | 120 | |
|
121 | 121 | self.splicemap = common.parsesplicemap(opts.get('splicemap')) |
|
122 | 122 | self.branchmap = mapfile(ui, opts.get('branchmap')) |
|
123 | 123 | |
|
124 | 124 | def walktree(self, heads): |
|
125 | 125 | '''Return a mapping that identifies the uncommitted parents of every |
|
126 | 126 | uncommitted changeset.''' |
|
127 | 127 | visit = heads |
|
128 | 128 | known = set() |
|
129 | 129 | parents = {} |
|
130 | 130 | while visit: |
|
131 | 131 | n = visit.pop(0) |
|
132 | 132 | if n in known or n in self.map: |
|
133 | 133 | continue |
|
134 | 134 | known.add(n) |
|
135 | 135 | self.ui.progress(_('scanning'), len(known), unit=_('revisions')) |
|
136 | 136 | commit = self.cachecommit(n) |
|
137 | 137 | parents[n] = [] |
|
138 | 138 | for p in commit.parents: |
|
139 | 139 | parents[n].append(p) |
|
140 | 140 | visit.append(p) |
|
141 | 141 | self.ui.progress(_('scanning'), None) |
|
142 | 142 | |
|
143 | 143 | return parents |
|
144 | 144 | |
|
145 | 145 | def mergesplicemap(self, parents, splicemap): |
|
146 | 146 | """A splicemap redefines child/parent relationships. Check the |
|
147 | 147 | map contains valid revision identifiers and merge the new |
|
148 | 148 | links in the source graph. |
|
149 | 149 | """ |
|
150 | 150 | for c in sorted(splicemap): |
|
151 | 151 | if c not in parents: |
|
152 | 152 | if not self.dest.hascommit(self.map.get(c, c)): |
|
153 | 153 | # Could be in source but not converted during this run |
|
154 | 154 | self.ui.warn(_('splice map revision %s is not being ' |
|
155 | 155 | 'converted, ignoring\n') % c) |
|
156 | 156 | continue |
|
157 | 157 | pc = [] |
|
158 | 158 | for p in splicemap[c]: |
|
159 | 159 | # We do not have to wait for nodes already in dest. |
|
160 | 160 | if self.dest.hascommit(self.map.get(p, p)): |
|
161 | 161 | continue |
|
162 | 162 | # Parent is not in dest and not being converted, not good |
|
163 | 163 | if p not in parents: |
|
164 | 164 | raise util.Abort(_('unknown splice map parent: %s') % p) |
|
165 | 165 | pc.append(p) |
|
166 | 166 | parents[c] = pc |
|
167 | 167 | |
|
168 | 168 | def toposort(self, parents, sortmode): |
|
169 | 169 | '''Return an ordering such that every uncommitted changeset is |
|
170 | 170 | preceded by all its uncommitted ancestors.''' |
|
171 | 171 | |
|
172 | 172 | def mapchildren(parents): |
|
173 | 173 | """Return a (children, roots) tuple where 'children' maps parent |
|
174 | 174 | revision identifiers to children ones, and 'roots' is the list of |
|
175 | 175 | revisions without parents. 'parents' must be a mapping of revision |
|
176 | 176 | identifier to its parents ones. |
|
177 | 177 | """ |
|
178 |
visit = parents |
|
|
178 | visit = sorted(parents) | |
|
179 | 179 | seen = set() |
|
180 | 180 | children = {} |
|
181 | 181 | roots = [] |
|
182 | 182 | |
|
183 | 183 | while visit: |
|
184 | 184 | n = visit.pop(0) |
|
185 | 185 | if n in seen: |
|
186 | 186 | continue |
|
187 | 187 | seen.add(n) |
|
188 | 188 | # Ensure that nodes without parents are present in the |
|
189 | 189 | # 'children' mapping. |
|
190 | 190 | children.setdefault(n, []) |
|
191 | 191 | hasparent = False |
|
192 | 192 | for p in parents[n]: |
|
193 | 193 | if p not in self.map: |
|
194 | 194 | visit.append(p) |
|
195 | 195 | hasparent = True |
|
196 | 196 | children.setdefault(p, []).append(n) |
|
197 | 197 | if not hasparent: |
|
198 | 198 | roots.append(n) |
|
199 | 199 | |
|
200 | 200 | return children, roots |
|
201 | 201 | |
|
202 | 202 | # Sort functions are supposed to take a list of revisions which |
|
203 | 203 | # can be converted immediately and pick one |
|
204 | 204 | |
|
205 | 205 | def makebranchsorter(): |
|
206 | 206 | """If the previously converted revision has a child in the |
|
207 | 207 | eligible revisions list, pick it. Return the list head |
|
208 | 208 | otherwise. Branch sort attempts to minimize branch |
|
209 | 209 | switching, which is harmful for Mercurial backend |
|
210 | 210 | compression. |
|
211 | 211 | """ |
|
212 | 212 | prev = [None] |
|
213 | 213 | def picknext(nodes): |
|
214 | 214 | next = nodes[0] |
|
215 | 215 | for n in nodes: |
|
216 | 216 | if prev[0] in parents[n]: |
|
217 | 217 | next = n |
|
218 | 218 | break |
|
219 | 219 | prev[0] = next |
|
220 | 220 | return next |
|
221 | 221 | return picknext |
|
222 | 222 | |
|
223 | 223 | def makesourcesorter(): |
|
224 | 224 | """Source specific sort.""" |
|
225 | 225 | keyfn = lambda n: self.commitcache[n].sortkey |
|
226 | 226 | def picknext(nodes): |
|
227 | 227 | return sorted(nodes, key=keyfn)[0] |
|
228 | 228 | return picknext |
|
229 | 229 | |
|
230 | 230 | def makedatesorter(): |
|
231 | 231 | """Sort revisions by date.""" |
|
232 | 232 | dates = {} |
|
233 | 233 | def getdate(n): |
|
234 | 234 | if n not in dates: |
|
235 | 235 | dates[n] = util.parsedate(self.commitcache[n].date) |
|
236 | 236 | return dates[n] |
|
237 | 237 | |
|
238 | 238 | def picknext(nodes): |
|
239 | 239 | return min([(getdate(n), n) for n in nodes])[1] |
|
240 | 240 | |
|
241 | 241 | return picknext |
|
242 | 242 | |
|
243 | 243 | if sortmode == 'branchsort': |
|
244 | 244 | picknext = makebranchsorter() |
|
245 | 245 | elif sortmode == 'datesort': |
|
246 | 246 | picknext = makedatesorter() |
|
247 | 247 | elif sortmode == 'sourcesort': |
|
248 | 248 | picknext = makesourcesorter() |
|
249 | 249 | else: |
|
250 | 250 | raise util.Abort(_('unknown sort mode: %s') % sortmode) |
|
251 | 251 | |
|
252 | 252 | children, actives = mapchildren(parents) |
|
253 | 253 | |
|
254 | 254 | s = [] |
|
255 | 255 | pendings = {} |
|
256 | 256 | while actives: |
|
257 | 257 | n = picknext(actives) |
|
258 | 258 | actives.remove(n) |
|
259 | 259 | s.append(n) |
|
260 | 260 | |
|
261 | 261 | # Update dependents list |
|
262 | 262 | for c in children.get(n, []): |
|
263 | 263 | if c not in pendings: |
|
264 | 264 | pendings[c] = [p for p in parents[c] if p not in self.map] |
|
265 | 265 | try: |
|
266 | 266 | pendings[c].remove(n) |
|
267 | 267 | except ValueError: |
|
268 | 268 | raise util.Abort(_('cycle detected between %s and %s') |
|
269 | 269 | % (recode(c), recode(n))) |
|
270 | 270 | if not pendings[c]: |
|
271 | 271 | # Parents are converted, node is eligible |
|
272 | 272 | actives.insert(0, c) |
|
273 | 273 | pendings[c] = None |
|
274 | 274 | |
|
275 | 275 | if len(s) != len(parents): |
|
276 | 276 | raise util.Abort(_("not all revisions were sorted")) |
|
277 | 277 | |
|
278 | 278 | return s |
|
279 | 279 | |
|
280 | 280 | def writeauthormap(self): |
|
281 | 281 | authorfile = self.authorfile |
|
282 | 282 | if authorfile: |
|
283 | 283 | self.ui.status(_('writing author map file %s\n') % authorfile) |
|
284 | 284 | ofile = open(authorfile, 'w+') |
|
285 | 285 | for author in self.authors: |
|
286 | 286 | ofile.write("%s=%s\n" % (author, self.authors[author])) |
|
287 | 287 | ofile.close() |
|
288 | 288 | |
|
289 | 289 | def readauthormap(self, authorfile): |
|
290 | 290 | afile = open(authorfile, 'r') |
|
291 | 291 | for line in afile: |
|
292 | 292 | |
|
293 | 293 | line = line.strip() |
|
294 | 294 | if not line or line.startswith('#'): |
|
295 | 295 | continue |
|
296 | 296 | |
|
297 | 297 | try: |
|
298 | 298 | srcauthor, dstauthor = line.split('=', 1) |
|
299 | 299 | except ValueError: |
|
300 | 300 | msg = _('ignoring bad line in author map file %s: %s\n') |
|
301 | 301 | self.ui.warn(msg % (authorfile, line.rstrip())) |
|
302 | 302 | continue |
|
303 | 303 | |
|
304 | 304 | srcauthor = srcauthor.strip() |
|
305 | 305 | dstauthor = dstauthor.strip() |
|
306 | 306 | if self.authors.get(srcauthor) in (None, dstauthor): |
|
307 | 307 | msg = _('mapping author %s to %s\n') |
|
308 | 308 | self.ui.debug(msg % (srcauthor, dstauthor)) |
|
309 | 309 | self.authors[srcauthor] = dstauthor |
|
310 | 310 | continue |
|
311 | 311 | |
|
312 | 312 | m = _('overriding mapping for author %s, was %s, will be %s\n') |
|
313 | 313 | self.ui.status(m % (srcauthor, self.authors[srcauthor], dstauthor)) |
|
314 | 314 | |
|
315 | 315 | afile.close() |
|
316 | 316 | |
|
317 | 317 | def cachecommit(self, rev): |
|
318 | 318 | commit = self.source.getcommit(rev) |
|
319 | 319 | commit.author = self.authors.get(commit.author, commit.author) |
|
320 | 320 | commit.branch = self.branchmap.get(commit.branch, commit.branch) |
|
321 | 321 | self.commitcache[rev] = commit |
|
322 | 322 | return commit |
|
323 | 323 | |
|
324 | 324 | def copy(self, rev): |
|
325 | 325 | commit = self.commitcache[rev] |
|
326 | 326 | |
|
327 | 327 | changes = self.source.getchanges(rev) |
|
328 | 328 | if isinstance(changes, basestring): |
|
329 | 329 | if changes == SKIPREV: |
|
330 | 330 | dest = SKIPREV |
|
331 | 331 | else: |
|
332 | 332 | dest = self.map[changes] |
|
333 | 333 | self.map[rev] = dest |
|
334 | 334 | return |
|
335 | 335 | files, copies = changes |
|
336 | 336 | pbranches = [] |
|
337 | 337 | if commit.parents: |
|
338 | 338 | for prev in commit.parents: |
|
339 | 339 | if prev not in self.commitcache: |
|
340 | 340 | self.cachecommit(prev) |
|
341 | 341 | pbranches.append((self.map[prev], |
|
342 | 342 | self.commitcache[prev].branch)) |
|
343 | 343 | self.dest.setbranch(commit.branch, pbranches) |
|
344 | 344 | try: |
|
345 | 345 | parents = self.splicemap[rev] |
|
346 | 346 | self.ui.status(_('spliced in %s as parents of %s\n') % |
|
347 | 347 | (parents, rev)) |
|
348 | 348 | parents = [self.map.get(p, p) for p in parents] |
|
349 | 349 | except KeyError: |
|
350 | 350 | parents = [b[0] for b in pbranches] |
|
351 | 351 | source = progresssource(self.ui, self.source, len(files)) |
|
352 | 352 | newnode = self.dest.putcommit(files, copies, parents, commit, |
|
353 | 353 | source, self.map) |
|
354 | 354 | source.close() |
|
355 | 355 | self.source.converted(rev, newnode) |
|
356 | 356 | self.map[rev] = newnode |
|
357 | 357 | |
|
358 | 358 | def convert(self, sortmode): |
|
359 | 359 | try: |
|
360 | 360 | self.source.before() |
|
361 | 361 | self.dest.before() |
|
362 | 362 | self.source.setrevmap(self.map) |
|
363 | 363 | self.ui.status(_("scanning source...\n")) |
|
364 | 364 | heads = self.source.getheads() |
|
365 | 365 | parents = self.walktree(heads) |
|
366 | 366 | self.mergesplicemap(parents, self.splicemap) |
|
367 | 367 | self.ui.status(_("sorting...\n")) |
|
368 | 368 | t = self.toposort(parents, sortmode) |
|
369 | 369 | num = len(t) |
|
370 | 370 | c = None |
|
371 | 371 | |
|
372 | 372 | self.ui.status(_("converting...\n")) |
|
373 | 373 | for i, c in enumerate(t): |
|
374 | 374 | num -= 1 |
|
375 | 375 | desc = self.commitcache[c].desc |
|
376 | 376 | if "\n" in desc: |
|
377 | 377 | desc = desc.splitlines()[0] |
|
378 | 378 | # convert log message to local encoding without using |
|
379 | 379 | # tolocal() because the encoding.encoding convert() |
|
380 | 380 | # uses is 'utf-8' |
|
381 | 381 | self.ui.status("%d %s\n" % (num, recode(desc))) |
|
382 | 382 | self.ui.note(_("source: %s\n") % recode(c)) |
|
383 | 383 | self.ui.progress(_('converting'), i, unit=_('revisions'), |
|
384 | 384 | total=len(t)) |
|
385 | 385 | self.copy(c) |
|
386 | 386 | self.ui.progress(_('converting'), None) |
|
387 | 387 | |
|
388 | 388 | tags = self.source.gettags() |
|
389 | 389 | ctags = {} |
|
390 | 390 | for k in tags: |
|
391 | 391 | v = tags[k] |
|
392 | 392 | if self.map.get(v, SKIPREV) != SKIPREV: |
|
393 | 393 | ctags[k] = self.map[v] |
|
394 | 394 | |
|
395 | 395 | if c and ctags: |
|
396 | 396 | nrev, tagsparent = self.dest.puttags(ctags) |
|
397 | 397 | if nrev and tagsparent: |
|
398 | 398 | # write another hash correspondence to override the previous |
|
399 | 399 | # one so we don't end up with extra tag heads |
|
400 | 400 | tagsparents = [e for e in self.map.iteritems() |
|
401 | 401 | if e[1] == tagsparent] |
|
402 | 402 | if tagsparents: |
|
403 | 403 | self.map[tagsparents[0][0]] = nrev |
|
404 | 404 | |
|
405 | 405 | bookmarks = self.source.getbookmarks() |
|
406 | 406 | cbookmarks = {} |
|
407 | 407 | for k in bookmarks: |
|
408 | 408 | v = bookmarks[k] |
|
409 | 409 | if self.map.get(v, SKIPREV) != SKIPREV: |
|
410 | 410 | cbookmarks[k] = self.map[v] |
|
411 | 411 | |
|
412 | 412 | if c and cbookmarks: |
|
413 | 413 | self.dest.putbookmarks(cbookmarks) |
|
414 | 414 | |
|
415 | 415 | self.writeauthormap() |
|
416 | 416 | finally: |
|
417 | 417 | self.cleanup() |
|
418 | 418 | |
|
419 | 419 | def cleanup(self): |
|
420 | 420 | try: |
|
421 | 421 | self.dest.after() |
|
422 | 422 | finally: |
|
423 | 423 | self.source.after() |
|
424 | 424 | self.map.close() |
|
425 | 425 | |
|
426 | 426 | def convert(ui, src, dest=None, revmapfile=None, **opts): |
|
427 | 427 | global orig_encoding |
|
428 | 428 | orig_encoding = encoding.encoding |
|
429 | 429 | encoding.encoding = 'UTF-8' |
|
430 | 430 | |
|
431 | 431 | # support --authors as an alias for --authormap |
|
432 | 432 | if not opts.get('authormap'): |
|
433 | 433 | opts['authormap'] = opts.get('authors') |
|
434 | 434 | |
|
435 | 435 | if not dest: |
|
436 | 436 | dest = hg.defaultdest(src) + "-hg" |
|
437 | 437 | ui.status(_("assuming destination %s\n") % dest) |
|
438 | 438 | |
|
439 | 439 | destc = convertsink(ui, dest, opts.get('dest_type')) |
|
440 | 440 | |
|
441 | 441 | try: |
|
442 | 442 | srcc, defaultsort = convertsource(ui, src, opts.get('source_type'), |
|
443 | 443 | opts.get('rev')) |
|
444 | 444 | except Exception: |
|
445 | 445 | for path in destc.created: |
|
446 | 446 | shutil.rmtree(path, True) |
|
447 | 447 | raise |
|
448 | 448 | |
|
449 | 449 | sortmodes = ('branchsort', 'datesort', 'sourcesort') |
|
450 | 450 | sortmode = [m for m in sortmodes if opts.get(m)] |
|
451 | 451 | if len(sortmode) > 1: |
|
452 | 452 | raise util.Abort(_('more than one sort mode specified')) |
|
453 | 453 | sortmode = sortmode and sortmode[0] or defaultsort |
|
454 | 454 | if sortmode == 'sourcesort' and not srcc.hasnativeorder(): |
|
455 | 455 | raise util.Abort(_('--sourcesort is not supported by this data source')) |
|
456 | 456 | |
|
457 | 457 | fmap = opts.get('filemap') |
|
458 | 458 | if fmap: |
|
459 | 459 | srcc = filemap.filemap_source(ui, srcc, fmap) |
|
460 | 460 | destc.setfilemapmode(True) |
|
461 | 461 | |
|
462 | 462 | if not revmapfile: |
|
463 | 463 | try: |
|
464 | 464 | revmapfile = destc.revmapfile() |
|
465 | 465 | except Exception: |
|
466 | 466 | revmapfile = os.path.join(destc, "map") |
|
467 | 467 | |
|
468 | 468 | c = converter(ui, srcc, destc, revmapfile, opts) |
|
469 | 469 | c.convert(sortmode) |
|
470 | 470 |
@@ -1,233 +1,233 b'' | |||
|
1 | 1 | Test config convert.cvsps.mergefrom config setting. |
|
2 | 2 | (Should test similar mergeto feature, but I don't understand it yet.) |
|
3 | 3 | Requires builtin cvsps. |
|
4 | 4 | |
|
5 | 5 | $ "$TESTDIR/hghave" cvs || exit 80 |
|
6 | 6 | $ CVSROOT=`pwd`/cvsrepo |
|
7 | 7 | $ export CVSROOT |
|
8 | 8 | |
|
9 | 9 | $ cvscall() |
|
10 | 10 | > { |
|
11 | 11 | > cvs -f "$@" |
|
12 | 12 | > } |
|
13 | 13 | |
|
14 | 14 | output of 'cvs ci' varies unpredictably, so just discard it |
|
15 | 15 | XXX copied from test-convert-cvs-synthetic |
|
16 | 16 | |
|
17 | 17 | $ cvsci() |
|
18 | 18 | > { |
|
19 | 19 | > sleep 1 |
|
20 | 20 | > cvs -f ci "$@" > /dev/null |
|
21 | 21 | > } |
|
22 | 22 | |
|
23 | 23 | XXX copied from test-convert-cvs-synthetic |
|
24 | 24 | |
|
25 | 25 | $ echo "[extensions]" >> $HGRCPATH |
|
26 | 26 | $ echo "convert = " >> $HGRCPATH |
|
27 | 27 | $ echo "graphlog = " >> $HGRCPATH |
|
28 | 28 | $ echo "[convert]" >> $HGRCPATH |
|
29 | 29 | $ echo "cvsps.cache=0" >> $HGRCPATH |
|
30 | 30 | $ echo "cvsps.mergefrom=\[MERGE from (\S+)\]" >> $HGRCPATH |
|
31 | 31 | |
|
32 | 32 | create cvs repository with one project |
|
33 | 33 | |
|
34 | 34 | $ mkdir cvsrepo |
|
35 | 35 | $ cvscall -q -d "$CVSROOT" init |
|
36 | 36 | $ mkdir cvsrepo/proj |
|
37 | 37 | |
|
38 | 38 | populate cvs repository |
|
39 | 39 | |
|
40 | 40 | $ cvscall -Q co proj |
|
41 | 41 | $ cd proj |
|
42 | 42 | $ touch file1 |
|
43 | 43 | $ cvscall -Q add file1 |
|
44 | 44 | $ cvsci -m"add file1 on trunk" |
|
45 | 45 | cvs commit: Examining . |
|
46 | 46 | |
|
47 | 47 | create two release branches |
|
48 | 48 | |
|
49 | 49 | $ cvscall -q tag -b v1_0 |
|
50 | 50 | T file1 |
|
51 | 51 | $ cvscall -q tag -b v1_1 |
|
52 | 52 | T file1 |
|
53 | 53 | |
|
54 | 54 | modify file1 on branch v1_0 |
|
55 | 55 | |
|
56 | 56 | $ cvscall -Q update -rv1_0 |
|
57 | 57 | $ sleep 1 |
|
58 | 58 | $ echo "change" >> file1 |
|
59 | 59 | $ cvsci -m"add text" |
|
60 | 60 | cvs commit: Examining . |
|
61 | 61 | |
|
62 | 62 | make unrelated change on v1_1 |
|
63 | 63 | |
|
64 | 64 | $ cvscall -Q update -rv1_1 |
|
65 | 65 | $ touch unrelated |
|
66 | 66 | $ cvscall -Q add unrelated |
|
67 | 67 | $ cvsci -m"unrelated change" |
|
68 | 68 | cvs commit: Examining . |
|
69 | 69 | |
|
70 | 70 | merge file1 to v1_1 |
|
71 | 71 | |
|
72 | 72 | $ cvscall -Q update -jv1_0 |
|
73 | 73 | RCS file: $TESTTMP/cvsrepo/proj/file1,v |
|
74 | 74 | retrieving revision 1.1 |
|
75 | 75 | retrieving revision 1.1.2.1 |
|
76 | 76 | Merging differences between 1.1 and 1.1.2.1 into file1 |
|
77 | 77 | $ cvsci -m"add text [MERGE from v1_0]" |
|
78 | 78 | cvs commit: Examining . |
|
79 | 79 | |
|
80 | 80 | merge change to trunk |
|
81 | 81 | |
|
82 | 82 | $ cvscall -Q update -A |
|
83 | 83 | $ cvscall -Q update -jv1_1 |
|
84 | 84 | RCS file: $TESTTMP/cvsrepo/proj/file1,v |
|
85 | 85 | retrieving revision 1.1 |
|
86 | 86 | retrieving revision 1.1.4.1 |
|
87 | 87 | Merging differences between 1.1 and 1.1.4.1 into file1 |
|
88 | 88 | $ cvsci -m"add text [MERGE from v1_1]" |
|
89 | 89 | cvs commit: Examining . |
|
90 | 90 | |
|
91 | 91 | non-merged change on trunk |
|
92 | 92 | |
|
93 | 93 | $ echo "foo" > file2 |
|
94 | 94 | $ cvscall -Q add file2 |
|
95 | 95 | $ cvsci -m"add file2 on trunk" file2 |
|
96 | 96 | |
|
97 | 97 | this will create rev 1.3 |
|
98 | 98 | change on trunk to backport |
|
99 | 99 | |
|
100 | 100 | $ echo "backport me" >> file1 |
|
101 | 101 | $ cvsci -m"add other text" file1 |
|
102 | 102 | $ cvscall log file1 |
|
103 | 103 | |
|
104 | 104 | RCS file: $TESTTMP/cvsrepo/proj/file1,v |
|
105 | 105 | Working file: file1 |
|
106 | 106 | head: 1.3 |
|
107 | 107 | branch: |
|
108 | 108 | locks: strict |
|
109 | 109 | access list: |
|
110 | 110 | symbolic names: |
|
111 | 111 | v1_1: 1.1.0.4 |
|
112 | 112 | v1_0: 1.1.0.2 |
|
113 | 113 | keyword substitution: kv |
|
114 | 114 | total revisions: 5; selected revisions: 5 |
|
115 | 115 | description: |
|
116 | 116 | ---------------------------- |
|
117 | 117 | revision 1.3 |
|
118 | 118 | date: * (glob) |
|
119 | 119 | add other text |
|
120 | 120 | ---------------------------- |
|
121 | 121 | revision 1.2 |
|
122 | 122 | date: * (glob) |
|
123 | 123 | add text [MERGE from v1_1] |
|
124 | 124 | ---------------------------- |
|
125 | 125 | revision 1.1 |
|
126 | 126 | date: * (glob) |
|
127 | 127 | branches: 1.1.2; 1.1.4; |
|
128 | 128 | add file1 on trunk |
|
129 | 129 | ---------------------------- |
|
130 | 130 | revision 1.1.4.1 |
|
131 | 131 | date: * (glob) |
|
132 | 132 | add text [MERGE from v1_0] |
|
133 | 133 | ---------------------------- |
|
134 | 134 | revision 1.1.2.1 |
|
135 | 135 | date: * (glob) |
|
136 | 136 | add text |
|
137 | 137 | ============================================================================= |
|
138 | 138 | |
|
139 | 139 | XXX how many ways are there to spell "trunk" with CVS? |
|
140 | 140 | backport trunk change to v1_1 |
|
141 | 141 | |
|
142 | 142 | $ cvscall -Q update -rv1_1 |
|
143 | 143 | $ cvscall -Q update -j1.2 -j1.3 file1 |
|
144 | 144 | RCS file: $TESTTMP/cvsrepo/proj/file1,v |
|
145 | 145 | retrieving revision 1.2 |
|
146 | 146 | retrieving revision 1.3 |
|
147 | 147 | Merging differences between 1.2 and 1.3 into file1 |
|
148 | 148 | $ cvsci -m"add other text [MERGE from HEAD]" file1 |
|
149 | 149 | |
|
150 | 150 | fix bug on v1_1, merge to trunk with error |
|
151 | 151 | |
|
152 | 152 | $ cvscall -Q update -rv1_1 |
|
153 | 153 | $ echo "merge forward" >> file1 |
|
154 | 154 | $ cvscall -Q tag unmerged |
|
155 | 155 | $ cvsci -m"fix file1" |
|
156 | 156 | cvs commit: Examining . |
|
157 | 157 | $ cvscall -Q update -A |
|
158 | 158 | $ cvscall -Q update -junmerged -jv1_1 |
|
159 | 159 | RCS file: $TESTTMP/cvsrepo/proj/file1,v |
|
160 | 160 | retrieving revision 1.1.4.2 |
|
161 | 161 | retrieving revision 1.1.4.3 |
|
162 | 162 | Merging differences between 1.1.4.2 and 1.1.4.3 into file1 |
|
163 | 163 | |
|
164 | 164 | note the typo in the commit log message |
|
165 | 165 | |
|
166 | 166 | $ cvsci -m"fix file1 [MERGE from v1-1]" |
|
167 | 167 | cvs commit: Examining . |
|
168 | 168 | $ cvs -Q tag -d unmerged |
|
169 | 169 | |
|
170 | 170 | convert to hg |
|
171 | 171 | |
|
172 | 172 | $ cd .. |
|
173 | 173 | $ hg convert proj proj.hg |
|
174 | 174 | initializing destination proj.hg repository |
|
175 | 175 | connecting to $TESTTMP/cvsrepo |
|
176 | 176 | scanning source... |
|
177 | 177 | collecting CVS rlog |
|
178 | 178 | 12 log entries |
|
179 | 179 | creating changesets |
|
180 | 180 | warning: CVS commit message references non-existent branch 'v1-1': |
|
181 | 181 | fix file1 [MERGE from v1-1] |
|
182 | 182 | 10 changeset entries |
|
183 | 183 | sorting... |
|
184 | 184 | converting... |
|
185 | 185 | 9 add file1 on trunk |
|
186 | 8 add text | |
|
187 | 7 unrelated change | |
|
186 | 8 unrelated change | |
|
187 | 7 add text | |
|
188 | 188 | 6 add text [MERGE from v1_0] |
|
189 | 189 | 5 add text [MERGE from v1_1] |
|
190 | 190 | 4 add file2 on trunk |
|
191 | 191 | 3 add other text |
|
192 | 192 | 2 add other text [MERGE from HEAD] |
|
193 | 193 | 1 fix file1 |
|
194 | 194 | 0 fix file1 [MERGE from v1-1] |
|
195 | 195 | |
|
196 | 196 | complete log |
|
197 | 197 | |
|
198 | 198 | $ template="{rev}: '{branches}' {desc}\n" |
|
199 | 199 | $ hg -R proj.hg log --template="$template" |
|
200 | 200 | 9: '' fix file1 [MERGE from v1-1] |
|
201 | 201 | 8: 'v1_1' fix file1 |
|
202 | 202 | 7: 'v1_1' add other text [MERGE from HEAD] |
|
203 | 203 | 6: '' add other text |
|
204 | 204 | 5: '' add file2 on trunk |
|
205 | 205 | 4: '' add text [MERGE from v1_1] |
|
206 | 206 | 3: 'v1_1' add text [MERGE from v1_0] |
|
207 | 2: 'v1_1' unrelated change | |
|
208 |
1: 'v1_ |
|
|
207 | 2: 'v1_0' add text | |
|
208 | 1: 'v1_1' unrelated change | |
|
209 | 209 | 0: '' add file1 on trunk |
|
210 | 210 | |
|
211 | 211 | graphical log |
|
212 | 212 | |
|
213 | 213 | $ hg -R proj.hg glog --template="$template" |
|
214 | 214 | o 9: '' fix file1 [MERGE from v1-1] |
|
215 | 215 | | |
|
216 | 216 | | o 8: 'v1_1' fix file1 |
|
217 | 217 | | | |
|
218 | 218 | | o 7: 'v1_1' add other text [MERGE from HEAD] |
|
219 | 219 | |/| |
|
220 | 220 | o | 6: '' add other text |
|
221 | 221 | | | |
|
222 | 222 | o | 5: '' add file2 on trunk |
|
223 | 223 | | | |
|
224 | 224 | o | 4: '' add text [MERGE from v1_1] |
|
225 | 225 | |\| |
|
226 | 226 | | o 3: 'v1_1' add text [MERGE from v1_0] |
|
227 | 227 | | |\ |
|
228 |
+---o 2: 'v1_ |
|
|
228 | +---o 2: 'v1_0' add text | |
|
229 | 229 | | | |
|
230 |
| o 1: 'v1_ |
|
|
230 | | o 1: 'v1_1' unrelated change | |
|
231 | 231 | |/ |
|
232 | 232 | o 0: '' add file1 on trunk |
|
233 | 233 |
@@ -1,468 +1,468 b'' | |||
|
1 | 1 | |
|
2 | 2 | $ "$TESTDIR/hghave" cvs || exit 80 |
|
3 | 3 | $ cvscall() |
|
4 | 4 | > { |
|
5 | 5 | > cvs -f "$@" |
|
6 | 6 | > } |
|
7 | 7 | $ hgcat() |
|
8 | 8 | > { |
|
9 | 9 | > hg --cwd src-hg cat -r tip "$1" |
|
10 | 10 | > } |
|
11 | 11 | $ echo "[extensions]" >> $HGRCPATH |
|
12 | 12 | $ echo "convert = " >> $HGRCPATH |
|
13 | 13 | $ echo "graphlog = " >> $HGRCPATH |
|
14 | 14 | $ cat > cvshooks.py <<EOF |
|
15 | 15 | > def cvslog(ui,repo,hooktype,log): |
|
16 | 16 | > print "%s hook: %d entries"%(hooktype,len(log)) |
|
17 | 17 | > |
|
18 | 18 | > def cvschangesets(ui,repo,hooktype,changesets): |
|
19 | 19 | > print "%s hook: %d changesets"%(hooktype,len(changesets)) |
|
20 | 20 | > EOF |
|
21 | 21 | $ hookpath=`pwd` |
|
22 | 22 | $ echo "[hooks]" >> $HGRCPATH |
|
23 | 23 | $ echo "cvslog=python:$hookpath/cvshooks.py:cvslog" >> $HGRCPATH |
|
24 | 24 | $ echo "cvschangesets=python:$hookpath/cvshooks.py:cvschangesets" >> $HGRCPATH |
|
25 | 25 | |
|
26 | 26 | create cvs repository |
|
27 | 27 | |
|
28 | 28 | $ mkdir cvsrepo |
|
29 | 29 | $ cd cvsrepo |
|
30 | 30 | $ CVSROOT=`pwd` |
|
31 | 31 | $ export CVSROOT |
|
32 | 32 | $ CVS_OPTIONS=-f |
|
33 | 33 | $ export CVS_OPTIONS |
|
34 | 34 | $ cd .. |
|
35 | 35 | $ cvscall -q -d "$CVSROOT" init |
|
36 | 36 | |
|
37 | 37 | create source directory |
|
38 | 38 | |
|
39 | 39 | $ mkdir src-temp |
|
40 | 40 | $ cd src-temp |
|
41 | 41 | $ echo a > a |
|
42 | 42 | $ mkdir b |
|
43 | 43 | $ cd b |
|
44 | 44 | $ echo c > c |
|
45 | 45 | $ cd .. |
|
46 | 46 | |
|
47 | 47 | import source directory |
|
48 | 48 | |
|
49 | 49 | $ cvscall -q import -m import src INITIAL start |
|
50 | 50 | N src/a |
|
51 | 51 | N src/b/c |
|
52 | 52 | |
|
53 | 53 | No conflicts created by this import |
|
54 | 54 | |
|
55 | 55 | $ cd .. |
|
56 | 56 | |
|
57 | 57 | checkout source directory |
|
58 | 58 | |
|
59 | 59 | $ cvscall -q checkout src |
|
60 | 60 | U src/a |
|
61 | 61 | U src/b/c |
|
62 | 62 | |
|
63 | 63 | commit a new revision changing b/c |
|
64 | 64 | |
|
65 | 65 | $ cd src |
|
66 | 66 | $ sleep 1 |
|
67 | 67 | $ echo c >> b/c |
|
68 | 68 | $ cvscall -q commit -mci0 . | grep '<--' |
|
69 | 69 | $TESTTMP/cvsrepo/src/b/c,v <-- *c (glob) |
|
70 | 70 | $ cd .. |
|
71 | 71 | |
|
72 | 72 | convert fresh repo and also check localtimezone option |
|
73 | 73 | |
|
74 | 74 | NOTE: This doesn't check all time zones -- it merely determines that |
|
75 | 75 | the configuration option is taking effect. |
|
76 | 76 | |
|
77 | 77 | An arbitrary (U.S.) time zone is used here. TZ=US/Hawaii is selected |
|
78 | 78 | since it does not use DST (unlike other U.S. time zones) and is always |
|
79 | 79 | a fixed difference from UTC. |
|
80 | 80 | |
|
81 | 81 | $ TZ=US/Hawaii hg convert --config convert.localtimezone=True src src-hg |
|
82 | 82 | initializing destination src-hg repository |
|
83 | 83 | connecting to $TESTTMP/cvsrepo |
|
84 | 84 | scanning source... |
|
85 | 85 | collecting CVS rlog |
|
86 | 86 | 5 log entries |
|
87 | 87 | cvslog hook: 5 entries |
|
88 | 88 | creating changesets |
|
89 | 89 | 3 changeset entries |
|
90 | 90 | cvschangesets hook: 3 changesets |
|
91 | 91 | sorting... |
|
92 | 92 | converting... |
|
93 | 93 | 2 Initial revision |
|
94 | 1 import | |
|
95 | 0 ci0 | |
|
94 | 1 ci0 | |
|
95 | 0 import | |
|
96 | 96 | updating tags |
|
97 | 97 | $ hgcat a |
|
98 | 98 | a |
|
99 | 99 | $ hgcat b/c |
|
100 | 100 | c |
|
101 | 101 | c |
|
102 | 102 | |
|
103 | 103 | convert fresh repo with --filemap |
|
104 | 104 | |
|
105 | 105 | $ echo include b/c > filemap |
|
106 | 106 | $ hg convert --filemap filemap src src-filemap |
|
107 | 107 | initializing destination src-filemap repository |
|
108 | 108 | connecting to $TESTTMP/cvsrepo |
|
109 | 109 | scanning source... |
|
110 | 110 | collecting CVS rlog |
|
111 | 111 | 5 log entries |
|
112 | 112 | cvslog hook: 5 entries |
|
113 | 113 | creating changesets |
|
114 | 114 | 3 changeset entries |
|
115 | 115 | cvschangesets hook: 3 changesets |
|
116 | 116 | sorting... |
|
117 | 117 | converting... |
|
118 | 118 | 2 Initial revision |
|
119 | 1 import | |
|
119 | 1 ci0 | |
|
120 | 0 import | |
|
120 | 121 | filtering out empty revision |
|
121 |
repository tip rolled back to revision |
|
|
122 | 0 ci0 | |
|
122 | repository tip rolled back to revision 1 (undo commit) | |
|
123 | 123 | updating tags |
|
124 | 124 | $ hgcat b/c |
|
125 | 125 | c |
|
126 | 126 | c |
|
127 | 127 | $ hg -R src-filemap log --template '{rev} {desc} files: {files}\n' |
|
128 | 128 | 2 update tags files: .hgtags |
|
129 | 129 | 1 ci0 files: b/c |
|
130 | 130 | 0 Initial revision files: b/c |
|
131 | 131 | |
|
132 | 132 | convert full repository (issue1649) |
|
133 | 133 | |
|
134 | 134 | $ cvscall -q -d "$CVSROOT" checkout -d srcfull "." | grep -v CVSROOT |
|
135 | 135 | U srcfull/src/a |
|
136 | 136 | U srcfull/src/b/c |
|
137 | 137 | $ ls srcfull |
|
138 | 138 | CVS |
|
139 | 139 | CVSROOT |
|
140 | 140 | src |
|
141 | 141 | $ hg convert srcfull srcfull-hg \ |
|
142 | 142 | > | grep -v 'log entries' | grep -v 'hook:' \ |
|
143 | 143 | > | grep -v '^[0-3] .*' # filter instable changeset order |
|
144 | 144 | initializing destination srcfull-hg repository |
|
145 | 145 | connecting to $TESTTMP/cvsrepo |
|
146 | 146 | scanning source... |
|
147 | 147 | collecting CVS rlog |
|
148 | 148 | creating changesets |
|
149 | 149 | 4 changeset entries |
|
150 | 150 | sorting... |
|
151 | 151 | converting... |
|
152 | 152 | updating tags |
|
153 | 153 | $ hg cat -r tip --cwd srcfull-hg src/a |
|
154 | 154 | a |
|
155 | 155 | $ hg cat -r tip --cwd srcfull-hg src/b/c |
|
156 | 156 | c |
|
157 | 157 | c |
|
158 | 158 | |
|
159 | 159 | commit new file revisions |
|
160 | 160 | |
|
161 | 161 | $ cd src |
|
162 | 162 | $ echo a >> a |
|
163 | 163 | $ echo c >> b/c |
|
164 | 164 | $ cvscall -q commit -mci1 . | grep '<--' |
|
165 | 165 | $TESTTMP/cvsrepo/src/a,v <-- a |
|
166 | 166 | $TESTTMP/cvsrepo/src/b/c,v <-- *c (glob) |
|
167 | 167 | $ cd .. |
|
168 | 168 | |
|
169 | 169 | convert again |
|
170 | 170 | |
|
171 | 171 | $ TZ=US/Hawaii hg convert --config convert.localtimezone=True src src-hg |
|
172 | 172 | connecting to $TESTTMP/cvsrepo |
|
173 | 173 | scanning source... |
|
174 | 174 | collecting CVS rlog |
|
175 | 175 | 7 log entries |
|
176 | 176 | cvslog hook: 7 entries |
|
177 | 177 | creating changesets |
|
178 | 178 | 4 changeset entries |
|
179 | 179 | cvschangesets hook: 4 changesets |
|
180 | 180 | sorting... |
|
181 | 181 | converting... |
|
182 | 182 | 0 ci1 |
|
183 | 183 | $ hgcat a |
|
184 | 184 | a |
|
185 | 185 | a |
|
186 | 186 | $ hgcat b/c |
|
187 | 187 | c |
|
188 | 188 | c |
|
189 | 189 | c |
|
190 | 190 | |
|
191 | 191 | convert again with --filemap |
|
192 | 192 | |
|
193 | 193 | $ hg convert --filemap filemap src src-filemap |
|
194 | 194 | connecting to $TESTTMP/cvsrepo |
|
195 | 195 | scanning source... |
|
196 | 196 | collecting CVS rlog |
|
197 | 197 | 7 log entries |
|
198 | 198 | cvslog hook: 7 entries |
|
199 | 199 | creating changesets |
|
200 | 200 | 4 changeset entries |
|
201 | 201 | cvschangesets hook: 4 changesets |
|
202 | 202 | sorting... |
|
203 | 203 | converting... |
|
204 | 204 | 0 ci1 |
|
205 | 205 | $ hgcat b/c |
|
206 | 206 | c |
|
207 | 207 | c |
|
208 | 208 | c |
|
209 | 209 | $ hg -R src-filemap log --template '{rev} {desc} files: {files}\n' |
|
210 | 210 | 3 ci1 files: b/c |
|
211 | 211 | 2 update tags files: .hgtags |
|
212 | 212 | 1 ci0 files: b/c |
|
213 | 213 | 0 Initial revision files: b/c |
|
214 | 214 | |
|
215 | 215 | commit branch |
|
216 | 216 | |
|
217 | 217 | $ cd src |
|
218 | 218 | $ cvs -q update -r1.1 b/c |
|
219 | 219 | U b/c |
|
220 | 220 | $ cvs -q tag -b branch |
|
221 | 221 | T a |
|
222 | 222 | T b/c |
|
223 | 223 | $ cvs -q update -r branch > /dev/null |
|
224 | 224 | $ echo d >> b/c |
|
225 | 225 | $ cvs -q commit -mci2 . | grep '<--' |
|
226 | 226 | $TESTTMP/cvsrepo/src/b/c,v <-- *c (glob) |
|
227 | 227 | $ cd .. |
|
228 | 228 | |
|
229 | 229 | convert again |
|
230 | 230 | |
|
231 | 231 | $ TZ=US/Hawaii hg convert --config convert.localtimezone=True src src-hg |
|
232 | 232 | connecting to $TESTTMP/cvsrepo |
|
233 | 233 | scanning source... |
|
234 | 234 | collecting CVS rlog |
|
235 | 235 | 8 log entries |
|
236 | 236 | cvslog hook: 8 entries |
|
237 | 237 | creating changesets |
|
238 | 238 | 5 changeset entries |
|
239 | 239 | cvschangesets hook: 5 changesets |
|
240 | 240 | sorting... |
|
241 | 241 | converting... |
|
242 | 242 | 0 ci2 |
|
243 | 243 | $ hgcat b/c |
|
244 | 244 | c |
|
245 | 245 | d |
|
246 | 246 | |
|
247 | 247 | convert again with --filemap |
|
248 | 248 | |
|
249 | 249 | $ TZ=US/Hawaii hg convert --config convert.localtimezone=True --filemap filemap src src-filemap |
|
250 | 250 | connecting to $TESTTMP/cvsrepo |
|
251 | 251 | scanning source... |
|
252 | 252 | collecting CVS rlog |
|
253 | 253 | 8 log entries |
|
254 | 254 | cvslog hook: 8 entries |
|
255 | 255 | creating changesets |
|
256 | 256 | 5 changeset entries |
|
257 | 257 | cvschangesets hook: 5 changesets |
|
258 | 258 | sorting... |
|
259 | 259 | converting... |
|
260 | 260 | 0 ci2 |
|
261 | 261 | $ hgcat b/c |
|
262 | 262 | c |
|
263 | 263 | d |
|
264 | 264 | $ hg -R src-filemap log --template '{rev} {desc} files: {files}\n' |
|
265 | 265 | 4 ci2 files: b/c |
|
266 | 266 | 3 ci1 files: b/c |
|
267 | 267 | 2 update tags files: .hgtags |
|
268 | 268 | 1 ci0 files: b/c |
|
269 | 269 | 0 Initial revision files: b/c |
|
270 | 270 | |
|
271 | 271 | commit a new revision with funny log message |
|
272 | 272 | |
|
273 | 273 | $ cd src |
|
274 | 274 | $ sleep 1 |
|
275 | 275 | $ echo e >> a |
|
276 | 276 | $ cvscall -q commit -m'funny |
|
277 | 277 | > ---------------------------- |
|
278 | 278 | > log message' . | grep '<--' |\ |
|
279 | 279 | > sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g' |
|
280 | 280 | checking in src/a,v |
|
281 | 281 | |
|
282 | 282 | commit new file revisions with some fuzz |
|
283 | 283 | |
|
284 | 284 | $ sleep 1 |
|
285 | 285 | $ echo f >> a |
|
286 | 286 | $ cvscall -q commit -mfuzzy . | grep '<--' |
|
287 | 287 | $TESTTMP/cvsrepo/src/a,v <-- a |
|
288 | 288 | $ sleep 4 # the two changes will be split if fuzz < 4 |
|
289 | 289 | $ echo g >> b/c |
|
290 | 290 | $ cvscall -q commit -mfuzzy . | grep '<--' |
|
291 | 291 | $TESTTMP/cvsrepo/src/b/c,v <-- *c (glob) |
|
292 | 292 | $ cd .. |
|
293 | 293 | |
|
294 | 294 | convert again |
|
295 | 295 | |
|
296 | 296 | $ TZ=US/Hawaii hg convert --config convert.cvsps.fuzz=2 --config convert.localtimezone=True src src-hg |
|
297 | 297 | connecting to $TESTTMP/cvsrepo |
|
298 | 298 | scanning source... |
|
299 | 299 | collecting CVS rlog |
|
300 | 300 | 11 log entries |
|
301 | 301 | cvslog hook: 11 entries |
|
302 | 302 | creating changesets |
|
303 | 303 | 8 changeset entries |
|
304 | 304 | cvschangesets hook: 8 changesets |
|
305 | 305 | sorting... |
|
306 | 306 | converting... |
|
307 | 307 | 2 funny |
|
308 | 308 | 1 fuzzy |
|
309 | 309 | 0 fuzzy |
|
310 | 310 | $ hg -R src-hg glog --template '{rev} ({branches}) {desc} date: {date|date} files: {files}\n' |
|
311 | 311 | o 8 (branch) fuzzy date: * -1000 files: b/c (glob) |
|
312 | 312 | | |
|
313 | 313 | o 7 (branch) fuzzy date: * -1000 files: a (glob) |
|
314 | 314 | | |
|
315 | 315 | o 6 (branch) funny |
|
316 | 316 | | ---------------------------- |
|
317 | 317 | | log message date: * -1000 files: a (glob) |
|
318 | 318 | o 5 (branch) ci2 date: * -1000 files: b/c (glob) |
|
319 | 319 | |
|
320 | 320 | o 4 () ci1 date: * -1000 files: a b/c (glob) |
|
321 | 321 | | |
|
322 | 322 | o 3 () update tags date: * +0000 files: .hgtags (glob) |
|
323 | 323 | | |
|
324 |
o 2 ( |
|
|
325 | | | |
|
326 |
|
|
|
324 | | o 2 (INITIAL) import date: * -1000 files: (glob) | |
|
325 | | | | |
|
326 | o | 1 () ci0 date: * -1000 files: b/c (glob) | |
|
327 | 327 | |/ |
|
328 | 328 | o 0 () Initial revision date: * -1000 files: a b/c (glob) |
|
329 | 329 | |
|
330 | 330 | |
|
331 | 331 | testing debugcvsps |
|
332 | 332 | |
|
333 | 333 | $ cd src |
|
334 | 334 | $ hg debugcvsps --fuzz=2 |
|
335 | 335 | collecting CVS rlog |
|
336 | 336 | 11 log entries |
|
337 | 337 | cvslog hook: 11 entries |
|
338 | 338 | creating changesets |
|
339 | 339 | 10 changeset entries |
|
340 | 340 | cvschangesets hook: 10 changesets |
|
341 | 341 | --------------------- |
|
342 | 342 | PatchSet 1 |
|
343 | 343 | Date: * (glob) |
|
344 | 344 | Author: * (glob) |
|
345 | 345 | Branch: HEAD |
|
346 | 346 | Tag: (none) |
|
347 | 347 | Branchpoints: INITIAL |
|
348 | 348 | Log: |
|
349 | 349 | Initial revision |
|
350 | 350 | |
|
351 | 351 | Members: |
|
352 | 352 | a:INITIAL->1.1 |
|
353 | 353 | |
|
354 | 354 | --------------------- |
|
355 | 355 | PatchSet 2 |
|
356 | 356 | Date: * (glob) |
|
357 | 357 | Author: * (glob) |
|
358 | 358 | Branch: HEAD |
|
359 | 359 | Tag: (none) |
|
360 | 360 | Branchpoints: INITIAL, branch |
|
361 | 361 | Log: |
|
362 | 362 | Initial revision |
|
363 | 363 | |
|
364 | 364 | Members: |
|
365 | 365 | b/c:INITIAL->1.1 |
|
366 | 366 | |
|
367 | 367 | --------------------- |
|
368 | 368 | PatchSet 3 |
|
369 | 369 | Date: * (glob) |
|
370 | 370 | Author: * (glob) |
|
371 | 371 | Branch: INITIAL |
|
372 | 372 | Tag: start |
|
373 | 373 | Log: |
|
374 | 374 | import |
|
375 | 375 | |
|
376 | 376 | Members: |
|
377 | 377 | a:1.1->1.1.1.1 |
|
378 | 378 | b/c:1.1->1.1.1.1 |
|
379 | 379 | |
|
380 | 380 | --------------------- |
|
381 | 381 | PatchSet 4 |
|
382 | 382 | Date: * (glob) |
|
383 | 383 | Author: * (glob) |
|
384 | 384 | Branch: HEAD |
|
385 | 385 | Tag: (none) |
|
386 | 386 | Log: |
|
387 | 387 | ci0 |
|
388 | 388 | |
|
389 | 389 | Members: |
|
390 | 390 | b/c:1.1->1.2 |
|
391 | 391 | |
|
392 | 392 | --------------------- |
|
393 | 393 | PatchSet 5 |
|
394 | 394 | Date: * (glob) |
|
395 | 395 | Author: * (glob) |
|
396 | 396 | Branch: HEAD |
|
397 | 397 | Tag: (none) |
|
398 | 398 | Log: |
|
399 | 399 | ci1 |
|
400 | 400 | |
|
401 | 401 | Members: |
|
402 | 402 | b/c:1.2->1.3 |
|
403 | 403 | |
|
404 | 404 | --------------------- |
|
405 | 405 | PatchSet 6 |
|
406 | 406 | Date: * (glob) |
|
407 | 407 | Author: * (glob) |
|
408 | 408 | Branch: HEAD |
|
409 | 409 | Tag: (none) |
|
410 | 410 | Branchpoints: branch |
|
411 | 411 | Log: |
|
412 | 412 | ci1 |
|
413 | 413 | |
|
414 | 414 | Members: |
|
415 | 415 | a:1.1->1.2 |
|
416 | 416 | |
|
417 | 417 | --------------------- |
|
418 | 418 | PatchSet 7 |
|
419 | 419 | Date: * (glob) |
|
420 | 420 | Author: * (glob) |
|
421 | 421 | Branch: branch |
|
422 | 422 | Tag: (none) |
|
423 | 423 | Log: |
|
424 | 424 | ci2 |
|
425 | 425 | |
|
426 | 426 | Members: |
|
427 | 427 | b/c:1.1->1.1.2.1 |
|
428 | 428 | |
|
429 | 429 | --------------------- |
|
430 | 430 | PatchSet 8 |
|
431 | 431 | Date: * (glob) |
|
432 | 432 | Author: * (glob) |
|
433 | 433 | Branch: branch |
|
434 | 434 | Tag: (none) |
|
435 | 435 | Log: |
|
436 | 436 | funny |
|
437 | 437 | ---------------------------- |
|
438 | 438 | log message |
|
439 | 439 | |
|
440 | 440 | Members: |
|
441 | 441 | a:1.2->1.2.2.1 |
|
442 | 442 | |
|
443 | 443 | --------------------- |
|
444 | 444 | PatchSet 9 |
|
445 | 445 | Date: * (glob) |
|
446 | 446 | Author: * (glob) |
|
447 | 447 | Branch: branch |
|
448 | 448 | Tag: (none) |
|
449 | 449 | Log: |
|
450 | 450 | fuzzy |
|
451 | 451 | |
|
452 | 452 | Members: |
|
453 | 453 | a:1.2.2.1->1.2.2.2 |
|
454 | 454 | |
|
455 | 455 | --------------------- |
|
456 | 456 | PatchSet 10 |
|
457 | 457 | Date: * (glob) |
|
458 | 458 | Author: * (glob) |
|
459 | 459 | Branch: branch |
|
460 | 460 | Tag: (none) |
|
461 | 461 | Log: |
|
462 | 462 | fuzzy |
|
463 | 463 | |
|
464 | 464 | Members: |
|
465 | 465 | b/c:1.1.2.1->1.1.2.2 |
|
466 | 466 | |
|
467 | 467 | |
|
468 | 468 | $ cd .. |
@@ -1,249 +1,249 b'' | |||
|
1 | 1 | |
|
2 | 2 | $ "$TESTDIR/hghave" svn svn-bindings || exit 80 |
|
3 | 3 | |
|
4 | 4 | $ cat >> $HGRCPATH <<EOF |
|
5 | 5 | > [extensions] |
|
6 | 6 | > convert = |
|
7 | 7 | > graphlog = |
|
8 | 8 | > EOF |
|
9 | 9 | |
|
10 | 10 | $ svnadmin create svn-repo |
|
11 | 11 | $ svnadmin load -q svn-repo < "$TESTDIR/svn/move.svndump" |
|
12 | 12 | $ SVNREPOPATH=`pwd`/svn-repo |
|
13 | 13 | #if windows |
|
14 | 14 | $ SVNREPOURL=file:///`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"` |
|
15 | 15 | #else |
|
16 | 16 | $ SVNREPOURL=file://`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"` |
|
17 | 17 | #endif |
|
18 | 18 | |
|
19 | 19 | Convert trunk and branches |
|
20 | 20 | |
|
21 | 21 | $ hg convert --datesort "$SVNREPOURL"/subproject A-hg |
|
22 | 22 | initializing destination A-hg repository |
|
23 | 23 | scanning source... |
|
24 | 24 | sorting... |
|
25 | 25 | converting... |
|
26 | 26 | 13 createtrunk |
|
27 | 27 | 12 moved1 |
|
28 | 28 | 11 moved1 |
|
29 | 29 | 10 moved2 |
|
30 | 30 | 9 changeb and rm d2 |
|
31 | 31 | 8 changeb and rm d2 |
|
32 | 32 | 7 moved1again |
|
33 | 33 | 6 moved1again |
|
34 | 34 | 5 copyfilefrompast |
|
35 | 35 | 4 copydirfrompast |
|
36 | 36 | 3 add d3 |
|
37 | 37 | 2 copy dir and remove subdir |
|
38 | 38 | 1 add d4old |
|
39 | 39 | 0 rename d4old into d4new |
|
40 | 40 | |
|
41 | 41 | $ cd A-hg |
|
42 | 42 | $ hg glog --template '{rev} {desc|firstline} files: {files}\n' |
|
43 | 43 | o 13 rename d4old into d4new files: d4new/g d4old/g |
|
44 | 44 | | |
|
45 | 45 | o 12 add d4old files: d4old/g |
|
46 | 46 | | |
|
47 | 47 | o 11 copy dir and remove subdir files: d3/d31/e d4/d31/e d4/f |
|
48 | 48 | | |
|
49 | 49 | o 10 add d3 files: d3/d31/e d3/f |
|
50 | 50 | | |
|
51 | 51 | o 9 copydirfrompast files: d2/d |
|
52 | 52 | | |
|
53 | 53 | o 8 copyfilefrompast files: d |
|
54 | 54 | | |
|
55 | 55 | o 7 moved1again files: d1/b d1/c |
|
56 | 56 | | |
|
57 | 57 | | o 6 moved1again files: |
|
58 | 58 | | | |
|
59 | 59 | o | 5 changeb and rm d2 files: d1/b d2/d |
|
60 | 60 | | | |
|
61 | 61 | | o 4 changeb and rm d2 files: b |
|
62 | 62 | | | |
|
63 | 63 | o | 3 moved2 files: d2/d |
|
64 | 64 | | | |
|
65 | 65 | o | 2 moved1 files: d1/b d1/c |
|
66 | 66 | | | |
|
67 | 67 | | o 1 moved1 files: b c |
|
68 | 68 | | |
|
69 | 69 | o 0 createtrunk files: |
|
70 | 70 | |
|
71 | 71 | |
|
72 | 72 | Check move copy records |
|
73 | 73 | |
|
74 | 74 | $ hg st --rev 12:13 --copies |
|
75 | 75 | A d4new/g |
|
76 | 76 | d4old/g |
|
77 | 77 | R d4old/g |
|
78 | 78 | |
|
79 | 79 | Check branches |
|
80 | 80 | |
|
81 | 81 | $ hg branches |
|
82 | 82 | default 13:* (glob) |
|
83 | 83 | d1 6:* (glob) |
|
84 | 84 | $ cd .. |
|
85 | 85 | |
|
86 | 86 | $ mkdir test-replace |
|
87 | 87 | $ cd test-replace |
|
88 | 88 | $ svnadmin create svn-repo |
|
89 | 89 | $ svnadmin load -q svn-repo < "$TESTDIR/svn/replace.svndump" |
|
90 | 90 | |
|
91 | 91 | Convert files being replaced by directories |
|
92 | 92 | |
|
93 | 93 | $ hg convert svn-repo hg-repo |
|
94 | 94 | initializing destination hg-repo repository |
|
95 | 95 | scanning source... |
|
96 | 96 | sorting... |
|
97 | 97 | converting... |
|
98 | 98 | 6 initial |
|
99 | 99 | 5 clobber symlink |
|
100 | 100 | 4 clobber1 |
|
101 | 101 | 3 clobber2 |
|
102 | 102 | 2 adddb |
|
103 | 1 branch | |
|
104 | 0 clobberdir | |
|
103 | 1 clobberdir | |
|
104 | 0 branch | |
|
105 | 105 | |
|
106 | 106 | $ cd hg-repo |
|
107 | 107 | |
|
108 | 108 | Manifest before |
|
109 | 109 | |
|
110 | 110 | $ hg -v manifest -r 1 |
|
111 | 111 | 644 a |
|
112 | 112 | 644 d/b |
|
113 | 113 | 644 d2/a |
|
114 | 114 | 644 @ dlink |
|
115 | 115 | 644 @ dlink2 |
|
116 | 116 | 644 dlink3 |
|
117 | 117 | |
|
118 | 118 | Manifest after clobber1 |
|
119 | 119 | |
|
120 | 120 | $ hg -v manifest -r 2 |
|
121 | 121 | 644 a/b |
|
122 | 122 | 644 d/b |
|
123 | 123 | 644 d2/a |
|
124 | 124 | 644 dlink/b |
|
125 | 125 | 644 @ dlink2 |
|
126 | 126 | 644 dlink3 |
|
127 | 127 | |
|
128 | 128 | Manifest after clobber2 |
|
129 | 129 | |
|
130 | 130 | $ hg -v manifest -r 3 |
|
131 | 131 | 644 a/b |
|
132 | 132 | 644 d/b |
|
133 | 133 | 644 d2/a |
|
134 | 134 | 644 dlink/b |
|
135 | 135 | 644 @ dlink2 |
|
136 | 136 | 644 @ dlink3 |
|
137 | 137 | |
|
138 | 138 | Manifest after clobberdir |
|
139 | 139 | |
|
140 | 140 | $ hg -v manifest -r 6 |
|
141 | 141 | 644 a/b |
|
142 | 142 | 644 d/b |
|
143 | 143 | 644 d2/a |
|
144 | 144 | 644 d2/c |
|
145 | 145 | 644 dlink/b |
|
146 | 146 | 644 @ dlink2 |
|
147 | 147 | 644 @ dlink3 |
|
148 | 148 | |
|
149 | 149 | Try updating |
|
150 | 150 | |
|
151 | 151 | $ hg up -qC default |
|
152 | 152 | $ cd .. |
|
153 | 153 | |
|
154 | 154 | Test convert progress bar' |
|
155 | 155 | |
|
156 | 156 | $ cat >> $HGRCPATH <<EOF |
|
157 | 157 | > [extensions] |
|
158 | 158 | > progress = |
|
159 | 159 | > [progress] |
|
160 | 160 | > assume-tty = 1 |
|
161 | 161 | > delay = 0 |
|
162 | 162 | > changedelay = 0 |
|
163 | 163 | > format = topic bar number |
|
164 | 164 | > refresh = 0 |
|
165 | 165 | > width = 60 |
|
166 | 166 | > EOF |
|
167 | 167 | |
|
168 | 168 | $ hg convert svn-repo hg-progress |
|
169 | 169 | \r (no-eol) (esc) |
|
170 | 170 | scanning [ <=> ] 1\r (no-eol) (esc) |
|
171 | 171 | scanning [ <=> ] 2\r (no-eol) (esc) |
|
172 | 172 | scanning [ <=> ] 3\r (no-eol) (esc) |
|
173 | 173 | scanning [ <=> ] 4\r (no-eol) (esc) |
|
174 | 174 | scanning [ <=> ] 5\r (no-eol) (esc) |
|
175 | 175 | scanning [ <=> ] 6\r (no-eol) (esc) |
|
176 | 176 | scanning [ <=> ] 7\r (no-eol) (esc) |
|
177 | 177 | \r (no-eol) (esc) |
|
178 | 178 | \r (no-eol) (esc) |
|
179 | 179 | converting [ ] 0/7\r (no-eol) (esc) |
|
180 | 180 | getting files [=====> ] 1/6\r (no-eol) (esc) |
|
181 | 181 | getting files [============> ] 2/6\r (no-eol) (esc) |
|
182 | 182 | getting files [==================> ] 3/6\r (no-eol) (esc) |
|
183 | 183 | getting files [=========================> ] 4/6\r (no-eol) (esc) |
|
184 | 184 | getting files [===============================> ] 5/6\r (no-eol) (esc) |
|
185 | 185 | getting files [======================================>] 6/6\r (no-eol) (esc) |
|
186 | 186 | \r (no-eol) (esc) |
|
187 | 187 | \r (no-eol) (esc) |
|
188 | 188 | converting [=====> ] 1/7\r (no-eol) (esc) |
|
189 | 189 | scanning paths [ ] 0/1\r (no-eol) (esc) |
|
190 | 190 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
191 | 191 | \r (no-eol) (esc) |
|
192 | 192 | \r (no-eol) (esc) |
|
193 | 193 | converting [===========> ] 2/7\r (no-eol) (esc) |
|
194 | 194 | scanning paths [ ] 0/2\r (no-eol) (esc) |
|
195 | 195 | scanning paths [==================> ] 1/2\r (no-eol) (esc) |
|
196 | 196 | getting files [========> ] 1/4\r (no-eol) (esc) |
|
197 | 197 | getting files [==================> ] 2/4\r (no-eol) (esc) |
|
198 | 198 | getting files [============================> ] 3/4\r (no-eol) (esc) |
|
199 | 199 | getting files [======================================>] 4/4\r (no-eol) (esc) |
|
200 | 200 | \r (no-eol) (esc) |
|
201 | 201 | \r (no-eol) (esc) |
|
202 | 202 | converting [=================> ] 3/7\r (no-eol) (esc) |
|
203 | 203 | scanning paths [ ] 0/1\r (no-eol) (esc) |
|
204 | 204 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
205 | 205 | \r (no-eol) (esc) |
|
206 | 206 | \r (no-eol) (esc) |
|
207 | 207 | converting [=======================> ] 4/7\r (no-eol) (esc) |
|
208 | 208 | scanning paths [ ] 0/1\r (no-eol) (esc) |
|
209 | 209 | getting files [======================================>] 1/1\r (no-eol) (esc) |
|
210 | 210 | \r (no-eol) (esc) |
|
211 | 211 | \r (no-eol) (esc) |
|
212 | 212 | converting [=============================> ] 5/7\r (no-eol) (esc) |
|
213 |
scanning paths [ ] 0/ |
|
|
214 | scanning paths [===========> ] 1/3\r (no-eol) (esc) | |
|
215 | scanning paths [========================> ] 2/3\r (no-eol) (esc) | |
|
213 | scanning paths [ ] 0/1\r (no-eol) (esc) | |
|
216 | 214 | getting files [===> ] 1/8\r (no-eol) (esc) |
|
217 | 215 | getting files [========> ] 2/8\r (no-eol) (esc) |
|
218 | 216 | getting files [=============> ] 3/8\r (no-eol) (esc) |
|
219 | 217 | getting files [==================> ] 4/8\r (no-eol) (esc) |
|
220 | 218 | getting files [=======================> ] 5/8\r (no-eol) (esc) |
|
221 | 219 | getting files [============================> ] 6/8\r (no-eol) (esc) |
|
222 | 220 | getting files [=================================> ] 7/8\r (no-eol) (esc) |
|
223 | 221 | getting files [======================================>] 8/8\r (no-eol) (esc) |
|
224 | 222 | \r (no-eol) (esc) |
|
225 | 223 | \r (no-eol) (esc) |
|
226 | 224 | converting [===================================> ] 6/7\r (no-eol) (esc) |
|
227 |
scanning paths [ ] 0/ |
|
|
225 | scanning paths [ ] 0/3\r (no-eol) (esc) | |
|
226 | scanning paths [===========> ] 1/3\r (no-eol) (esc) | |
|
227 | scanning paths [========================> ] 2/3\r (no-eol) (esc) | |
|
228 | 228 | getting files [===> ] 1/8\r (no-eol) (esc) |
|
229 | 229 | getting files [========> ] 2/8\r (no-eol) (esc) |
|
230 | 230 | getting files [=============> ] 3/8\r (no-eol) (esc) |
|
231 | 231 | getting files [==================> ] 4/8\r (no-eol) (esc) |
|
232 | 232 | getting files [=======================> ] 5/8\r (no-eol) (esc) |
|
233 | 233 | getting files [============================> ] 6/8\r (no-eol) (esc) |
|
234 | 234 | getting files [=================================> ] 7/8\r (no-eol) (esc) |
|
235 | 235 | getting files [======================================>] 8/8\r (no-eol) (esc) |
|
236 | 236 | \r (no-eol) (esc) |
|
237 | 237 | initializing destination hg-progress repository |
|
238 | 238 | scanning source... |
|
239 | 239 | sorting... |
|
240 | 240 | converting... |
|
241 | 241 | 6 initial |
|
242 | 242 | 5 clobber symlink |
|
243 | 243 | 4 clobber1 |
|
244 | 244 | 3 clobber2 |
|
245 | 245 | 2 adddb |
|
246 | 1 branch | |
|
247 | 0 clobberdir | |
|
246 | 1 clobberdir | |
|
247 | 0 branch | |
|
248 | 248 | |
|
249 | 249 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now