1752 if not fileName: |
1752 if not fileName: |
1753 return |
1753 return |
1754 |
1754 |
1755 with contextlib.suppress(OSError): |
1755 with contextlib.suppress(OSError): |
1756 os.rename(fileName, fileName + ".orig") |
1756 os.rename(fileName, fileName + ".orig") |
1757 if sys.platform.startswith(("win", "cygwin")): |
1757 localHg = ( |
1758 localHg = os.path.join(sys.exec_prefix, "Scripts", "hg.exe") |
1758 os.path.join(sys.exec_prefix, "Scripts", "hg.exe") |
1759 else: |
1759 if sys.platform.startswith(("win", "cygwin")) else |
1760 localHg = os.path.join(sys.exec_prefix, "bin", "hg") |
1760 os.path.join(sys.exec_prefix, "bin", "hg") |
|
1761 ) |
1761 for hg in (localHg, "hg"): |
1762 for hg in (localHg, "hg"): |
1762 with contextlib.suppress(OSError, subprocess.CalledProcessError): |
1763 with contextlib.suppress(OSError, subprocess.CalledProcessError): |
1763 hgOut = subprocess.check_output([hg, "identify", "-i"]) # secok |
1764 hgOut = subprocess.check_output([hg, "identify", "-i"]) # secok |
1764 hgOut = hgOut.decode() |
1765 hgOut = hgOut.decode() |
1765 if hgOut: |
1766 if hgOut: |