Show More
@@ -161,7 +161,7 def makefileobj(repo, pat, node=None, to | |||||
161 |
|
161 | |||
162 | if not pat or pat == '-': |
|
162 | if not pat or pat == '-': | |
163 | fp = writable and repo.ui.fout or repo.ui.fin |
|
163 | fp = writable and repo.ui.fout or repo.ui.fin | |
164 | if hasattr(fp, 'fileno'): |
|
164 | if util.safehasattr(fp, 'fileno'): | |
165 | return os.fdopen(os.dup(fp.fileno()), mode) |
|
165 | return os.fdopen(os.dup(fp.fileno()), mode) | |
166 | else: |
|
166 | else: | |
167 | # if this fp can't be duped properly, return |
|
167 | # if this fp can't be duped properly, return | |
@@ -177,9 +177,9 def makefileobj(repo, pat, node=None, to | |||||
177 | return getattr(self.f, attr) |
|
177 | return getattr(self.f, attr) | |
178 |
|
178 | |||
179 | return wrappedfileobj(fp) |
|
179 | return wrappedfileobj(fp) | |
180 | if hasattr(pat, 'write') and writable: |
|
180 | if util.safehasattr(pat, 'write') and writable: | |
181 | return pat |
|
181 | return pat | |
182 | if hasattr(pat, 'read') and 'r' in mode: |
|
182 | if util.safehasattr(pat, 'read') and 'r' in mode: | |
183 | return pat |
|
183 | return pat | |
184 | return open(makefilename(repo, pat, node, total, seqno, revwidth, |
|
184 | return open(makefilename(repo, pat, node, total, seqno, revwidth, | |
185 | pathname), |
|
185 | pathname), | |
@@ -520,7 +520,7 def export(repo, revs, template='hg-%h.p | |||||
520 | revwidth=revwidth, mode='ab') |
|
520 | revwidth=revwidth, mode='ab') | |
521 | if fp != template: |
|
521 | if fp != template: | |
522 | shouldclose = True |
|
522 | shouldclose = True | |
523 | if fp != sys.stdout and hasattr(fp, 'name'): |
|
523 | if fp != sys.stdout and util.safehasattr(fp, 'name'): | |
524 | repo.ui.note("%s\n" % fp.name) |
|
524 | repo.ui.note("%s\n" % fp.name) | |
525 |
|
525 | |||
526 | fp.write("# HG changeset patch\n") |
|
526 | fp.write("# HG changeset patch\n") |
General Comments 0
You need to be logged in to leave comments.
Login now