##// END OF EJS Templates
perf-bundle: accept --type argument
marmoute -
r50308:b380583a default
parent child Browse files
Show More
@@ -984,6 +984,13 b' def perfbookmarks(ui, repo, **opts):'
984 b'changesets to bundle',
984 b'changesets to bundle',
985 b'REV',
985 b'REV',
986 ),
986 ),
987 (
988 b't',
989 b'type',
990 b'none',
991 b'bundlespec to use (see `hg help bundlespec`)',
992 b'TYPE',
993 ),
987 ]
994 ]
988 + formatteropts,
995 + formatteropts,
989 b'REVS',
996 b'REVS',
@@ -991,7 +998,7 b' def perfbookmarks(ui, repo, **opts):'
991 def perfbundle(ui, repo, *revs, **opts):
998 def perfbundle(ui, repo, *revs, **opts):
992 """benchmark the creation of a bundle from a repository
999 """benchmark the creation of a bundle from a repository
993
1000
994 For now, this create a `none-v1` bundle.
1001 For now, this only supports "none" compression.
995 """
1002 """
996 from mercurial import bundlecaches
1003 from mercurial import bundlecaches
997 from mercurial import discovery
1004 from mercurial import discovery
@@ -1018,11 +1025,31 b' def perfbundle(ui, repo, *revs, **opts):'
1018 bases = [cl.node(r) for r in repo.revs(b"heads(::%ld - %ld)", revs, revs)]
1025 bases = [cl.node(r) for r in repo.revs(b"heads(::%ld - %ld)", revs, revs)]
1019 outgoing = discovery.outgoing(repo, bases, targets)
1026 outgoing = discovery.outgoing(repo, bases, targets)
1020
1027
1021 bundlespec = bundlecaches.parsebundlespec(
1028 bundle_spec = opts.get(b'type')
1022 repo, b"none", strict=False
1029
1023 )
1030 bundle_spec = bundlecaches.parsebundlespec(repo, bundle_spec, strict=False)
1024
1031
1025 bversion = b'HG10' + bundlespec.wirecompression
1032 cgversion = bundle_spec.params[b"cg.version"]
1033 if cgversion not in changegroup.supportedoutgoingversions(repo):
1034 err = b"repository does not support bundle version %s"
1035 raise error.Abort(err % cgversion)
1036
1037 if cgversion == b'01': # bundle1
1038 bversion = b'HG10' + bundle_spec.wirecompression
1039 bcompression = None
1040 elif cgversion in (b'02', b'03'):
1041 bversion = b'HG20'
1042 bcompression = bundle_spec.wirecompression
1043 else:
1044 err = b'perf::bundle: unexpected changegroup version %s'
1045 raise error.ProgrammingError(err % cgversion)
1046
1047 if bcompression is None:
1048 bcompression = b'UN'
1049
1050 if bcompression != b'UN':
1051 err = b'perf::bundle: compression currently unsupported: %s'
1052 raise error.ProgrammingError(err % bcompression)
1026
1053
1027 def do_bundle():
1054 def do_bundle():
1028 bundle2.writenewbundle(
1055 bundle2.writenewbundle(
@@ -1032,7 +1059,7 b' def perfbundle(ui, repo, *revs, **opts):'
1032 os.devnull,
1059 os.devnull,
1033 bversion,
1060 bversion,
1034 outgoing,
1061 outgoing,
1035 {},
1062 bundle_spec.params,
1036 )
1063 )
1037
1064
1038 timer(do_bundle)
1065 timer(do_bundle)
@@ -1484,7 +1484,6 b' def branches(ui, repo, active=False, clo'
1484 @command(
1484 @command(
1485 b'bundle',
1485 b'bundle',
1486 [
1486 [
1487
1488 (
1487 (
1489 b'',
1488 b'',
1490 b'exact',
1489 b'exact',
General Comments 0
You need to be logged in to leave comments. Login now