@@ -1953,8 +1953,15 @@ def applyCommit(self, id):
# disable the read-only bit on windows.
if self.isWindows and file not in editedFiles:
os.chmod(file, stat.S_IWRITE)
- self.patchRCSKeywords(file, kwfiles[file])
- fixed_rcs_keywords = True
+
+ try:
+ self.patchRCSKeywords(file, kwfiles[file])
+ fixed_rcs_keywords = True
+ except:
+ # We are throwing an exception, undo all open edits
+ for f in editedFiles:
+ p4_revert(f)
+ raise
if fixed_rcs_keywords:
print("Retrying the patch with RCS keywords cleaned up")