hgkw/keyword.py
changeset 234 6f1ed470541c
parent 233 e60fdc1990e3
child 235 baef9dcfb219
--- a/hgkw/keyword.py	Sun Sep 02 15:01:51 2007 +0200
+++ b/hgkw/keyword.py	Sun Sep 02 15:09:56 2007 +0200
@@ -189,6 +189,14 @@
             return cmdutil.changeset_templater(self.ui, self.repo,
                                                False, None, '', False)
 
+    def _wwrite(self, f, data, man):
+        '''Makes repo.wwrite backwards compatible.'''
+        try:
+            self.repo.wwrite(f, data, man.flags(f))
+        except AttributeError:
+            # older versions want file descriptor as 3. optional arg
+            self.repo.wwrite(f, data)
+
     def _ctxnode(self, node):
         '''Obtains missing node from file context.'''
         if not self.node:
@@ -241,11 +249,7 @@
             data, kwfound = fp.read(man[f])
             if kwfound:
                 notify(_('overwriting %s %s keywords\n') % (f, action))
-                try:
-                    self.repo.wwrite(f, data, man.flags(f))
-                except AttributeError:
-                    # older versions want file descriptor as 3. optional arg
-                    self.repo.wwrite(f, data)
+                self._wwrite(f, data, man)
                 overwritten.append(f)
         if overwritten:
             try: