Show More
@@ -1845,8 +1845,10 b' class localrepository(object):' | |||
|
1845 | 1845 | # push everything, |
|
1846 | 1846 | # use the fast path, no race possible on push |
|
1847 | 1847 | bundler = changegroup.bundle10(self, bundlecaps) |
|
1848 |
cg = self._changegroup(outgoing |
|
|
1849 |
|
|
|
1848 | cg = self._changegroupsubset(outgoing, | |
|
1849 | bundler, | |
|
1850 | 'push', | |
|
1851 | fastpath=True) | |
|
1850 | 1852 | else: |
|
1851 | 1853 | cg = self.getlocalbundle('push', outgoing, bundlecaps) |
|
1852 | 1854 | |
@@ -1989,11 +1991,12 b' class localrepository(object):' | |||
|
1989 | 1991 | cl = self.changelog |
|
1990 | 1992 | if not bases: |
|
1991 | 1993 | bases = [nullid] |
|
1994 | # TODO: remove call to nodesbetween. | |
|
1992 | 1995 | csets, bases, heads = cl.nodesbetween(bases, heads) |
|
1993 | # We assume that all ancestors of bases are known | |
|
1994 | common = cl.ancestors([cl.rev(n) for n in bases]) | |
|
1996 | bases = [p for n in bases for p in cl.parents(n) if p != nullid] | |
|
1997 | outgoing = discovery.outgoing(cl, bases, heads) | |
|
1995 | 1998 | bundler = changegroup.bundle10(self) |
|
1996 |
return self._changegroupsubset( |
|
|
1999 | return self._changegroupsubset(outgoing, bundler, source) | |
|
1997 | 2000 | |
|
1998 | 2001 | def getlocalbundle(self, source, outgoing, bundlecaps=None): |
|
1999 | 2002 | """Like getbundle, but taking a discovery.outgoing as an argument. |
@@ -2003,11 +2006,7 b' class localrepository(object):' | |||
|
2003 | 2006 | if not outgoing.missing: |
|
2004 | 2007 | return None |
|
2005 | 2008 | bundler = changegroup.bundle10(self, bundlecaps) |
|
2006 |
return self._changegroupsubset(outgoing |
|
|
2007 | outgoing.missing, | |
|
2008 | outgoing.missingheads, | |
|
2009 | bundler, | |
|
2010 | source) | |
|
2009 | return self._changegroupsubset(outgoing, bundler, source) | |
|
2011 | 2010 | |
|
2012 | 2011 | def getbundle(self, source, heads=None, common=None, bundlecaps=None): |
|
2013 | 2012 | """Like changegroupsubset, but returns the set difference between the |
@@ -2031,8 +2030,11 b' class localrepository(object):' | |||
|
2031 | 2030 | bundlecaps=bundlecaps) |
|
2032 | 2031 | |
|
2033 | 2032 | @unfilteredmethod |
|
2034 |
def _changegroupsubset(self, |
|
|
2035 | ||
|
2033 | def _changegroupsubset(self, outgoing, bundler, source, | |
|
2034 | fastpath=False): | |
|
2035 | commonrevs = outgoing.common | |
|
2036 | csets = outgoing.missing | |
|
2037 | heads = outgoing.missingheads | |
|
2036 | 2038 | cl = bundler._changelog |
|
2037 | 2039 | mf = bundler._manifest |
|
2038 | 2040 | mfs = {} # needed manifests |
@@ -2040,12 +2042,13 b' class localrepository(object):' | |||
|
2040 | 2042 | changedfiles = set() |
|
2041 | 2043 | fstate = ['', {}] |
|
2042 | 2044 | |
|
2043 |
# |
|
|
2045 | # We go through the fast path if we get told to, or if all (unfiltered | |
|
2046 | # heads have been requested (since we then know there all linkrevs will | |
|
2047 | # be pulled by the client). | |
|
2044 | 2048 | heads.sort() |
|
2045 | if heads == sorted(self.heads()): | |
|
2046 | return self._changegroup(csets, bundler, source) | |
|
2049 | fastpathlinkrev = fastpath or ( | |
|
2050 | self.filtername is None and heads == sorted(self.heads())) | |
|
2047 | 2051 | |
|
2048 | # slow path | |
|
2049 | 2052 | self.hook('preoutgoing', throw=True, source=source) |
|
2050 | 2053 | self.changegroupinfo(csets, source) |
|
2051 | 2054 | |
@@ -2073,10 +2076,11 b' class localrepository(object):' | |||
|
2073 | 2076 | return x |
|
2074 | 2077 | elif revlog == mf: |
|
2075 | 2078 | clnode = mfs[x] |
|
2076 | mdata = mf.readfast(x) | |
|
2077 |
|
|
|
2078 |
|
|
|
2079 | fnodes[f].setdefault(n, clnode) | |
|
2079 | if not fastpathlinkrev: | |
|
2080 | mdata = mf.readfast(x) | |
|
2081 | for f, n in mdata.iteritems(): | |
|
2082 | if f in changedfiles: | |
|
2083 | fnodes[f].setdefault(n, clnode) | |
|
2080 | 2084 | count[0] += 1 |
|
2081 | 2085 | progress(_bundling, count[0], |
|
2082 | 2086 | unit=_manifests, total=count[1]) |
@@ -2097,6 +2101,14 b' class localrepository(object):' | |||
|
2097 | 2101 | mfs.clear() |
|
2098 | 2102 | return changedfiles |
|
2099 | 2103 | def getfilenodes(fname, filerevlog): |
|
2104 | if fastpathlinkrev: | |
|
2105 | ln, llr = filerevlog.node, filerevlog.linkrev | |
|
2106 | def genfilenodes(): | |
|
2107 | for r in filerevlog: | |
|
2108 | linkrev = llr(r) | |
|
2109 | if linkrev not in commonrevs: | |
|
2110 | yield filerevlog.node(r), cl.node(linkrev) | |
|
2111 | fnodes[fname] = dict(genfilenodes()) | |
|
2100 | 2112 | fstate[0] = fname |
|
2101 | 2113 | fstate[1] = fnodes.pop(fname, {}) |
|
2102 | 2114 | return prune(filerevlog, fstate[1]) |
@@ -2110,73 +2122,6 b' class localrepository(object):' | |||
|
2110 | 2122 | return self.changegroupsubset(basenodes, self.heads(), source) |
|
2111 | 2123 | |
|
2112 | 2124 | @unfilteredmethod |
|
2113 | def _changegroup(self, nodes, bundler, source): | |
|
2114 | """Compute the changegroup of all nodes that we have that a recipient | |
|
2115 | doesn't. Return a chunkbuffer object whose read() method will return | |
|
2116 | successive changegroup chunks. | |
|
2117 | ||
|
2118 | This is much easier than the previous function as we can assume that | |
|
2119 | the recipient has any changenode we aren't sending them. | |
|
2120 | ||
|
2121 | nodes is the set of nodes to send""" | |
|
2122 | ||
|
2123 | cl = bundler._changelog | |
|
2124 | mf = bundler._manifest | |
|
2125 | mfs = {} | |
|
2126 | changedfiles = set() | |
|
2127 | fstate = [''] | |
|
2128 | ||
|
2129 | self.hook('preoutgoing', throw=True, source=source) | |
|
2130 | self.changegroupinfo(nodes, source) | |
|
2131 | ||
|
2132 | revset = set([cl.rev(n) for n in nodes]) | |
|
2133 | ||
|
2134 | def gennodelst(log): | |
|
2135 | ln, llr = log.node, log.linkrev | |
|
2136 | return [ln(r) for r in log if llr(r) in revset] | |
|
2137 | ||
|
2138 | progress = self.ui.progress | |
|
2139 | _bundling = _('bundling') | |
|
2140 | _changesets = _('changesets') | |
|
2141 | _manifests = _('manifests') | |
|
2142 | _files = _('files') | |
|
2143 | ||
|
2144 | def lookup(revlog, x): | |
|
2145 | count = bundler.count | |
|
2146 | if revlog == cl: | |
|
2147 | c = cl.read(x) | |
|
2148 | changedfiles.update(c[3]) | |
|
2149 | mfs.setdefault(c[0], x) | |
|
2150 | count[0] += 1 | |
|
2151 | progress(_bundling, count[0], | |
|
2152 | unit=_changesets, total=count[1]) | |
|
2153 | return x | |
|
2154 | elif revlog == mf: | |
|
2155 | count[0] += 1 | |
|
2156 | progress(_bundling, count[0], | |
|
2157 | unit=_manifests, total=count[1]) | |
|
2158 | return cl.node(revlog.linkrev(revlog.rev(x))) | |
|
2159 | else: | |
|
2160 | progress(_bundling, count[0], item=fstate[0], | |
|
2161 | total=count[1], unit=_files) | |
|
2162 | return cl.node(revlog.linkrev(revlog.rev(x))) | |
|
2163 | ||
|
2164 | bundler.start(lookup) | |
|
2165 | ||
|
2166 | def getmfnodes(): | |
|
2167 | bundler.count[:] = [0, len(mfs)] | |
|
2168 | return gennodelst(mf) | |
|
2169 | def getfiles(): | |
|
2170 | return changedfiles | |
|
2171 | def getfilenodes(fname, filerevlog): | |
|
2172 | fstate[0] = fname | |
|
2173 | return gennodelst(filerevlog) | |
|
2174 | ||
|
2175 | gengroup = bundler.generate(nodes, getmfnodes, getfiles, getfilenodes, | |
|
2176 | source) | |
|
2177 | return changegroup.unbundle10(util.chunkbuffer(gengroup), 'UN') | |
|
2178 | ||
|
2179 | @unfilteredmethod | |
|
2180 | 2125 | def addchangegroup(self, source, srctype, url, emptyok=False): |
|
2181 | 2126 | """Add the changegroup returned by source.read() to this repo. |
|
2182 | 2127 | srctype is a string like 'push', 'pull', or 'unbundle'. url is |
General Comments 0
You need to be logged in to leave comments.
Login now