changeset 38887:75d6139e69f9

changegroup: move close() from narrow More of the same. Differential Revision: https://phab.mercurial-scm.org/D4064
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 02 Aug 2018 09:52:01 -0700
parents 66cf046ef60f
children c9315bc578bc
files hgext/narrow/narrowchangegroup.py mercurial/changegroup.py
diffstat 2 files changed, 7 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/narrow/narrowchangegroup.py	Thu Aug 02 09:53:22 2018 -0700
+++ b/hgext/narrow/narrowchangegroup.py	Thu Aug 02 09:52:01 2018 -0700
@@ -51,15 +51,6 @@
     extensions.wrapfunction(
         changegroup.cg1packer, 'generatefiles', generatefiles)
 
-    def close(orig, self):
-        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 orig(self)
-    extensions.wrapfunction(changegroup.cg1packer, 'close', close)
-
     # In a perfect world, we'd generate better ellipsis-ified graphs
     # for non-changelog revlogs. In practice, we haven't started doing
     # that yet, so the resulting DAGs for the manifestlog and filelogs
--- a/mercurial/changegroup.py	Thu Aug 02 09:53:22 2018 -0700
+++ b/mercurial/changegroup.py	Thu Aug 02 09:52:01 2018 -0700
@@ -544,6 +544,13 @@
             self._verbosenote = lambda s: None
 
     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
+
         return closechunk()
 
     def fileheader(self, fname):