[PATCH 1 of 4] patchbomb: move exportee class to top level

Peter Arrenbrecht peter.arrenbrecht at gmail.com
Thu Nov 6 08:36:11 CST 2008


# HG changeset patch
# User Peter Arrenbrecht <peter.arrenbrecht at gmail.com>
# Date 1225981603 -3600
patchbomb: move exportee class to top level

As suggested by djc.

diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -68,6 +68,19 @@
 from mercurial.i18n import _
 from mercurial.node import bin
 
+class exportee:
+    def __init__(self, container):
+        self.lines = []
+        self.container = container
+        self.name = 'email'
+
+    def write(self, data):
+        self.lines.append(data)
+
+    def close(self):
+        self.container.append(''.join(self.lines).split('\n'))
+        self.lines = []
+
 def patchbomb(ui, repo, *revs, **opts):
     '''send changesets by email
 
@@ -287,20 +300,6 @@
 
     def getexportmsgs():
         patches = []
-
-        class exportee:
-            def __init__(self, container):
-                self.lines = []
-                self.container = container
-                self.name = 'email'
-
-            def write(self, data):
-                self.lines.append(data)
-
-            def close(self):
-                self.container.append(''.join(self.lines).split('\n'))
-                self.lines = []
-
         commands.export(ui, repo, *revs, **{'output': exportee(patches),
                                             'switch_parent': False,
                                             'text': None,


More information about the Mercurial-devel mailing list