Mercurial > hg
comparison hgext/convert/cvsps.py @ 19505:7b815e38022a stable
convert: handle changeset sorting errors without traceback (issue3961)
author | Frank Kingswood <frank@kingswood-consulting.co.uk> |
---|---|
date | Fri, 26 Jul 2013 14:44:13 +0100 |
parents | 0a12e5f3a979 |
children | 684bad8c4265 |
comparison
equal
deleted
inserted
replaced
19504:2fa303619b4d | 19505:7b815e38022a |
---|---|
494 .synthetic - from synthetic revision "file ... added on branch ..." | 494 .synthetic - from synthetic revision "file ... added on branch ..." |
495 .mergepoint- the branch that has been merged from or None | 495 .mergepoint- the branch that has been merged from or None |
496 .branchpoints- the branches that start at the current entry or empty | 496 .branchpoints- the branches that start at the current entry or empty |
497 ''' | 497 ''' |
498 def __init__(self, **entries): | 498 def __init__(self, **entries): |
499 self.id = None | |
499 self.synthetic = False | 500 self.synthetic = False |
500 self.__dict__.update(entries) | 501 self.__dict__.update(entries) |
501 | 502 |
502 def __repr__(self): | 503 def __repr__(self): |
503 items = ("%s=%r"%(k, self.__dict__[k]) for k in sorted(self.__dict__)) | 504 items = ("%s=%r"%(k, self.__dict__[k]) for k in sorted(self.__dict__)) |
602 for c in changesets: | 603 for c in changesets: |
603 c.entries.sort(entitycompare) | 604 c.entries.sort(entitycompare) |
604 | 605 |
605 # Sort changesets by date | 606 # Sort changesets by date |
606 | 607 |
607 def cscmp(l, r): | 608 odd = set() |
609 def cscmp(l, r, odd=odd): | |
608 d = sum(l.date) - sum(r.date) | 610 d = sum(l.date) - sum(r.date) |
609 if d: | 611 if d: |
610 return d | 612 return d |
611 | 613 |
612 # detect vendor branches and initial commits on a branch | 614 # detect vendor branches and initial commits on a branch |
624 d = 1 | 626 d = 1 |
625 break | 627 break |
626 | 628 |
627 for e in r.entries: | 629 for e in r.entries: |
628 if le.get(e.rcs, None) == e.parent: | 630 if le.get(e.rcs, None) == e.parent: |
629 assert not d | 631 if d: |
632 odd.add((l, r)) | |
630 d = -1 | 633 d = -1 |
631 break | 634 break |
632 | 635 |
633 return d | 636 return d |
634 | 637 |
766 | 769 |
767 # Number changesets | 770 # Number changesets |
768 | 771 |
769 for i, c in enumerate(changesets): | 772 for i, c in enumerate(changesets): |
770 c.id = i + 1 | 773 c.id = i + 1 |
774 | |
775 if odd: | |
776 for l, r in odd: | |
777 if l.id is not None and r.id is not None: | |
778 ui.warn(_('changeset %d is both before and after %d\n') | |
779 % (l.id, r.id)) | |
771 | 780 |
772 ui.status(_('%d changeset entries\n') % len(changesets)) | 781 ui.status(_('%d changeset entries\n') % len(changesets)) |
773 | 782 |
774 hook.hook(ui, None, "cvschangesets", True, changesets=changesets) | 783 hook.hook(ui, None, "cvschangesets", True, changesets=changesets) |
775 | 784 |