comparison mercurial/hg.py @ 324:ce81bdd91d06

hg merge: some getchangegroup fixups -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 hg merge: some getchangegroup fixups - - filter more duplicates - - request batching - - lookup ordering - - request counting After these fixes, grabbing 1800 changesets on top of the 28k changeset kernel history takes 23 round trips rather than a couple hundred. manifest hash: 78e893b68000267a8c7ea49fd38758f2fc96269f -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCrea0ywK+sNU5EO8RAv3cAKCQveivdApJIlslTCMLMp2VogRXfACeNRnx Ihsf5yLz60fFpqlzAmZBACk= =Euku -----END PGP SIGNATURE-----
author mpm@selenic.com
date Mon, 13 Jun 2005 12:04:04 -0800
parents 73b8a8a059ec
children dac675ef6189
comparison
equal deleted inserted replaced
323:c6f0673ab7e9 324:ce81bdd91d06
721 unknown.append(h) 721 unknown.append(h)
722 722
723 if not unknown: 723 if not unknown:
724 self.ui.status("nothing to do!\n") 724 self.ui.status("nothing to do!\n")
725 return None 725 return None
726 726
727 rep = {}
728 reqcnt = 0
729
727 unknown = remote.branches(unknown) 730 unknown = remote.branches(unknown)
728 while unknown: 731 while unknown:
729 n = unknown.pop(0) 732 r = []
730 seen[n[0]] = 1 733 while unknown:
731 734 n = unknown.pop(0)
732 self.ui.debug("examining %s:%s\n" % (short(n[0]), short(n[1]))) 735 if n[0] in seen:
733 if n == nullid: break 736 continue
734 if n in seenbranch: 737 seen[n[0]] = 1
735 self.ui.debug("branch already found\n") 738
736 continue 739 self.ui.debug("examining %s:%s\n" % (short(n[0]), short(n[1])))
737 if n[1] and n[1] in m: # do we know the base? 740 if n[0] == nullid:
738 self.ui.debug("found incomplete branch %s:%s\n" 741 break
739 % (short(n[0]), short(n[1]))) 742 if n[1] in seenbranch:
740 search.append(n) # schedule branch range for scanning 743 self.ui.debug("branch already found\n")
741 seenbranch[n] = 1 744 continue
742 else: 745 if n[1] and n[1] in m: # do we know the base?
743 if n[2] in m and n[3] in m: 746 self.ui.debug("found incomplete branch %s:%s\n"
744 if n[1] not in fetch: 747 % (short(n[0]), short(n[1])))
745 self.ui.debug("found new changeset %s\n" % 748 search.append(n) # schedule branch range for scanning
746 short(n[1])) 749 seenbranch[n[1]] = 1
747 fetch.append(n[1]) # earliest unknown 750 else:
748 continue 751 if n[1] not in seen and n[1] not in fetch:
749 752 if n[2] in m and n[3] in m:
750 r = [] 753 self.ui.debug("found new changeset %s\n" %
751 for a in n[2:4]: 754 short(n[1]))
752 if a not in seen: r.append(a) 755 fetch.append(n[1]) # earliest unknown
753 756 continue
754 if r: 757
755 self.ui.debug("requesting %s\n" % 758 for a in n[2:4]:
756 " ".join(map(short, r))) 759 if a not in rep:
757 for b in remote.branches(r): 760 r.append(a)
761 rep[a] = 1
762
763 if r:
764 reqcnt += 1
765 self.ui.debug("request %d: %s\n" %
766 (reqcnt, " ".join(map(short, r))))
767 for p in range(0, len(r), 10):
768 for b in remote.branches(r[p:p+10]):
758 self.ui.debug("received %s:%s\n" % 769 self.ui.debug("received %s:%s\n" %
759 (short(b[0]), short(b[1]))) 770 (short(b[0]), short(b[1])))
760 if b[0] not in m and b[0] not in seen: 771 if b[0] not in m and b[0] not in seen:
761 unknown.append(b) 772 unknown.append(b)
762 773
763 while search: 774 while search:
764 n = search.pop(0) 775 n = search.pop(0)
776 reqcnt += 1
765 l = remote.between([(n[0], n[1])])[0] 777 l = remote.between([(n[0], n[1])])[0]
766 p = n[0] 778 p = n[0]
767 f = 1 779 f = 1
768 for i in l + [n[1]]: 780 for i in l + [n[1]]:
769 if i in m: 781 if i in m:
782 if f in m: 794 if f in m:
783 raise "already have", short(f[:4]) 795 raise "already have", short(f[:4])
784 796
785 self.ui.note("adding new changesets starting at " + 797 self.ui.note("adding new changesets starting at " +
786 " ".join([short(f) for f in fetch]) + "\n") 798 " ".join([short(f) for f in fetch]) + "\n")
799
800 self.ui.debug("%d total queries\n" % reqcnt)
787 801
788 return remote.changegroup(fetch) 802 return remote.changegroup(fetch)
789 803
790 def changegroup(self, basenodes): 804 def changegroup(self, basenodes):
791 nodes = self.newer(basenodes) 805 nodes = self.newer(basenodes)