D4085: changegroup: make some packer attributes private
This revision was automatically updated to reflect the committed changes. Closed by commit rHG68e490ed640e: changegroup: make some packer attributes private (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4085?vs=9847=9961 REVISION DETAIL https://phab.mercurial-scm.org/D4085 AFFECTED FILES mercurial/changegroup.py CHANGE DETAILS diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -575,17 +575,17 @@ else: self._verbosenote = lambda s: None -def close(self): +def _close(self): # Ellipses serving mode. -getattr(self, 'clrev_to_localrev', {}).clear() -if getattr(self, 'next_clrev_to_localrev', {}): -self.clrev_to_localrev = self.next_clrev_to_localrev -del self.next_clrev_to_localrev -self.changelog_done = True +getattr(self, '_clrev_to_localrev', {}).clear() +if getattr(self, '_next_clrev_to_localrev', {}): +self._clrev_to_localrev = self._next_clrev_to_localrev +del self._next_clrev_to_localrev +self._changelog_done = True return closechunk() -def fileheader(self, fname): +def _fileheader(self, fname): return chunkheader(len(fname)) + fname # Extracted both for clarity and for overriding in extensions. @@ -607,8 +607,8 @@ # order that they're introduced in dramatis personae by the # changelog, so what we do is we sort the non-changelog histories # by the order in which they are used by the changelog. -if util.safehasattr(self, 'full_nodes') and self.clnode_to_rev: -key = lambda n: self.clnode_to_rev[lookup(n)] +if util.safehasattr(self, '_full_nodes') and self._clnode_to_rev: +key = lambda n: self._clnode_to_rev[lookup(n)] return [store.rev(n) for n in sorted(nodelist, key=key)] # for generaldelta revlogs, we linearize the revs; this will both be @@ -635,7 +635,7 @@ """ # if we don't have any revisions touched by these changesets, bail if len(nodelist) == 0: -yield self.close() +yield self._close() return revs = self._sortgroup(store, nodelist, lookup) @@ -654,15 +654,15 @@ progress.update(r + 1) prev, curr = revs[r], revs[r + 1] linknode = lookup(store.node(curr)) -for c in self.revchunk(store, curr, prev, linknode): +for c in self._revchunk(store, curr, prev, linknode): yield c if progress: progress.complete() -yield self.close() +yield self._close() # filter any nodes that claim to be part of the known set -def prune(self, store, missing, commonrevs): +def _prune(self, store, missing, commonrevs): # TODO this violates storage abstraction for manifests. if isinstance(store, manifest.manifestrevlog): if not self._filematcher.visitdir(store._dir[:-1] or '.'): @@ -687,7 +687,7 @@ assert self.version == b'03' if dir: -yield self.fileheader(dir) +yield self._fileheader(dir) # TODO violates storage abstractions by assuming revlogs. dirlog = self._repo.manifestlog._revlog.dirlog(dir) @@ -708,7 +708,7 @@ mfrevlog = mfl._revlog changedfiles = set() -ellipsesmode = util.safehasattr(self, 'full_nodes') +ellipsesmode = util.safehasattr(self, '_full_nodes') # Callback for the changelog, used to collect changed files and # manifest nodes. @@ -722,21 +722,21 @@ # end up with bogus linkrevs specified for manifests and # we skip some manifest nodes that we should otherwise # have sent. -if (x in self.full_nodes -or cl.rev(x) in self.precomputed_ellipsis): +if (x in self._full_nodes +or cl.rev(x) in self._precomputed_ellipsis): n = c[0] # Record the first changeset introducing this manifest # version. mfs.setdefault(n, x) # Set this narrow-specific dict so we have the lowest # manifest revnum to look up for this cl revnum. (Part of # mapping changelog ellipsis parents to manifest ellipsis # parents) -self.next_clrev_to_localrev.setdefault(cl.rev(x), - mfrevlog.rev(n)) +self._next_clrev_to_localrev.setdefault(cl.rev(x), +mfrevlog.rev(n)) # We can't trust the changed files list in the
D4085: changegroup: make some packer attributes private
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY These methods and attributes are low level and should not be called or outside outside of instances. Indicate as such through naming. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4085 AFFECTED FILES mercurial/changegroup.py CHANGE DETAILS diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -578,17 +578,17 @@ else: self._verbosenote = lambda s: None -def close(self): +def _close(self): # Ellipses serving mode. -getattr(self, 'clrev_to_localrev', {}).clear() -if getattr(self, 'next_clrev_to_localrev', {}): -self.clrev_to_localrev = self.next_clrev_to_localrev -del self.next_clrev_to_localrev -self.changelog_done = True +getattr(self, '_clrev_to_localrev', {}).clear() +if getattr(self, '_next_clrev_to_localrev', {}): +self._clrev_to_localrev = self._next_clrev_to_localrev +del self._next_clrev_to_localrev +self._changelog_done = True return closechunk() -def fileheader(self, fname): +def _fileheader(self, fname): return chunkheader(len(fname)) + fname # Extracted both for clarity and for overriding in extensions. @@ -610,8 +610,8 @@ # order that they're introduced in dramatis personae by the # changelog, so what we do is we sort the non-changelog histories # by the order in which they are used by the changelog. -if util.safehasattr(self, 'full_nodes') and self.clnode_to_rev: -key = lambda n: self.clnode_to_rev[lookup(n)] +if util.safehasattr(self, '_full_nodes') and self._clnode_to_rev: +key = lambda n: self._clnode_to_rev[lookup(n)] return [store.rev(n) for n in sorted(nodelist, key=key)] # for generaldelta revlogs, we linearize the revs; this will both be @@ -638,7 +638,7 @@ """ # if we don't have any revisions touched by these changesets, bail if len(nodelist) == 0: -yield self.close() +yield self._close() return revs = self._sortgroup(store, nodelist, lookup) @@ -657,15 +657,15 @@ progress.update(r + 1) prev, curr = revs[r], revs[r + 1] linknode = lookup(store.node(curr)) -for c in self.revchunk(store, curr, prev, linknode): +for c in self._revchunk(store, curr, prev, linknode): yield c if progress: progress.complete() -yield self.close() +yield self._close() # filter any nodes that claim to be part of the known set -def prune(self, store, missing, commonrevs): +def _prune(self, store, missing, commonrevs): # TODO this violates storage abstraction for manifests. if isinstance(store, manifest.manifestrevlog): if not self._filematcher.visitdir(store._dir[:-1] or '.'): @@ -690,7 +690,7 @@ assert self.version == b'03' if dir: -yield self.fileheader(dir) +yield self._fileheader(dir) # TODO violates storage abstractions by assuming revlogs. dirlog = self._repo.manifestlog._revlog.dirlog(dir) @@ -711,7 +711,7 @@ mfrevlog = mfl._revlog changedfiles = set() -ellipsesmode = util.safehasattr(self, 'full_nodes') +ellipsesmode = util.safehasattr(self, '_full_nodes') # Callback for the changelog, used to collect changed files and # manifest nodes. @@ -725,21 +725,21 @@ # end up with bogus linkrevs specified for manifests and # we skip some manifest nodes that we should otherwise # have sent. -if (x in self.full_nodes -or cl.rev(x) in self.precomputed_ellipsis): +if (x in self._full_nodes +or cl.rev(x) in self._precomputed_ellipsis): n = c[0] # Record the first changeset introducing this manifest # version. mfs.setdefault(n, x) # Set this narrow-specific dict so we have the lowest # manifest revnum to look up for this cl revnum. (Part of # mapping changelog ellipsis parents to manifest ellipsis # parents) -self.next_clrev_to_localrev.setdefault(cl.rev(x), - mfrevlog.rev(n)) +self._next_clrev_to_localrev.setdefault(cl.rev(x), +mfrevlog.rev(n)) # We can't trust the changed files list in the