# HG changeset patch # User Mads Kiilerich # Date 1278983054 -7200 # Node ID 9e874ee0fe97ffd00fe13300f4cdf6b44921e71d # Parent 68a30daead3f1c40a6ce10ebb860e8572f0776aa revert: rename original to .orig instead of copying (issue2282) By renaming before reverting the content of the file we ensure that we handle and break hardlinks properly. Handling of other hardlinks to .orig is somebody elses problem. diff -r 68a30daead3f -r 9e874ee0fe97 mercurial/commands.py --- a/mercurial/commands.py Tue Jul 20 14:00:47 2010 -0400 +++ b/mercurial/commands.py Tue Jul 13 03:04:14 2010 +0200 @@ -3167,7 +3167,7 @@ ui.note(_('saving current version of %s as %s\n') % (rel, bakname)) if not opts.get('dry_run'): - util.copyfile(target, bakname) + util.rename(target, bakname) if ui.verbose or not exact: msg = xlist[1] if not isinstance(msg, basestring):