1323 if not fileName: |
1323 if not fileName: |
1324 return |
1324 return |
1325 |
1325 |
1326 os.rename(fileName, fileName + ".orig") |
1326 os.rename(fileName, fileName + ".orig") |
1327 try: |
1327 try: |
1328 hgOut = subprocess.check_output(["hg", "identify"]) |
1328 hgOut = subprocess.check_output(["hg", "identify", "-i"]) |
1329 if sys.version_info[0] == 3: |
1329 if sys.version_info[0] == 3: |
1330 hgOut = hgOut.decode() |
1330 hgOut = hgOut.decode() |
1331 except (FileNotFoundError, subprocess.CalledProcessError): |
1331 except (FileNotFoundError, subprocess.CalledProcessError): |
1332 hgOut = "" |
1332 hgOut = "" |
1333 if hgOut: |
1333 if hgOut: |
1334 hgOut = hgOut.strip().split()[0] |
1334 hgOut = hgOut.strip() |
1335 if hgOut.endswith("+"): |
1335 if hgOut.endswith("+"): |
1336 hgOut = hgOut[:-1] |
1336 hgOut = hgOut[:-1] |
1337 if sys.version_info[0] == 2: |
1337 if sys.version_info[0] == 2: |
1338 f = codecs.open(fileName + ".orig", "r", "utf-8") |
1338 f = codecs.open(fileName + ".orig", "r", "utf-8") |
1339 else: |
1339 else: |