mercurial/transaction.py
changeset 33279 7912404b70f2
parent 33278 87bca10a06ed
child 33793 bbbbd3c30bfc
--- a/mercurial/transaction.py	Tue Jul 04 23:13:46 2017 +0900
+++ b/mercurial/transaction.py	Tue Jul 04 23:13:47 2017 +0900
@@ -72,8 +72,9 @@
             if f and b:
                 filepath = vfs.join(f)
                 backuppath = vfs.join(b)
+                checkambig = checkambigfiles and (f, l) in checkambigfiles
                 try:
-                    util.copyfile(backuppath, filepath, checkambig=True)
+                    util.copyfile(backuppath, filepath, checkambig=checkambig)
                     backupfiles.append(b)
                 except IOError:
                     report(_("failed to recover %s\n") % f)
@@ -328,10 +329,12 @@
                     name += suffix
                     if suffix:
                         self.registertmp(name, location=location)
+                        checkambig = False
                     else:
                         self.addbackup(name, location=location)
+                        checkambig = (name, location) in self.checkambigfiles
                     files.append(vfs(name, 'w', atomictemp=True,
-                                     checkambig=not suffix))
+                                     checkambig=checkambig))
                 genfunc(*files)
             finally:
                 for f in files: