comparison mercurial/wireprotov2server.py @ 45942:89a2afe31e82

formating: upgrade to black 20.8b1 This required a couple of small tweaks to un-confuse black, but now it works. Big formatting changes come from: * Dramatically improved collection-splitting logic upstream * Black having a strong (correct IMO) opinion that """ is better than ''' Differential Revision: https://phab.mercurial-scm.org/D9430
author Augie Fackler <raf@durin42.com>
date Fri, 27 Nov 2020 17:03:29 -0500
parents a61287a95dc3
children 14ff4929ca8c
comparison
equal deleted inserted replaced
45941:346af7687c6f 45942:89a2afe31e82
980 b'changesetdata', 980 b'changesetdata',
981 args={ 981 args={
982 b'revisions': { 982 b'revisions': {
983 b'type': b'list', 983 b'type': b'list',
984 b'example': [ 984 b'example': [
985 {b'type': b'changesetexplicit', b'nodes': [b'abcdef...'],} 985 {
986 b'type': b'changesetexplicit',
987 b'nodes': [b'abcdef...'],
988 }
986 ], 989 ],
987 }, 990 },
988 b'fields': { 991 b'fields': {
989 b'type': b'set', 992 b'type': b'set',
990 b'default': set, 993 b'default': set,
1164 b'haveparents': { 1167 b'haveparents': {
1165 b'type': b'bool', 1168 b'type': b'bool',
1166 b'default': lambda: False, 1169 b'default': lambda: False,
1167 b'example': True, 1170 b'example': True,
1168 }, 1171 },
1169 b'nodes': {b'type': b'list', b'example': [b'0123456...'],}, 1172 b'nodes': {
1173 b'type': b'list',
1174 b'example': [b'0123456...'],
1175 },
1170 b'fields': { 1176 b'fields': {
1171 b'type': b'set', 1177 b'type': b'set',
1172 b'default': set, 1178 b'default': set,
1173 b'example': {b'parents', b'revision'}, 1179 b'example': {b'parents', b'revision'},
1174 b'validvalues': {b'parents', b'revision', b'linknode'}, 1180 b'validvalues': {b'parents', b'revision', b'linknode'},
1175 }, 1181 },
1176 b'path': {b'type': b'bytes', b'example': b'foo.txt',}, 1182 b'path': {
1183 b'type': b'bytes',
1184 b'example': b'foo.txt',
1185 },
1177 }, 1186 },
1178 permission=b'pull', 1187 permission=b'pull',
1179 # TODO censoring a file revision won't invalidate the cache. 1188 # TODO censoring a file revision won't invalidate the cache.
1180 # Figure out a way to take censoring into account when deriving 1189 # Figure out a way to take censoring into account when deriving
1181 # the cache key. 1190 # the cache key.
1260 b'example': {b'include': [b'path:tests']}, 1269 b'example': {b'include': [b'path:tests']},
1261 }, 1270 },
1262 b'revisions': { 1271 b'revisions': {
1263 b'type': b'list', 1272 b'type': b'list',
1264 b'example': [ 1273 b'example': [
1265 {b'type': b'changesetexplicit', b'nodes': [b'abcdef...'],} 1274 {
1275 b'type': b'changesetexplicit',
1276 b'nodes': [b'abcdef...'],
1277 }
1266 ], 1278 ],
1267 }, 1279 },
1268 }, 1280 },
1269 permission=b'pull', 1281 permission=b'pull',
1270 # TODO censoring a file revision won't invalidate the cache. 1282 # TODO censoring a file revision won't invalidate the cache.
1373 yield result 1385 yield result
1374 1386
1375 1387
1376 @wireprotocommand( 1388 @wireprotocommand(
1377 b'listkeys', 1389 b'listkeys',
1378 args={b'namespace': {b'type': b'bytes', b'example': b'ns',},}, 1390 args={
1391 b'namespace': {
1392 b'type': b'bytes',
1393 b'example': b'ns',
1394 },
1395 },
1379 permission=b'pull', 1396 permission=b'pull',
1380 ) 1397 )
1381 def listkeysv2(repo, proto, namespace): 1398 def listkeysv2(repo, proto, namespace):
1382 keys = repo.listkeys(encoding.tolocal(namespace)) 1399 keys = repo.listkeys(encoding.tolocal(namespace))
1383 keys = { 1400 keys = {
1388 yield keys 1405 yield keys
1389 1406
1390 1407
1391 @wireprotocommand( 1408 @wireprotocommand(
1392 b'lookup', 1409 b'lookup',
1393 args={b'key': {b'type': b'bytes', b'example': b'foo',},}, 1410 args={
1411 b'key': {
1412 b'type': b'bytes',
1413 b'example': b'foo',
1414 },
1415 },
1394 permission=b'pull', 1416 permission=b'pull',
1395 ) 1417 )
1396 def lookupv2(repo, proto, key): 1418 def lookupv2(repo, proto, key):
1397 key = encoding.tolocal(key) 1419 key = encoding.tolocal(key)
1398 1420
1413 1435
1414 1436
1415 @wireprotocommand( 1437 @wireprotocommand(
1416 b'manifestdata', 1438 b'manifestdata',
1417 args={ 1439 args={
1418 b'nodes': {b'type': b'list', b'example': [b'0123456...'],}, 1440 b'nodes': {
1441 b'type': b'list',
1442 b'example': [b'0123456...'],
1443 },
1419 b'haveparents': { 1444 b'haveparents': {
1420 b'type': b'bool', 1445 b'type': b'bool',
1421 b'default': lambda: False, 1446 b'default': lambda: False,
1422 b'example': True, 1447 b'example': True,
1423 }, 1448 },
1425 b'type': b'set', 1450 b'type': b'set',
1426 b'default': set, 1451 b'default': set,
1427 b'example': {b'parents', b'revision'}, 1452 b'example': {b'parents', b'revision'},
1428 b'validvalues': {b'parents', b'revision'}, 1453 b'validvalues': {b'parents', b'revision'},
1429 }, 1454 },
1430 b'tree': {b'type': b'bytes', b'example': b'',}, 1455 b'tree': {
1456 b'type': b'bytes',
1457 b'example': b'',
1458 },
1431 }, 1459 },
1432 permission=b'pull', 1460 permission=b'pull',
1433 cachekeyfn=makecommandcachekeyfn(b'manifestdata', 1, allargs=True), 1461 cachekeyfn=makecommandcachekeyfn(b'manifestdata', 1, allargs=True),
1434 extracapabilitiesfn=manifestdatacapabilities, 1462 extracapabilitiesfn=manifestdatacapabilities,
1435 ) 1463 )
1483 1511
1484 1512
1485 @wireprotocommand( 1513 @wireprotocommand(
1486 b'pushkey', 1514 b'pushkey',
1487 args={ 1515 args={
1488 b'namespace': {b'type': b'bytes', b'example': b'ns',}, 1516 b'namespace': {
1489 b'key': {b'type': b'bytes', b'example': b'key',}, 1517 b'type': b'bytes',
1490 b'old': {b'type': b'bytes', b'example': b'old',}, 1518 b'example': b'ns',
1491 b'new': {b'type': b'bytes', b'example': b'new',}, 1519 },
1520 b'key': {
1521 b'type': b'bytes',
1522 b'example': b'key',
1523 },
1524 b'old': {
1525 b'type': b'bytes',
1526 b'example': b'old',
1527 },
1528 b'new': {
1529 b'type': b'bytes',
1530 b'example': b'new',
1531 },
1492 }, 1532 },
1493 permission=b'push', 1533 permission=b'push',
1494 ) 1534 )
1495 def pushkeyv2(repo, proto, namespace, key, old, new): 1535 def pushkeyv2(repo, proto, namespace, key, old, new):
1496 # TODO handle ui output redirection 1536 # TODO handle ui output redirection