Show More
@@ -19,6 +19,7 b' class logentry(object):' | |||
|
19 | 19 | .branch - name of branch this revision is on |
|
20 | 20 | .branches - revision tuple of branches starting at this revision |
|
21 | 21 | .comment - commit message |
|
22 | .commitid - CVS commitid or None | |
|
22 | 23 | .date - the commit date as a (time, tz) tuple |
|
23 | 24 | .dead - true if file revision is dead |
|
24 | 25 | .file - Name of file |
@@ -28,19 +29,17 b' class logentry(object):' | |||
|
28 | 29 | .revision - revision number as tuple |
|
29 | 30 | .tags - list of tags on the file |
|
30 | 31 | .synthetic - is this a synthetic "file ... added on ..." revision? |
|
31 | .mergepoint- the branch that has been merged from | |
|
32 |
|
|
|
33 | .branchpoints- the branches that start at the current entry | |
|
32 | .mergepoint - the branch that has been merged from (if present in | |
|
33 | rlog output) or None | |
|
34 | .branchpoints - the branches that start at the current entry or empty | |
|
34 | 35 | ''' |
|
35 | 36 | def __init__(self, **entries): |
|
36 | 37 | self.synthetic = False |
|
37 | 38 | self.__dict__.update(entries) |
|
38 | 39 | |
|
39 | 40 | def __repr__(self): |
|
40 | return "<%s at 0x%x: %s %s>" % (self.__class__.__name__, | |
|
41 | id(self), | |
|
42 | self.file, | |
|
43 | ".".join(map(str, self.revision))) | |
|
41 | items = ("%s=%r"%(k, self.__dict__[k]) for k in sorted(self.__dict__)) | |
|
42 | return "%s(%s)"%(type(self).__name__, ", ".join(items)) | |
|
44 | 43 | |
|
45 | 44 | class logerror(Exception): |
|
46 | 45 | pass |
@@ -113,6 +112,7 b' def createlog(ui, directory=None, root="' | |||
|
113 | 112 | re_50 = re.compile('revision ([\\d.]+)(\s+locked by:\s+.+;)?$') |
|
114 | 113 | re_60 = re.compile(r'date:\s+(.+);\s+author:\s+(.+);\s+state:\s+(.+?);' |
|
115 | 114 | r'(\s+lines:\s+(\+\d+)?\s+(-\d+)?;)?' |
|
115 | r'(\s+commitid:\s+([^;]+);)?' | |
|
116 | 116 | r'(.*mergepoint:\s+([^;]+);)?') |
|
117 | 117 | re_70 = re.compile('branches: (.+);$') |
|
118 | 118 | |
@@ -171,6 +171,14 b' def createlog(ui, directory=None, root="' | |||
|
171 | 171 | try: |
|
172 | 172 | ui.note(_('reading cvs log cache %s\n') % cachefile) |
|
173 | 173 | oldlog = pickle.load(open(cachefile)) |
|
174 | for e in oldlog: | |
|
175 | if not (util.safehasattr(e, 'branchpoints') and | |
|
176 | util.safehasattr(e, 'commitid') and | |
|
177 | util.safehasattr(e, 'mergepoint')): | |
|
178 | ui.status(_('ignoring old cache\n')) | |
|
179 | oldlog = [] | |
|
180 | break | |
|
181 | ||
|
174 | 182 | ui.note(_('cache has %d log entries\n') % len(oldlog)) |
|
175 | 183 | except Exception, e: |
|
176 | 184 | ui.note(_('error reading cache: %r\n') % e) |
@@ -298,7 +306,8 b' def createlog(ui, directory=None, root="' | |||
|
298 | 306 | assert match, _('expected revision number') |
|
299 | 307 | e = logentry(rcs=scache(rcs), file=scache(filename), |
|
300 | 308 | revision=tuple([int(x) for x in match.group(1).split('.')]), |
|
301 | branches=[], parent=None) | |
|
309 | branches=[], parent=None, commitid=None, mergepoint=None, branchpoints=set()) | |
|
310 | ||
|
302 | 311 | state = 6 |
|
303 | 312 | |
|
304 | 313 | elif state == 6: |
@@ -329,8 +338,11 b' def createlog(ui, directory=None, root="' | |||
|
329 | 338 | else: |
|
330 | 339 | e.lines = None |
|
331 | 340 | |
|
332 |
if match.group(7): # cvs |
|
|
333 |
|
|
|
341 | if match.group(7): # cvs 1.12 commitid | |
|
342 | e.commitid = match.group(8) | |
|
343 | ||
|
344 | if match.group(9): # cvsnt mergepoint | |
|
345 | myrev = match.group(10).split('.') | |
|
334 | 346 | if len(myrev) == 2: # head |
|
335 | 347 | e.mergepoint = 'HEAD' |
|
336 | 348 | else: |
@@ -339,8 +351,7 b' def createlog(ui, directory=None, root="' | |||
|
339 | 351 | assert len(branches) == 1, ('unknown branch: %s' |
|
340 | 352 | % e.mergepoint) |
|
341 | 353 | e.mergepoint = branches[0] |
|
342 | else: | |
|
343 | e.mergepoint = None | |
|
354 | ||
|
344 | 355 | e.comment = [] |
|
345 | 356 | state = 7 |
|
346 | 357 | |
@@ -469,23 +480,22 b' class changeset(object):' | |||
|
469 | 480 | .author - author name as CVS knows it |
|
470 | 481 | .branch - name of branch this changeset is on, or None |
|
471 | 482 | .comment - commit message |
|
483 | .commitid - CVS commitid or None | |
|
472 | 484 | .date - the commit date as a (time,tz) tuple |
|
473 | 485 | .entries - list of logentry objects in this changeset |
|
474 | 486 | .parents - list of one or two parent changesets |
|
475 | 487 | .tags - list of tags on this changeset |
|
476 | 488 | .synthetic - from synthetic revision "file ... added on branch ..." |
|
477 | .mergepoint- the branch that has been merged from | |
|
478 | (if present in rlog output) | |
|
479 | .branchpoints- the branches that start at the current entry | |
|
489 | .mergepoint- the branch that has been merged from or None | |
|
490 | .branchpoints- the branches that start at the current entry or empty | |
|
480 | 491 | ''' |
|
481 | 492 | def __init__(self, **entries): |
|
482 | 493 | self.synthetic = False |
|
483 | 494 | self.__dict__.update(entries) |
|
484 | 495 | |
|
485 | 496 | def __repr__(self): |
|
486 | return "<%s at 0x%x: %s>" % (self.__class__.__name__, | |
|
487 | id(self), | |
|
488 | getattr(self, 'id', "(no id)")) | |
|
497 | items = ("%s=%r"%(k, self.__dict__[k]) for k in sorted(self.__dict__)) | |
|
498 | return "%s(%s)"%(type(self).__name__, ", ".join(items)) | |
|
489 | 499 | |
|
490 | 500 | def createchangeset(ui, log, fuzz=60, mergefrom=None, mergeto=None): |
|
491 | 501 | '''Convert log into changesets.''' |
@@ -493,8 +503,7 b' def createchangeset(ui, log, fuzz=60, me' | |||
|
493 | 503 | ui.status(_('creating changesets\n')) |
|
494 | 504 | |
|
495 | 505 | # Merge changesets |
|
496 | ||
|
497 | log.sort(key=lambda x: (x.comment, x.author, x.branch, x.date)) | |
|
506 | log.sort(key=lambda x: (x.commitid, x.comment, x.author, x.branch, x.date, x.branchpoints)) | |
|
498 | 507 | |
|
499 | 508 | changesets = [] |
|
500 | 509 | files = set() |
@@ -517,22 +526,27 b' def createchangeset(ui, log, fuzz=60, me' | |||
|
517 | 526 | # first changeset and bar the next and MYBRANCH and MYBRANCH2 |
|
518 | 527 | # should both start off of the bar changeset. No provisions are |
|
519 | 528 | # made to ensure that this is, in fact, what happens. |
|
520 | if not (c and | |
|
521 | e.comment == c.comment and | |
|
522 | e.author == c.author and | |
|
523 | e.branch == c.branch and | |
|
524 | (not util.safehasattr(e, 'branchpoints') or | |
|
525 | not util.safehasattr (c, 'branchpoints') or | |
|
526 |
e. |
|
|
527 | ((c.date[0] + c.date[1]) <= | |
|
528 | (e.date[0] + e.date[1]) <= | |
|
529 |
(c.date[0] + c.date[1]) |
|
|
530 | e.file not in files): | |
|
529 | if not (c and e.branchpoints == c.branchpoints and | |
|
530 | ( # cvs commitids | |
|
531 | (e.commitid is not None and e.commitid == c.commitid) | |
|
532 | or | |
|
533 | ( # no commitids, use fuzzy commit detection | |
|
534 | (e.commitid is None or c.commitid is None) and | |
|
535 | e.comment == c.comment and | |
|
536 | e.author == c.author and | |
|
537 | e.branch == c.branch and | |
|
538 | ((c.date[0] + c.date[1]) <= | |
|
539 | (e.date[0] + e.date[1]) <= | |
|
540 | (c.date[0] + c.date[1]) + fuzz) and | |
|
541 | e.file not in files | |
|
542 | ) | |
|
543 | )): | |
|
531 | 544 | c = changeset(comment=e.comment, author=e.author, |
|
532 |
branch=e.branch, date=e.date, |
|
|
533 |
mergepoint= |
|
|
534 |
branchpoints= |
|
|
545 | branch=e.branch, date=e.date, | |
|
546 | entries=[], mergepoint=e.mergepoint, | |
|
547 | branchpoints=e.branchpoints, commitid=e.commitid) | |
|
535 | 548 | changesets.append(c) |
|
549 | ||
|
536 | 550 | files = set() |
|
537 | 551 | if len(changesets) % 100 == 0: |
|
538 | 552 | t = '%d %s' % (len(changesets), repr(e.comment)[1:-1]) |
@@ -808,9 +822,8 b' def debugcvsps(ui, *args, **opts):' | |||
|
808 | 822 | ui.write(('Branch: %s\n' % (cs.branch or 'HEAD'))) |
|
809 | 823 | ui.write(('Tag%s: %s \n' % (['', 's'][len(cs.tags) > 1], |
|
810 | 824 | ','.join(cs.tags) or '(none)'))) |
|
811 | branchpoints = getattr(cs, 'branchpoints', None) | |
|
812 | if branchpoints: | |
|
813 | ui.write(('Branchpoints: %s \n' % ', '.join(branchpoints))) | |
|
825 | if cs.branchpoints: | |
|
826 | ui.write('Branchpoints: %s \n' % ', '.join(cs.branchpoints)) | |
|
814 | 827 | if opts["parents"] and cs.parents: |
|
815 | 828 | if len(cs.parents) > 1: |
|
816 | 829 | ui.write(('Parents: %s\n' % |
General Comments 0
You need to be logged in to leave comments.
Login now