Show More
@@ -18,7 +18,7 b' def listsort(list, key):' | |||
|
18 | 18 | try: |
|
19 | 19 | list.sort(key=key) |
|
20 | 20 | except TypeError: |
|
21 | list.sort(lambda l, r:cmp(key(l), key(r))) | |
|
21 | list.sort(lambda l, r: cmp(key(l), key(r))) | |
|
22 | 22 | |
|
23 | 23 | class logentry(object): |
|
24 | 24 | '''Class logentry has the following attributes: |
@@ -78,13 +78,13 b' def createlog(ui, directory=None, root="' | |||
|
78 | 78 | try: |
|
79 | 79 | prefix = file(os.path.join('CVS','Repository')).read().strip() |
|
80 | 80 | if prefix == ".": |
|
81 | prefix="" | |
|
81 | prefix = "" | |
|
82 | 82 | directory = prefix |
|
83 | 83 | except IOError: |
|
84 | 84 | raise logerror('Not a CVS sandbox') |
|
85 | 85 | |
|
86 | 86 | if prefix and not prefix.endswith('/'): |
|
87 | prefix+='/' | |
|
87 | prefix += '/' | |
|
88 | 88 | |
|
89 | 89 | # Use the Root file in the sandbox, if it exists |
|
90 | 90 | try: |
@@ -113,9 +113,10 b' def createlog(ui, directory=None, root="' | |||
|
113 | 113 | # and |
|
114 | 114 | # /pserver/user/server/path |
|
115 | 115 | # are mapped to different cache file names. |
|
116 | cachefile = root.split(":")+[directory, "cache"] | |
|
116 | cachefile = root.split(":") + [directory, "cache"] | |
|
117 | 117 | cachefile = ['-'.join(re.findall(r'\w+', s)) for s in cachefile if s] |
|
118 |
cachefile = os.path.join(cachedir, |
|
|
118 | cachefile = os.path.join(cachedir, | |
|
119 | '.'.join([s for s in cachefile if s])) | |
|
119 | 120 | |
|
120 | 121 | if cache == 'update': |
|
121 | 122 | try: |
@@ -135,8 +136,8 b' def createlog(ui, directory=None, root="' | |||
|
135 | 136 | cmd.append('-d%s' % root) |
|
136 | 137 | p = root.split(':')[-1] |
|
137 | 138 | if not p.endswith('/'): |
|
138 | p+='/' | |
|
139 | prefix = p+prefix | |
|
139 | p += '/' | |
|
140 | prefix = p + prefix | |
|
140 | 141 | cmd.append(['log', 'rlog'][rlog]) |
|
141 | 142 | if date: |
|
142 | 143 | # no space between option and date string |
@@ -206,8 +207,8 b' def createlog(ui, directory=None, root="' | |||
|
206 | 207 | |
|
207 | 208 | # Convert magic branch number to an odd-numbered one |
|
208 | 209 | revn = len(rev) |
|
209 | if revn>3 and (revn%2) == 0 and rev[-2] == 0: | |
|
210 | rev = rev[:-2]+rev[-1:] | |
|
210 | if revn > 3 and (revn % 2) == 0 and rev[-2] == 0: | |
|
211 | rev = rev[:-2] + rev[-1:] | |
|
211 | 212 | rev = tuple(rev) |
|
212 | 213 | |
|
213 | 214 | if rev not in tags: |
@@ -244,11 +245,11 b' def createlog(ui, directory=None, root="' | |||
|
244 | 245 | d = match.group(1) |
|
245 | 246 | if d[2] == '/': |
|
246 | 247 | # Y2K |
|
247 | d = '19'+d | |
|
248 | d = '19' + d | |
|
248 | 249 | |
|
249 | 250 | if len(d.split()) != 3: |
|
250 | 251 | # cvs log dates always in GMT |
|
251 | d = d+' UTC' | |
|
252 | d = d + ' UTC' | |
|
252 | 253 | e.date = util.parsedate(d, ['%y/%m/%d %H:%M:%S', '%Y/%m/%d %H:%M:%S', '%Y-%m-%d %H:%M:%S']) |
|
253 | 254 | e.author = scache(match.group(2)) |
|
254 | 255 | e.dead = match.group(3).lower() == 'dead' |
@@ -266,7 +267,7 b' def createlog(ui, directory=None, root="' | |||
|
266 | 267 | state = 7 |
|
267 | 268 | |
|
268 | 269 | elif state == 7: |
|
269 |
# read the revision numbers of branches that start at this revision |
|
|
270 | # read the revision numbers of branches that start at this revision | |
|
270 | 271 | # or store the commit log message otherwise |
|
271 | 272 | m = re_70.match(line) |
|
272 | 273 | if m: |
@@ -301,15 +302,15 b' def createlog(ui, directory=None, root="' | |||
|
301 | 302 | e.comment = scache('\n'.join(e.comment)) |
|
302 | 303 | |
|
303 | 304 | revn = len(e.revision) |
|
304 | if revn>3 and (revn%2) == 0: | |
|
305 | if revn > 3 and (revn % 2) == 0: | |
|
305 | 306 | e.branch = tags.get(e.revision[:-1], [None])[0] |
|
306 | 307 | else: |
|
307 | 308 | e.branch = None |
|
308 | 309 | |
|
309 | 310 | log.append(e) |
|
310 | 311 | |
|
311 | if len(log)%100 == 0: | |
|
312 | ui.status(util.ellipsis('%d %s'%(len(log), e.file), 80)+'\n') | |
|
312 | if len(log) % 100 == 0: | |
|
313 | ui.status(util.ellipsis('%d %s' % (len(log), e.file), 80)+'\n') | |
|
313 | 314 | |
|
314 | 315 | listsort(log, key=lambda x:(x.rcs, x.revision)) |
|
315 | 316 | |
@@ -330,9 +331,10 b' def createlog(ui, directory=None, root="' | |||
|
330 | 331 | listsort(log, key=lambda x:x.date) |
|
331 | 332 | |
|
332 | 333 | if oldlog and oldlog[-1].date >= log[0].date: |
|
333 |
raise logerror('Log cache overlaps with new log entries, |
|
|
334 | raise logerror('Log cache overlaps with new log entries,' | |
|
335 | ' re-run without cache.') | |
|
334 | 336 | |
|
335 | log = oldlog+log | |
|
337 | log = oldlog + log | |
|
336 | 338 | |
|
337 | 339 | # write the new cachefile |
|
338 | 340 | ui.note(_('writing cvs log cache %s\n') % cachefile) |
@@ -377,14 +379,17 b' def createchangeset(ui, log, fuzz=60, me' | |||
|
377 | 379 | e.comment == c.comment and |
|
378 | 380 | e.author == c.author and |
|
379 | 381 | e.branch == c.branch and |
|
380 | (c.date[0]+c.date[1]) <= (e.date[0]+e.date[1]) <= (c.date[0]+c.date[1])+fuzz and | |
|
382 | ((c.date[0] + c.date[1]) <= | |
|
383 | (e.date[0] + e.date[1]) <= | |
|
384 | (c.date[0] + c.date[1]) + fuzz) and | |
|
381 | 385 | e.file not in files): |
|
382 | 386 | c = changeset(comment=e.comment, author=e.author, |
|
383 | 387 | branch=e.branch, date=e.date, entries=[]) |
|
384 | 388 | changesets.append(c) |
|
385 | 389 | files = {} |
|
386 | if len(changesets)%100 == 0: | |
|
387 |
|
|
|
390 | if len(changesets) % 100 == 0: | |
|
391 | t = '%d %s' % (len(changesets), repr(e.comment)[1:-1]) | |
|
392 | ui.status(util.ellipsis(t, 80) + '\n') | |
|
388 | 393 | |
|
389 | 394 | e.Changeset = c |
|
390 | 395 | c.entries.append(e) |
@@ -402,13 +407,13 b' def createchangeset(ui, log, fuzz=60, me' | |||
|
402 | 407 | nr = len(r) |
|
403 | 408 | n = min(nl, nr) |
|
404 | 409 | for i in range(n): |
|
405 | if i+1 == nl and nl<nr: | |
|
410 | if i + 1 == nl and nl < nr: | |
|
406 | 411 | return -1 |
|
407 | elif i+1 == nr and nl>nr: | |
|
412 | elif i + 1 == nr and nl > nr: | |
|
408 | 413 | return +1 |
|
409 | elif l[i]<r[i]: | |
|
414 | elif l[i] < r[i]: | |
|
410 | 415 | return -1 |
|
411 | elif l[i]>r[i]: | |
|
416 | elif l[i] > r[i]: | |
|
412 | 417 | return +1 |
|
413 | 418 | return 0 |
|
414 | 419 | def entitycompare(l, r): |
@@ -419,7 +424,7 b' def createchangeset(ui, log, fuzz=60, me' | |||
|
419 | 424 | # Sort changesets by date |
|
420 | 425 | |
|
421 | 426 | def cscmp(l, r): |
|
422 | d = sum(l.date)-sum(r.date) | |
|
427 | d = sum(l.date) - sum(r.date) | |
|
423 | 428 | if d: |
|
424 | 429 | return d |
|
425 | 430 | |
@@ -526,8 +531,8 b' def createchangeset(ui, log, fuzz=60, me' | |||
|
526 | 531 | cc = changeset(author=c.author, branch=m, date=c.date, |
|
527 | 532 | comment='convert-repo: CVS merge from branch %s' % c.branch, |
|
528 | 533 | entries=[], tags=[], parents=[changesets[branches[m]], c]) |
|
529 | changesets.insert(i+1, cc) | |
|
530 | branches[m] = i+1 | |
|
534 | changesets.insert(i + 1, cc) | |
|
535 | branches[m] = i + 1 | |
|
531 | 536 | |
|
532 | 537 | # adjust our loop counters now we have inserted a new entry |
|
533 | 538 | n += 1 |
@@ -540,7 +545,7 b' def createchangeset(ui, log, fuzz=60, me' | |||
|
540 | 545 | # Number changesets |
|
541 | 546 | |
|
542 | 547 | for i, c in enumerate(changesets): |
|
543 | c.id = i+1 | |
|
548 | c.id = i + 1 | |
|
544 | 549 | |
|
545 | 550 | ui.status(_('%d changeset entries\n') % len(changesets)) |
|
546 | 551 |
General Comments 0
You need to be logged in to leave comments.
Login now