Yuya Nishihara avatar 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.

[1]: http://www.selenic.com/repo/hg/rev/a306837f8c87

Comments (0)

Files changed (1)

tortoisehg/hgqt/repowidget.py

                 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())
             else:
                 revs = self.rev and self.menuselection or None
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.