Show More
@@ -1242,7 +1242,8 b' def getrepocaps(repo, allowpushback=Fals' | |||||
1242 | Exists to allow extensions (like evolution) to mutate the capabilities. |
|
1242 | Exists to allow extensions (like evolution) to mutate the capabilities. | |
1243 | """ |
|
1243 | """ | |
1244 | caps = capabilities.copy() |
|
1244 | caps = capabilities.copy() | |
1245 |
caps['changegroup'] = tuple(sorted( |
|
1245 | caps['changegroup'] = tuple(sorted( | |
|
1246 | changegroup.supportedincomingversions(repo))) | |||
1246 | if obsolete.isenabled(repo, obsolete.exchangeopt): |
|
1247 | if obsolete.isenabled(repo, obsolete.exchangeopt): | |
1247 | supportedformat = tuple('V%i' % v for v in obsolete.formats) |
|
1248 | supportedformat = tuple('V%i' % v for v in obsolete.formats) | |
1248 | caps['obsmarkers'] = supportedformat |
|
1249 | caps['obsmarkers'] = supportedformat |
@@ -282,7 +282,7 b' class bundlerepository(localrepo.localre' | |||||
282 | "multiple changegroups") |
|
282 | "multiple changegroups") | |
283 | cgstream = part |
|
283 | cgstream = part | |
284 | version = part.params.get('version', '01') |
|
284 | version = part.params.get('version', '01') | |
285 |
if version not in changegroup.supportedversions( |
|
285 | if version not in changegroup.allsupportedversions(ui): | |
286 | msg = _('Unsupported changegroup version: %s') |
|
286 | msg = _('Unsupported changegroup version: %s') | |
287 | raise error.Abort(msg % version) |
|
287 | raise error.Abort(msg % version) | |
288 | if self.bundle.compressed(): |
|
288 | if self.bundle.compressed(): |
@@ -949,10 +949,25 b' class cg3packer(cg2packer):' | |||||
949 | '03': (cg3packer, cg3unpacker), |
|
949 | '03': (cg3packer, cg3unpacker), | |
950 | } |
|
950 | } | |
951 |
|
951 | |||
952 |
def supportedversions( |
|
952 | def allsupportedversions(ui): | |
953 | versions = set(_packermap.keys()) |
|
953 | versions = set(_packermap.keys()) | |
954 | if ('treemanifest' in repo.requirements or |
|
954 | versions.discard('03') | |
955 |
|
|
955 | if (ui.configbool('experimental', 'changegroup3') or | |
|
956 | ui.configbool('experimental', 'treemanifest')): | |||
|
957 | versions.add('03') | |||
|
958 | return versions | |||
|
959 | ||||
|
960 | # Changegroup versions that can be applied to the repo | |||
|
961 | def supportedincomingversions(repo): | |||
|
962 | versions = allsupportedversions(repo.ui) | |||
|
963 | if 'treemanifest' in repo.requirements: | |||
|
964 | versions.add('03') | |||
|
965 | return versions | |||
|
966 | ||||
|
967 | # Changegroup versions that can be created from the repo | |||
|
968 | def supportedoutgoingversions(repo): | |||
|
969 | versions = allsupportedversions(repo.ui) | |||
|
970 | if 'treemanifest' in repo.requirements: | |||
956 | # Versions 01 and 02 support only flat manifests and it's just too |
|
971 | # Versions 01 and 02 support only flat manifests and it's just too | |
957 | # expensive to convert between the flat manifest and tree manifest on |
|
972 | # expensive to convert between the flat manifest and tree manifest on | |
958 | # the fly. Since tree manifests are hashed differently, all of history |
|
973 | # the fly. Since tree manifests are hashed differently, all of history | |
@@ -960,22 +975,21 b' def supportedversions(repo):' | |||||
960 | # support versions 01 and 02. |
|
975 | # support versions 01 and 02. | |
961 | versions.discard('01') |
|
976 | versions.discard('01') | |
962 | versions.discard('02') |
|
977 | versions.discard('02') | |
963 | elif not repo.ui.configbool('experimental', 'changegroup3'): |
|
978 | versions.add('03') | |
964 | versions.discard('03') |
|
|||
965 | return versions |
|
979 | return versions | |
966 |
|
980 | |||
967 | def safeversion(repo): |
|
981 | def safeversion(repo): | |
968 | # Finds the smallest version that it's safe to assume clients of the repo |
|
982 | # Finds the smallest version that it's safe to assume clients of the repo | |
969 | # will support. For example, all hg versions that support generaldelta also |
|
983 | # will support. For example, all hg versions that support generaldelta also | |
970 | # support changegroup 02. |
|
984 | # support changegroup 02. | |
971 | versions = supportedversions(repo) |
|
985 | versions = supportedoutgoingversions(repo) | |
972 | if 'generaldelta' in repo.requirements: |
|
986 | if 'generaldelta' in repo.requirements: | |
973 | versions.discard('01') |
|
987 | versions.discard('01') | |
974 | assert versions |
|
988 | assert versions | |
975 | return min(versions) |
|
989 | return min(versions) | |
976 |
|
990 | |||
977 | def getbundler(version, repo, bundlecaps=None): |
|
991 | def getbundler(version, repo, bundlecaps=None): | |
978 | assert version in supportedversions(repo) |
|
992 | assert version in supportedoutgoingversions(repo) | |
979 | return _packermap[version][0](repo, bundlecaps) |
|
993 | return _packermap[version][0](repo, bundlecaps) | |
980 |
|
994 | |||
981 | def getunbundler(version, fh, alg): |
|
995 | def getunbundler(version, fh, alg): |
@@ -707,7 +707,8 b' def _pushb2ctx(pushop, bundler):' | |||||
707 | pushop.outgoing) |
|
707 | pushop.outgoing) | |
708 | else: |
|
708 | else: | |
709 | cgversions = [v for v in cgversions |
|
709 | cgversions = [v for v in cgversions | |
710 |
if v in changegroup.supportedversions( |
|
710 | if v in changegroup.supportedoutgoingversions( | |
|
711 | pushop.repo)] | |||
711 | if not cgversions: |
|
712 | if not cgversions: | |
712 | raise ValueError(_('no common changegroup version')) |
|
713 | raise ValueError(_('no common changegroup version')) | |
713 | version = max(cgversions) |
|
714 | version = max(cgversions) | |
@@ -1562,7 +1563,7 b' def _getbundlechangegrouppart(bundler, r' | |||||
1562 | getcgkwargs = {} |
|
1563 | getcgkwargs = {} | |
1563 | if cgversions: # 3.1 and 3.2 ship with an empty value |
|
1564 | if cgversions: # 3.1 and 3.2 ship with an empty value | |
1564 | cgversions = [v for v in cgversions |
|
1565 | cgversions = [v for v in cgversions | |
1565 | if v in changegroup.supportedversions(repo)] |
|
1566 | if v in changegroup.supportedoutgoingversions(repo)] | |
1566 | if not cgversions: |
|
1567 | if not cgversions: | |
1567 | raise ValueError(_('no common changegroup version')) |
|
1568 | raise ValueError(_('no common changegroup version')) | |
1568 | version = getcgkwargs['version'] = max(cgversions) |
|
1569 | version = getcgkwargs['version'] = max(cgversions) |
@@ -1,6 +1,8 b'' | |||||
1 | $ cat << EOF >> $HGRCPATH |
|
1 | $ cat << EOF >> $HGRCPATH | |
2 | > [format] |
|
2 | > [format] | |
3 | > usegeneraldelta=yes |
|
3 | > usegeneraldelta=yes | |
|
4 | > [ui] | |||
|
5 | > ssh=python "$TESTDIR/dummyssh" | |||
4 | > EOF |
|
6 | > EOF | |
5 |
|
7 | |||
6 | Set up repo |
|
8 | Set up repo | |
@@ -203,15 +205,18 b' Create a few commits with flat manifest' | |||||
203 | (branch merge, don't forget to commit) |
|
205 | (branch merge, don't forget to commit) | |
204 | $ hg ci -m 'merge of flat manifests to new flat manifest' |
|
206 | $ hg ci -m 'merge of flat manifests to new flat manifest' | |
205 |
|
207 | |||
|
208 | $ hg serve -p $HGPORT -d --pid-file=hg.pid --errorlog=errors.log | |||
|
209 | $ cat hg.pid >> $DAEMON_PIDS | |||
|
210 | ||||
206 | Create clone with tree manifests enabled |
|
211 | Create clone with tree manifests enabled | |
207 |
|
212 | |||
208 | $ cd .. |
|
213 | $ cd .. | |
209 |
$ hg clone -- |
|
214 | $ hg clone --config experimental.treemanifest=1 \ | |
210 | requesting all changes |
|
215 | > http://localhost:$HGPORT repo-mixed -r 1 | |
211 | adding changesets |
|
216 | adding changesets | |
212 | adding manifests |
|
217 | adding manifests | |
213 | adding file changes |
|
218 | adding file changes | |
214 |
added |
|
219 | added 2 changesets with 14 changes to 11 files | |
215 | updating to branch default |
|
220 | updating to branch default | |
216 | 11 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
221 | 11 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
217 | $ cd repo-mixed |
|
222 | $ cd repo-mixed | |
@@ -220,10 +225,20 b' Create clone with tree manifests enabled' | |||||
220 | $ grep treemanifest .hg/requires |
|
225 | $ grep treemanifest .hg/requires | |
221 | treemanifest |
|
226 | treemanifest | |
222 |
|
227 | |||
|
228 | Should be possible to push updates from flat to tree manifest repo | |||
|
229 | ||||
|
230 | $ hg -R ../repo-flat push ssh://user@dummy/repo-mixed | |||
|
231 | pushing to ssh://user@dummy/repo-mixed | |||
|
232 | searching for changes | |||
|
233 | remote: adding changesets | |||
|
234 | remote: adding manifests | |||
|
235 | remote: adding file changes | |||
|
236 | remote: added 2 changesets with 3 changes to 3 files | |||
|
237 | ||||
223 | Commit should store revlog per directory |
|
238 | Commit should store revlog per directory | |
224 |
|
239 | |||
225 | $ hg co 1 |
|
240 | $ hg co 1 | |
226 |
|
|
241 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
227 | $ echo 3 > a |
|
242 | $ echo 3 > a | |
228 | $ echo 3 > dir1/a |
|
243 | $ echo 3 > dir1/a | |
229 | $ echo 3 > dir1/dir1/a |
|
244 | $ echo 3 > dir1/dir1/a | |
@@ -456,13 +471,13 b' Add some more changes to the deep repo' | |||||
456 | $ hg ci -m troz |
|
471 | $ hg ci -m troz | |
457 |
|
472 | |||
458 | Test cloning a treemanifest repo over http. |
|
473 | Test cloning a treemanifest repo over http. | |
459 | $ hg serve -p $HGPORT -d --pid-file=hg.pid --errorlog=errors.log |
|
474 | $ hg serve -p $HGPORT2 -d --pid-file=hg.pid --errorlog=errors.log | |
460 | $ cat hg.pid >> $DAEMON_PIDS |
|
475 | $ cat hg.pid >> $DAEMON_PIDS | |
461 | $ cd .. |
|
476 | $ cd .. | |
462 | We can clone even with the knob turned off and we'll get a treemanifest repo. |
|
477 | We can clone even with the knob turned off and we'll get a treemanifest repo. | |
463 | $ hg clone --config experimental.treemanifest=False \ |
|
478 | $ hg clone --config experimental.treemanifest=False \ | |
464 | > --config experimental.changegroup3=True \ |
|
479 | > --config experimental.changegroup3=True \ | |
465 | > http://localhost:$HGPORT deepclone |
|
480 | > http://localhost:$HGPORT2 deepclone | |
466 | requesting all changes |
|
481 | requesting all changes | |
467 | adding changesets |
|
482 | adding changesets | |
468 | adding manifests |
|
483 | adding manifests |
General Comments 0
You need to be logged in to leave comments.
Login now