changeset 6030:d0dbae32517c

revert: revert clean files when only a change of flags is needed
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 08 Feb 2008 18:07:55 -0200
parents 5b6190dfb344
children 7383384793fb
files mercurial/commands.py tests/test-revert-flags tests/test-revert-flags.out
diffstat 3 files changed, 25 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Feb 08 18:07:55 2008 -0200
+++ b/mercurial/commands.py	Fri Feb 08 18:07:55 2008 -0200
@@ -2429,7 +2429,8 @@
                     if mfentry:
                         # if version of file is same in parent and target
                         # manifests, do nothing
-                        if pmf[abs] != mfentry:
+                        if (pmf[abs] != mfentry or
+                            pmf.flags(abs) != mf.flags(abs)):
                             handle(revert, False)
                     else:
                         handle(remove, False)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-revert-flags	Fri Feb 08 18:07:55 2008 -0200
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+"$TESTDIR/hghave" execbit || exit 80
+
+hg init repo
+cd repo
+echo foo > foo
+chmod 644 foo
+hg ci -qAm '644'
+
+chmod 755 foo
+hg ci -qAm '755'
+
+echo '% reverting to rev 0'
+hg revert -a -r 0
+hg st
+hg diff --git
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-revert-flags.out	Fri Feb 08 18:07:55 2008 -0200
@@ -0,0 +1,6 @@
+% reverting to rev 0
+reverting foo
+M foo
+diff --git a/foo b/foo
+old mode 100755
+new mode 100644