Mercurial > hg > hg-git
changeset 429:6674c0d42d68
Adapt to atomictempfile API changes from Mercurial.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Fri, 09 Sep 2011 16:00:52 -0500 |
parents | b5d6cad20b25 |
children | 7a04853e2587 |
files | hggit/git_handler.py |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -113,7 +113,10 @@ file = self.repo.opener(self.mapfile, 'w+', atomictemp=True) for hgsha, gitsha in sorted(self._map_hg.iteritems()): file.write("%s %s\n" % (gitsha, hgsha)) - file.rename() + # If this complains that NoneType is not callable, then + # atomictempfile no longer has either of rename (pre-1.9) or + # close (post-1.9) + getattr(file, 'rename', getattr(file, 'close', None))() def load_tags(self): self.tags = {} @@ -127,7 +130,10 @@ for name, sha in sorted(self.tags.iteritems()): if not self.repo.tagtype(name) == 'global': file.write("%s %s\n" % (sha, name)) - file.rename() + # If this complains that NoneType is not callable, then + # atomictempfile no longer has either of rename (pre-1.9) or + # close (post-1.9) + getattr(file, 'rename', getattr(file, 'close', None))() ## END FILE LOAD AND SAVE METHODS