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