Catch an AttributeError in wwrite triggered by older Hg versions kwmap-templates
authorChristian Ebert <blacktrash@gmx.net>
Wed, 18 Jul 2007 21:24:04 +0200
branchkwmap-templates
changeset 188 c5e1a361d009
parent 187 a01a0392f648
child 189 247159261ba5
Catch an AttributeError in wwrite triggered by older Hg versions Thanks to Norman Walsh for reporting.
hgkw/keyword.py
--- a/hgkw/keyword.py	Wed Jul 18 16:17:04 2007 +0200
+++ b/hgkw/keyword.py	Wed Jul 18 21:24:04 2007 +0200
@@ -213,7 +213,11 @@
             data, cnt = fp.read(man[f])
             if cnt:
                 notify(_('overwriting %s %s keywords\n') % (f, action))
-                self.repo.wwrite(f, data, man.flags(f))
+                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)
                 files.append(f)
         if files:
             self.repo.dirstate.update(files, 'n')