Show More
@@ -502,16 +502,9 b' class headerlessfixup(object):' | |||
|
502 | 502 | class cg1packer(object): |
|
503 | 503 | deltaheader = _CHANGEGROUPV1_DELTA_HEADER |
|
504 | 504 | version = '01' |
|
505 |
def __init__(self, repo |
|
|
505 | def __init__(self, repo): | |
|
506 | 506 | """Given a source repo, construct a bundler. |
|
507 | ||
|
508 | bundlecaps is optional and can be used to specify the set of | |
|
509 | capabilities which can be used to build the bundle. | |
|
510 | 507 | """ |
|
511 | # Set of capabilities we can use to build the bundle. | |
|
512 | if bundlecaps is None: | |
|
513 | bundlecaps = set() | |
|
514 | self._bundlecaps = bundlecaps | |
|
515 | 508 | # experimental config: bundle.reorder |
|
516 | 509 | reorder = repo.ui.config('bundle', 'reorder', 'auto') |
|
517 | 510 | if reorder == 'auto': |
@@ -815,8 +808,8 b' class cg2packer(cg1packer):' | |||
|
815 | 808 | version = '02' |
|
816 | 809 | deltaheader = _CHANGEGROUPV2_DELTA_HEADER |
|
817 | 810 | |
|
818 |
def __init__(self, repo |
|
|
819 |
super(cg2packer, self).__init__(repo |
|
|
811 | def __init__(self, repo): | |
|
812 | super(cg2packer, self).__init__(repo) | |
|
820 | 813 | if self._reorder is None: |
|
821 | 814 | # Since generaldelta is directly supported by cg2, reordering |
|
822 | 815 | # generally doesn't help, so we disable it by default (treating |
@@ -910,9 +903,9 b' def safeversion(repo):' | |||
|
910 | 903 | assert versions |
|
911 | 904 | return min(versions) |
|
912 | 905 | |
|
913 |
def getbundler(version, repo |
|
|
906 | def getbundler(version, repo): | |
|
914 | 907 | assert version in supportedoutgoingversions(repo) |
|
915 |
return _packermap[version][0](repo |
|
|
908 | return _packermap[version][0](repo) | |
|
916 | 909 | |
|
917 | 910 | def getunbundler(version, fh, alg, extras=None): |
|
918 | 911 | return _packermap[version][1](fh, alg, extras=extras) |
@@ -963,30 +956,27 b' def changegroupsubset(repo, roots, heads' | |||
|
963 | 956 | bundler = getbundler(version, repo) |
|
964 | 957 | return getsubset(repo, outgoing, bundler, source) |
|
965 | 958 | |
|
966 |
def getlocalchangegroupraw(repo, source, outgoing, |
|
|
967 | version='01'): | |
|
959 | def getlocalchangegroupraw(repo, source, outgoing, version='01'): | |
|
968 | 960 | """Like getbundle, but taking a discovery.outgoing as an argument. |
|
969 | 961 | |
|
970 | 962 | This is only implemented for local repos and reuses potentially |
|
971 | 963 | precomputed sets in outgoing. Returns a raw changegroup generator.""" |
|
972 | 964 | if not outgoing.missing: |
|
973 | 965 | return None |
|
974 |
bundler = getbundler(version, repo |
|
|
966 | bundler = getbundler(version, repo) | |
|
975 | 967 | return getsubsetraw(repo, outgoing, bundler, source) |
|
976 | 968 | |
|
977 |
def getlocalchangegroup(repo, source, outgoing, |
|
|
978 | version='01'): | |
|
969 | def getlocalchangegroup(repo, source, outgoing, version='01'): | |
|
979 | 970 | """Like getbundle, but taking a discovery.outgoing as an argument. |
|
980 | 971 | |
|
981 | 972 | This is only implemented for local repos and reuses potentially |
|
982 | 973 | precomputed sets in outgoing.""" |
|
983 | 974 | if not outgoing.missing: |
|
984 | 975 | return None |
|
985 |
bundler = getbundler(version, repo |
|
|
976 | bundler = getbundler(version, repo) | |
|
986 | 977 | return getsubset(repo, outgoing, bundler, source) |
|
987 | 978 | |
|
988 |
def getchangegroup(repo, source, outgoing, |
|
|
989 | version='01'): | |
|
979 | def getchangegroup(repo, source, outgoing, version='01'): | |
|
990 | 980 | """Like changegroupsubset, but returns the set difference between the |
|
991 | 981 | ancestors of heads and the ancestors common. |
|
992 | 982 | |
@@ -995,8 +985,7 b' def getchangegroup(repo, source, outgoin' | |||
|
995 | 985 | The nodes in common might not all be known locally due to the way the |
|
996 | 986 | current discovery protocol works. |
|
997 | 987 | """ |
|
998 |
return getlocalchangegroup(repo, source, outgoing, |
|
|
999 | version=version) | |
|
988 | return getlocalchangegroup(repo, source, outgoing, version=version) | |
|
1000 | 989 | |
|
1001 | 990 | def changegroup(repo, basenodes, source): |
|
1002 | 991 | # to avoid a race we use changegroupsubset() (issue1320) |
@@ -1346,8 +1346,6 b' def bundle(ui, repo, fname, dest=None, *' | |||
|
1346 | 1346 | base = ['null'] |
|
1347 | 1347 | else: |
|
1348 | 1348 | base = scmutil.revrange(repo, opts.get('base')) |
|
1349 | # TODO: get desired bundlecaps from command line. | |
|
1350 | bundlecaps = None | |
|
1351 | 1349 | if cgversion not in changegroup.supportedoutgoingversions(repo): |
|
1352 | 1350 | raise error.Abort(_("repository does not support bundle version %s") % |
|
1353 | 1351 | cgversion) |
@@ -1360,7 +1358,6 b' def bundle(ui, repo, fname, dest=None, *' | |||
|
1360 | 1358 | heads = revs and map(repo.lookup, revs) or None |
|
1361 | 1359 | outgoing = discovery.outgoing(repo, common, heads) |
|
1362 | 1360 | cg = changegroup.getchangegroup(repo, 'bundle', outgoing, |
|
1363 | bundlecaps=bundlecaps, | |
|
1364 | 1361 | version=cgversion) |
|
1365 | 1362 | outgoing = None |
|
1366 | 1363 | else: |
@@ -1374,7 +1371,7 b' def bundle(ui, repo, fname, dest=None, *' | |||
|
1374 | 1371 | force=opts.get('force'), |
|
1375 | 1372 | portable=True) |
|
1376 | 1373 | cg = changegroup.getlocalchangegroup(repo, 'bundle', outgoing, |
|
1377 |
|
|
|
1374 | version=cgversion) | |
|
1378 | 1375 | if not cg: |
|
1379 | 1376 | scmutil.nochangesfound(ui, repo, outgoing and outgoing.excluded) |
|
1380 | 1377 | return 1 |
@@ -938,22 +938,19 b' def _pushchangeset(pushop):' | |||
|
938 | 938 | pushop.repo.prepushoutgoinghooks(pushop) |
|
939 | 939 | outgoing = pushop.outgoing |
|
940 | 940 | unbundle = pushop.remote.capable('unbundle') |
|
941 | # TODO: get bundlecaps from remote | |
|
942 | bundlecaps = None | |
|
943 | 941 | # create a changegroup from local |
|
944 | 942 | if pushop.revs is None and not (outgoing.excluded |
|
945 | 943 | or pushop.repo.changelog.filteredrevs): |
|
946 | 944 | # push everything, |
|
947 | 945 | # use the fast path, no race possible on push |
|
948 |
bundler = changegroup.cg1packer(pushop.repo |
|
|
946 | bundler = changegroup.cg1packer(pushop.repo) | |
|
949 | 947 | cg = changegroup.getsubset(pushop.repo, |
|
950 | 948 | outgoing, |
|
951 | 949 | bundler, |
|
952 | 950 | 'push', |
|
953 | 951 | fastpath=True) |
|
954 | 952 | else: |
|
955 |
cg = changegroup.getlocalchangegroup(pushop.repo, 'push', outgoing |
|
|
956 | bundlecaps) | |
|
953 | cg = changegroup.getlocalchangegroup(pushop.repo, 'push', outgoing) | |
|
957 | 954 | |
|
958 | 955 | # apply changegroup to remote |
|
959 | 956 | if unbundle: |
@@ -1578,7 +1575,7 b' def getbundlechunks(repo, source, heads=' | |||
|
1578 | 1575 | raise ValueError(_('unsupported getbundle arguments: %s') |
|
1579 | 1576 | % ', '.join(sorted(kwargs.keys()))) |
|
1580 | 1577 | outgoing = _computeoutgoing(repo, heads, common) |
|
1581 |
bundler = changegroup.getbundler('01', repo |
|
|
1578 | bundler = changegroup.getbundler('01', repo) | |
|
1582 | 1579 | return changegroup.getsubsetraw(repo, outgoing, bundler, source) |
|
1583 | 1580 | |
|
1584 | 1581 | # bundle20 case |
@@ -1616,7 +1613,6 b' def _getbundlechangegrouppart(bundler, r' | |||
|
1616 | 1613 | version = max(cgversions) |
|
1617 | 1614 | outgoing = _computeoutgoing(repo, heads, common) |
|
1618 | 1615 | cg = changegroup.getlocalchangegroupraw(repo, source, outgoing, |
|
1619 | bundlecaps=bundlecaps, | |
|
1620 | 1616 | version=version) |
|
1621 | 1617 | |
|
1622 | 1618 | if cg: |
@@ -113,7 +113,7 b' Create an extension to test bundle2 API' | |||
|
113 | 113 | > headmissing = [c.node() for c in repo.set('heads(%ld)', revs)] |
|
114 | 114 | > headcommon = [c.node() for c in repo.set('parents(%ld) - %ld', revs, revs)] |
|
115 | 115 | > outgoing = discovery.outgoing(repo, headcommon, headmissing) |
|
116 |
> cg = changegroup.getlocalchangegroup(repo, 'test:bundle2', outgoing |
|
|
116 | > cg = changegroup.getlocalchangegroup(repo, 'test:bundle2', outgoing) | |
|
117 | 117 | > bundler.newpart('changegroup', data=cg.getchunks(), |
|
118 | 118 | > mandatory=False) |
|
119 | 119 | > |
@@ -13,13 +13,11 b' Create an extension to test bundle2 with' | |||
|
13 | 13 | > # in 'heads' as intermediate heads for the first changegroup. |
|
14 | 14 | > intermediates = [repo[r].p1().node() for r in heads] |
|
15 | 15 | > outgoing = discovery.outgoing(repo, common, intermediates) |
|
16 |
> cg = changegroup.getchangegroup(repo, source, outgoing |
|
|
17 | > bundlecaps=bundlecaps) | |
|
16 | > cg = changegroup.getchangegroup(repo, source, outgoing) | |
|
18 | 17 | > bundler.newpart('output', data='changegroup1') |
|
19 | 18 | > bundler.newpart('changegroup', data=cg.getchunks()) |
|
20 | 19 | > outgoing = discovery.outgoing(repo, common + intermediates, heads) |
|
21 |
> cg = changegroup.getchangegroup(repo, source, outgoing |
|
|
22 | > bundlecaps=bundlecaps) | |
|
20 | > cg = changegroup.getchangegroup(repo, source, outgoing) | |
|
23 | 21 | > bundler.newpart('output', data='changegroup2') |
|
24 | 22 | > bundler.newpart('changegroup', data=cg.getchunks()) |
|
25 | 23 | > |
General Comments 0
You need to be logged in to leave comments.
Login now