mercurial/localrepo.py
branchstable
changeset 10496 45734b51c99b
parent 10492 0e64d814d7d0
child 10510 f77f3383c666
equal deleted inserted replaced
10495:2c2d2f1354b4 10496:45734b51c99b
  1337                             req.add(p)
  1337                             req.add(p)
  1338                 seen.add(n[0])
  1338                 seen.add(n[0])
  1339 
  1339 
  1340             if r:
  1340             if r:
  1341                 reqcnt += 1
  1341                 reqcnt += 1
  1342                 self.ui.progress('searching', reqcnt, unit='queries')
  1342                 self.ui.progress(_('searching'), reqcnt, unit='queries')
  1343                 self.ui.debug("request %d: %s\n" %
  1343                 self.ui.debug("request %d: %s\n" %
  1344                             (reqcnt, " ".join(map(short, r))))
  1344                             (reqcnt, " ".join(map(short, r))))
  1345                 for p in xrange(0, len(r), 10):
  1345                 for p in xrange(0, len(r), 10):
  1346                     for b in remote.branches(r[p:p + 10]):
  1346                     for b in remote.branches(r[p:p + 10]):
  1347                         self.ui.debug("received %s:%s\n" %
  1347                         self.ui.debug("received %s:%s\n" %
  1350 
  1350 
  1351         # do binary search on the branches we found
  1351         # do binary search on the branches we found
  1352         while search:
  1352         while search:
  1353             newsearch = []
  1353             newsearch = []
  1354             reqcnt += 1
  1354             reqcnt += 1
  1355             self.ui.progress('searching', reqcnt, unit='queries')
  1355             self.ui.progress(_('searching'), reqcnt, unit='queries')
  1356             for n, l in zip(search, remote.between(search)):
  1356             for n, l in zip(search, remote.between(search)):
  1357                 l.append(n[1])
  1357                 l.append(n[1])
  1358                 p = n[0]
  1358                 p = n[0]
  1359                 f = 1
  1359                 f = 1
  1360                 for i in l:
  1360                 for i in l:
  1386                 raise util.Abort(_("repository is unrelated"))
  1386                 raise util.Abort(_("repository is unrelated"))
  1387 
  1387 
  1388         self.ui.debug("found new changesets starting at " +
  1388         self.ui.debug("found new changesets starting at " +
  1389                      " ".join([short(f) for f in fetch]) + "\n")
  1389                      " ".join([short(f) for f in fetch]) + "\n")
  1390 
  1390 
  1391         self.ui.progress('searching', None, unit='queries')
  1391         self.ui.progress(_('searching'), None, unit='queries')
  1392         self.ui.debug("%d total queries\n" % reqcnt)
  1392         self.ui.debug("%d total queries\n" % reqcnt)
  1393 
  1393 
  1394         return base.keys(), list(fetch), heads
  1394         return base.keys(), list(fetch), heads
  1395 
  1395 
  1396     def findoutgoing(self, remote, base=None, heads=None, force=False):
  1396     def findoutgoing(self, remote, base=None, heads=None, force=False):
  1817             # back to lookup the owning changenode and collect information.
  1817             # back to lookup the owning changenode and collect information.
  1818             group = cl.group(msng_cl_lst, identity, collect)
  1818             group = cl.group(msng_cl_lst, identity, collect)
  1819             cnt = 0
  1819             cnt = 0
  1820             for chnk in group:
  1820             for chnk in group:
  1821                 yield chnk
  1821                 yield chnk
  1822                 self.ui.progress('bundle changes', cnt, unit='chunks')
  1822                 self.ui.progress(_('bundle changes'), cnt, unit='chunks')
  1823                 cnt += 1
  1823                 cnt += 1
  1824             self.ui.progress('bundle changes', None, unit='chunks')
  1824             self.ui.progress(_('bundle changes'), None, unit='chunks')
  1825 
  1825 
  1826 
  1826 
  1827             # Figure out which manifest nodes (of the ones we think might be
  1827             # Figure out which manifest nodes (of the ones we think might be
  1828             # part of the changegroup) the recipient must know about and
  1828             # part of the changegroup) the recipient must know about and
  1829             # remove them from the changegroup.
  1829             # remove them from the changegroup.
  1845             group = mnfst.group(msng_mnfst_lst, lookup_manifest_link,
  1845             group = mnfst.group(msng_mnfst_lst, lookup_manifest_link,
  1846                                 filenode_collector(changedfiles))
  1846                                 filenode_collector(changedfiles))
  1847             cnt = 0
  1847             cnt = 0
  1848             for chnk in group:
  1848             for chnk in group:
  1849                 yield chnk
  1849                 yield chnk
  1850                 self.ui.progress('bundle manifests', cnt, unit='chunks')
  1850                 self.ui.progress(_('bundle manifests'), cnt, unit='chunks')
  1851                 cnt += 1
  1851                 cnt += 1
  1852             self.ui.progress('bundle manifests', None, unit='chunks')
  1852             self.ui.progress(_('bundle manifests'), None, unit='chunks')
  1853 
  1853 
  1854             # These are no longer needed, dereference and toss the memory for
  1854             # These are no longer needed, dereference and toss the memory for
  1855             # them.
  1855             # them.
  1856             msng_mnfst_lst = None
  1856             msng_mnfst_lst = None
  1857             msng_mnfst_set.clear()
  1857             msng_mnfst_set.clear()
  1896                 if fname in msng_filenode_set:
  1896                 if fname in msng_filenode_set:
  1897                     # Don't need this anymore, toss it to free memory.
  1897                     # Don't need this anymore, toss it to free memory.
  1898                     del msng_filenode_set[fname]
  1898                     del msng_filenode_set[fname]
  1899             # Signal that no more groups are left.
  1899             # Signal that no more groups are left.
  1900             yield changegroup.closechunk()
  1900             yield changegroup.closechunk()
  1901             self.ui.progress('bundle files', None, unit='chunks')
  1901             self.ui.progress(_('bundle files'), None, unit='chunks')
  1902 
  1902 
  1903             if msng_cl_lst:
  1903             if msng_cl_lst:
  1904                 self.hook('outgoing', node=hex(msng_cl_lst[0]), source=source)
  1904                 self.hook('outgoing', node=hex(msng_cl_lst[0]), source=source)
  1905 
  1905 
  1906         return util.chunkbuffer(gengroup())
  1906         return util.chunkbuffer(gengroup())
  1945             mmfs = {}
  1945             mmfs = {}
  1946             collect = changegroup.collector(cl, mmfs, changedfiles)
  1946             collect = changegroup.collector(cl, mmfs, changedfiles)
  1947 
  1947 
  1948             cnt = 0
  1948             cnt = 0
  1949             for chnk in cl.group(nodes, identity, collect):
  1949             for chnk in cl.group(nodes, identity, collect):
  1950                 self.ui.progress('bundle changes', cnt, unit='chunks')
  1950                 self.ui.progress(_('bundle changes'), cnt, unit='chunks')
  1951                 cnt += 1
  1951                 cnt += 1
  1952                 yield chnk
  1952                 yield chnk
  1953             self.ui.progress('bundle changes', None, unit='chunks')
  1953             self.ui.progress(_('bundle changes'), None, unit='chunks')
  1954 
  1954 
  1955             mnfst = self.manifest
  1955             mnfst = self.manifest
  1956             nodeiter = gennodelst(mnfst)
  1956             nodeiter = gennodelst(mnfst)
  1957             cnt = 0
  1957             cnt = 0
  1958             for chnk in mnfst.group(nodeiter, lookuprevlink_func(mnfst)):
  1958             for chnk in mnfst.group(nodeiter, lookuprevlink_func(mnfst)):
  1959                 self.ui.progress('bundle manifests', cnt, unit='chunks')
  1959                 self.ui.progress(_('bundle manifests'), cnt, unit='chunks')
  1960                 cnt += 1
  1960                 cnt += 1
  1961                 yield chnk
  1961                 yield chnk
  1962             self.ui.progress('bundle manifests', None, unit='chunks')
  1962             self.ui.progress(_('bundle manifests'), None, unit='chunks')
  1963 
  1963 
  1964             cnt = 0
  1964             cnt = 0
  1965             for fname in sorted(changedfiles):
  1965             for fname in sorted(changedfiles):
  1966                 filerevlog = self.file(fname)
  1966                 filerevlog = self.file(fname)
  1967                 if not len(filerevlog):
  1967                 if not len(filerevlog):
  2020             trp = weakref.proxy(tr)
  2020             trp = weakref.proxy(tr)
  2021             # pull off the changeset group
  2021             # pull off the changeset group
  2022             self.ui.status(_("adding changesets\n"))
  2022             self.ui.status(_("adding changesets\n"))
  2023             clstart = len(cl)
  2023             clstart = len(cl)
  2024             class prog(object):
  2024             class prog(object):
  2025                 step = 'changesets'
  2025                 step = _('changesets')
  2026                 count = 1
  2026                 count = 1
  2027                 ui = self.ui
  2027                 ui = self.ui
  2028                 def __call__(self):
  2028                 def __call__(self):
  2029                     self.ui.progress(self.step, self.count, unit='chunks')
  2029                     self.ui.progress(self.step, self.count, unit='chunks')
  2030                     self.count += 1
  2030                     self.count += 1
  2032             chunkiter = changegroup.chunkiter(source, progress=pr)
  2032             chunkiter = changegroup.chunkiter(source, progress=pr)
  2033             if cl.addgroup(chunkiter, csmap, trp) is None and not emptyok:
  2033             if cl.addgroup(chunkiter, csmap, trp) is None and not emptyok:
  2034                 raise util.Abort(_("received changelog group is empty"))
  2034                 raise util.Abort(_("received changelog group is empty"))
  2035             clend = len(cl)
  2035             clend = len(cl)
  2036             changesets = clend - clstart
  2036             changesets = clend - clstart
  2037             self.ui.progress('changesets', None)
  2037             self.ui.progress(_('changesets'), None)
  2038 
  2038 
  2039             # pull off the manifest group
  2039             # pull off the manifest group
  2040             self.ui.status(_("adding manifests\n"))
  2040             self.ui.status(_("adding manifests\n"))
  2041             pr.step = 'manifests'
  2041             pr.step = _('manifests')
  2042             pr.count = 1
  2042             pr.count = 1
  2043             chunkiter = changegroup.chunkiter(source, progress=pr)
  2043             chunkiter = changegroup.chunkiter(source, progress=pr)
  2044             # no need to check for empty manifest group here:
  2044             # no need to check for empty manifest group here:
  2045             # if the result of the merge of 1 and 2 is the same in 3 and 4,
  2045             # if the result of the merge of 1 and 2 is the same in 3 and 4,
  2046             # no new manifest will be created and the manifest group will
  2046             # no new manifest will be created and the manifest group will
  2047             # be empty during the pull
  2047             # be empty during the pull
  2048             self.manifest.addgroup(chunkiter, revmap, trp)
  2048             self.manifest.addgroup(chunkiter, revmap, trp)
  2049             self.ui.progress('manifests', None)
  2049             self.ui.progress(_('manifests'), None)
  2050 
  2050 
  2051             needfiles = {}
  2051             needfiles = {}
  2052             if self.ui.configbool('server', 'validate', default=False):
  2052             if self.ui.configbool('server', 'validate', default=False):
  2053                 # validate incoming csets have their manifests
  2053                 # validate incoming csets have their manifests
  2054                 for cset in xrange(clstart, clend):
  2054                 for cset in xrange(clstart, clend):
  2080                         n = fl.node(new)
  2080                         n = fl.node(new)
  2081                         if n in needs:
  2081                         if n in needs:
  2082                             needs.remove(n)
  2082                             needs.remove(n)
  2083                     if not needs:
  2083                     if not needs:
  2084                         del needfiles[f]
  2084                         del needfiles[f]
  2085             self.ui.progress('files', None)
  2085             self.ui.progress(_('files'), None)
  2086 
  2086 
  2087             for f, needs in needfiles.iteritems():
  2087             for f, needs in needfiles.iteritems():
  2088                 fl = self.file(f)
  2088                 fl = self.file(f)
  2089                 for n in needs:
  2089                 for n in needs:
  2090                     try:
  2090                     try: