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