Mercurial > public > mercurial-scm > hg
comparison mercurial/changegroup.py @ 39002:eb8a0139ace3
changegroup: inline _close()
Now that it doesn't clear self._clrevtolocalrev on every invocation
and is a simple one-liner that calls another function, we can
do away with this method and inline its content into all call
sites.
Differential Revision: https://phab.mercurial-scm.org/D4194
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 07 Aug 2018 14:53:42 -0700 |
parents | a6e1ff40e335 |
children | 58377518201c |
comparison
equal
deleted
inserted
replaced
39001:a6e1ff40e335 | 39002:eb8a0139ace3 |
---|---|
656 if self._repo.ui.verbose and not self._repo.ui.debugflag: | 656 if self._repo.ui.verbose and not self._repo.ui.debugflag: |
657 self._verbosenote = self._repo.ui.note | 657 self._verbosenote = self._repo.ui.note |
658 else: | 658 else: |
659 self._verbosenote = lambda s: None | 659 self._verbosenote = lambda s: None |
660 | 660 |
661 def _close(self): | |
662 return closechunk() | |
663 | |
664 def group(self, revs, store, ischangelog, lookup, units=None, | 661 def group(self, revs, store, ischangelog, lookup, units=None, |
665 clrevtolocalrev=None): | 662 clrevtolocalrev=None): |
666 """Calculate a delta group, yielding a sequence of changegroup chunks | 663 """Calculate a delta group, yielding a sequence of changegroup chunks |
667 (strings). | 664 (strings). |
668 | 665 |
676 If units is not None, progress detail will be generated, units specifies | 673 If units is not None, progress detail will be generated, units specifies |
677 the type of revlog that is touched (changelog, manifest, etc.). | 674 the type of revlog that is touched (changelog, manifest, etc.). |
678 """ | 675 """ |
679 # if we don't have any revisions touched by these changesets, bail | 676 # if we don't have any revisions touched by these changesets, bail |
680 if len(revs) == 0: | 677 if len(revs) == 0: |
681 yield self._close() | 678 yield closechunk() |
682 return | 679 return |
683 | 680 |
684 cl = self._repo.changelog | 681 cl = self._repo.changelog |
685 | 682 |
686 # add the parent of the first rev | 683 # add the parent of the first rev |
727 for x in delta.deltachunks: | 724 for x in delta.deltachunks: |
728 yield x | 725 yield x |
729 | 726 |
730 if progress: | 727 if progress: |
731 progress.complete() | 728 progress.complete() |
732 yield self._close() | 729 |
730 yield closechunk() | |
733 | 731 |
734 # filter any nodes that claim to be part of the known set | 732 # filter any nodes that claim to be part of the known set |
735 def _prune(self, store, missing, commonrevs): | 733 def _prune(self, store, missing, commonrevs): |
736 # TODO this violates storage abstraction for manifests. | 734 # TODO this violates storage abstraction for manifests. |
737 if isinstance(store, manifest.manifestrevlog): | 735 if isinstance(store, manifest.manifestrevlog): |
817 for chunk in self.generatefiles(changedfiles, commonrevs, | 815 for chunk in self.generatefiles(changedfiles, commonrevs, |
818 source, mfdicts, fastpathlinkrev, | 816 source, mfdicts, fastpathlinkrev, |
819 fnodes, clrevs): | 817 fnodes, clrevs): |
820 yield chunk | 818 yield chunk |
821 | 819 |
822 yield self._close() | 820 yield closechunk() |
823 | 821 |
824 if clnodes: | 822 if clnodes: |
825 repo.hook('outgoing', node=hex(clnodes[0]), source=source) | 823 repo.hook('outgoing', node=hex(clnodes[0]), source=source) |
826 | 824 |
827 def _generatechangelog(self, cl, nodes): | 825 def _generatechangelog(self, cl, nodes): |