# HG changeset patch # User Mads Kiilerich # Date 2013-01-03 20:07:04 # Node ID 16c642a6f07d1d4ba5ab325323ed1b58c6b27224 # Parent 49ad7030ecc4fb57a5e56530fa308ead8680ffcd 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 diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -74,8 +74,11 @@ class tarit(object): 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