Yuya Nishihara  committed 28b1fab

copypatch: have dummy Writable object acts like a string (fixes #2280)

Since Mercurial 2.4, output (=template) parameter must be string [1].
We can simply pass output='' for 2.4, but Mercurial 2.3 still requires
dummy file-like object.
As a workaround, this implements len(writable), so that it can bypass
`len(template) > 0` of cmdutil.export().

I'll write another patch for default branch, which should take away dummy
Writable hack.


  • Participants
  • Parent commits 22ada7f
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/

                 class Writable(object):
                     def write(self, *args, **opts): _ui.write(*args, **opts)
                     def close(self): pass
+                    def __len__(self): return 0
                 commands.export(_ui, self.repo, self.rev, output=Writable())
                 revs = self.rev and self.menuselection or None