Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/wireproto.py @ 21024:7731a2281cf0
spelling: fixes from spell checker
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Sun, 13 Apr 2014 19:01:00 +0200 |
parents | 7a679918ee2b |
children | 7ca4f2049d3b |
comparison
equal
deleted
inserted
replaced
21023:57b50abe2b24 | 21024:7731a2281cf0 |
---|---|
391 def _callcompressable(self, cmd, **args): | 391 def _callcompressable(self, cmd, **args): |
392 """execute <cmd> on the server | 392 """execute <cmd> on the server |
393 | 393 |
394 The command is expected to return a stream. | 394 The command is expected to return a stream. |
395 | 395 |
396 The stream may have been compressed in some implementaitons. This | 396 The stream may have been compressed in some implementations. This |
397 function takes care of the decompression. This is the only difference | 397 function takes care of the decompression. This is the only difference |
398 with _callstream. | 398 with _callstream. |
399 | 399 |
400 returns the server reply as a file like object. | 400 returns the server reply as a file like object. |
401 """ | 401 """ |
473 | 473 |
474 # list of commands | 474 # list of commands |
475 commands = {} | 475 commands = {} |
476 | 476 |
477 def wireprotocommand(name, args=''): | 477 def wireprotocommand(name, args=''): |
478 """decorator for wireprotocol command""" | 478 """decorator for wire protocol command""" |
479 def register(func): | 479 def register(func): |
480 commands[name] = (func, args) | 480 commands[name] = (func, args) |
481 return func | 481 return func |
482 return register | 482 return register |
483 | 483 |
549 This function exists to allow extensions to easily wrap capabilities | 549 This function exists to allow extensions to easily wrap capabilities |
550 computation | 550 computation |
551 | 551 |
552 - returns a lists: easy to alter | 552 - returns a lists: easy to alter |
553 - change done here will be propagated to both `capabilities` and `hello` | 553 - change done here will be propagated to both `capabilities` and `hello` |
554 command without any other effort. without any other action needed. | 554 command without any other action needed. |
555 """ | 555 """ |
556 # copy to prevent modification of the global list | 556 # copy to prevent modification of the global list |
557 caps = list(wireprotocaps) | 557 caps = list(wireprotocaps) |
558 if _allowstream(repo.ui): | 558 if _allowstream(repo.ui): |
559 if repo.ui.configbool('server', 'preferuncompressed', False): | 559 if repo.ui.configbool('server', 'preferuncompressed', False): |
567 caps.append('streamreqs=%s' % ','.join(requiredformats)) | 567 caps.append('streamreqs=%s' % ','.join(requiredformats)) |
568 caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority)) | 568 caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority)) |
569 caps.append('httpheader=1024') | 569 caps.append('httpheader=1024') |
570 return caps | 570 return caps |
571 | 571 |
572 # If you are writting and extension and consider wrapping this function. Wrap | 572 # If you are writing an extension and consider wrapping this function. Wrap |
573 # `_capabilities` instead. | 573 # `_capabilities` instead. |
574 @wireprotocommand('capabilities') | 574 @wireprotocommand('capabilities') |
575 def capabilities(repo, proto): | 575 def capabilities(repo, proto): |
576 return ' '.join(_capabilities(repo, proto)) | 576 return ' '.join(_capabilities(repo, proto)) |
577 | 577 |
690 it is serving. Client checks to see if it understands the format. | 690 it is serving. Client checks to see if it understands the format. |
691 | 691 |
692 The format is simple: the server writes out a line with the amount | 692 The format is simple: the server writes out a line with the amount |
693 of files, then the total amount of bytes to be transferred (separated | 693 of files, then the total amount of bytes to be transferred (separated |
694 by a space). Then, for each file, the server first writes the filename | 694 by a space). Then, for each file, the server first writes the filename |
695 and filesize (separated by the null character), then the file contents. | 695 and file size (separated by the null character), then the file contents. |
696 ''' | 696 ''' |
697 | 697 |
698 if not _allowstream(repo.ui): | 698 if not _allowstream(repo.ui): |
699 return '1\n' | 699 return '1\n' |
700 | 700 |
774 finally: | 774 finally: |
775 fp.close() | 775 fp.close() |
776 os.unlink(tempname) | 776 os.unlink(tempname) |
777 except util.Abort, inst: | 777 except util.Abort, inst: |
778 # The old code we moved used sys.stderr directly. | 778 # The old code we moved used sys.stderr directly. |
779 # We did not changed it to minise code change. | 779 # We did not change it to minimise code change. |
780 # This need to be moved to something proper. | 780 # This need to be moved to something proper. |
781 # Feel free to do it. | 781 # Feel free to do it. |
782 sys.stderr.write("abort: %s\n" % inst) | 782 sys.stderr.write("abort: %s\n" % inst) |
783 return pushres(0) | 783 return pushres(0) |
784 except exchange.PushRaced, exc: | 784 except exchange.PushRaced, exc: |