Mercurial > hg-stable
changeset 18302:16c642a6f07d
archival: avoid touching deprecated gzip name attribute
The existing workaround didn't work when no filename was specified.
If running in a context with warnings enabled and subsecond mtime it gave a
warning:
DeprecationWarning: use the name attribute
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Thu, 03 Jan 2013 21:07:04 +0100 |
parents | 49ad7030ecc4 |
children | 4d1671b39168 |
files | mercurial/archival.py |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/archival.py Thu Jan 03 21:07:04 2013 +0100 +++ b/mercurial/archival.py Thu Jan 03 21:07:04 2013 +0100 @@ -74,8 +74,11 @@ def _write_gzip_header(self): self.fileobj.write('\037\213') # magic header self.fileobj.write('\010') # compression method - # Python 2.6 deprecates self.filename - fname = getattr(self, 'name', None) or self.filename + # Python 2.6 introduced self.name and deprecated self.filename + try: + fname = self.name + except AttributeError: + fname = self.filename if fname and fname.endswith('.gz'): fname = fname[:-3] flags = 0