Mercurial > public > mercurial-scm > hg
comparison mercurial/subrepo.py @ 50925:d718eddf01d9
safehasattr: drop usage in favor of hasattr
The two functions should now be equivalent at least in their usage in core.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 31 Aug 2023 23:56:15 +0200 |
parents | 2264e775512b |
children | 493034cc3265 |
comparison
equal
deleted
inserted
replaced
50924:7a8ea1397816 | 50925:d718eddf01d9 |
---|---|
1134 # instead of being per-command, but we need to support 1.4 so | 1134 # instead of being per-command, but we need to support 1.4 so |
1135 # we have to be intelligent about what commands take | 1135 # we have to be intelligent about what commands take |
1136 # --non-interactive. | 1136 # --non-interactive. |
1137 if commands[0] in (b'update', b'checkout', b'commit'): | 1137 if commands[0] in (b'update', b'checkout', b'commit'): |
1138 cmd.append(b'--non-interactive') | 1138 cmd.append(b'--non-interactive') |
1139 if util.safehasattr(subprocess, 'CREATE_NO_WINDOW'): | 1139 if hasattr(subprocess, 'CREATE_NO_WINDOW'): |
1140 # On Windows, prevent command prompts windows from popping up when | 1140 # On Windows, prevent command prompts windows from popping up when |
1141 # running in pythonw. | 1141 # running in pythonw. |
1142 extrakw['creationflags'] = getattr(subprocess, 'CREATE_NO_WINDOW') | 1142 extrakw['creationflags'] = getattr(subprocess, 'CREATE_NO_WINDOW') |
1143 cmd.extend(commands) | 1143 cmd.extend(commands) |
1144 if filename is not None: | 1144 if filename is not None: |
1509 if self.ui._colormode and len(commands) and commands[0] == b"diff": | 1509 if self.ui._colormode and len(commands) and commands[0] == b"diff": |
1510 # insert the argument in the front, | 1510 # insert the argument in the front, |
1511 # the end of git diff arguments is used for paths | 1511 # the end of git diff arguments is used for paths |
1512 commands.insert(1, b'--color') | 1512 commands.insert(1, b'--color') |
1513 extrakw = {} | 1513 extrakw = {} |
1514 if util.safehasattr(subprocess, 'CREATE_NO_WINDOW'): | 1514 if hasattr(subprocess, 'CREATE_NO_WINDOW'): |
1515 # On Windows, prevent command prompts windows from popping up when | 1515 # On Windows, prevent command prompts windows from popping up when |
1516 # running in pythonw. | 1516 # running in pythonw. |
1517 extrakw['creationflags'] = getattr(subprocess, 'CREATE_NO_WINDOW') | 1517 extrakw['creationflags'] = getattr(subprocess, 'CREATE_NO_WINDOW') |
1518 p = subprocess.Popen( | 1518 p = subprocess.Popen( |
1519 pycompat.rapply( | 1519 pycompat.rapply( |