[PATCH 4 of 4] revert: drop `lexist` check in the backup logic

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Sep 9 20:05:41 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1409357429 -7200
#      Sat Aug 30 02:10:29 2014 +0200
# Node ID 7bfda6350dc7cbc50204212a22ed198cb15097fb
# Parent  10052be213bf4471ce3df9fc87e2382c7c472209
revert: drop `lexist` check in the backup logic

We are no longer trying to backup file that does not exists on disk. This check
can be safely dropped.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2574,12 +2574,11 @@ def revert(ui, repo, ctx, parents, *pats
             for table, (xlist, msg), dobackup in disptable:
                 if abs not in table:
                     continue
                 if xlist is not None:
                     xlist.append(abs)
-                    if (dobackup and os.path.lexists(target)
-                        and wctx[abs].cmp(ctx[abs])):
+                    if (dobackup and wctx[abs].cmp(ctx[abs])):
                         bakname = "%s.orig" % rel
                         ui.note(_('saving current version of %s as %s\n') %
                                 (rel, bakname))
                         if not opts.get('dry_run'):
                             util.rename(target, bakname)


More information about the Mercurial-devel mailing list