# HG changeset patch
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1266243290 -3600
# Node ID 060c91ced72ff297c0e9ad3b7e23df6f7b66508a
# Parent  049d92fc861440bd8f0115e0fa3173a93cd2e9ae
don't update modification_date in repairing_mode (eg upgrade or shell)

diff -r 049d92fc8614 -r 060c91ced72f hooks/metadata.py
--- a/hooks/metadata.py	Mon Feb 15 15:14:27 2010 +0100
+++ b/hooks/metadata.py	Mon Feb 15 15:14:50 2010 +0100
@@ -55,7 +55,13 @@
     events = ('before_update_entity',)
 
     def __call__(self):
-        self.entity.setdefault('modification_date', datetime.now())
+        # repairing is true during c-c upgrade/shell and similar commands. We
+        # usually don't want to update modification date in such cases.
+        #
+        # XXX to be really clean, we should turn off modification_date update
+        # explicitly on each command where we do not want that behaviour.
+        if not self._cw.vreg.config.repairing:
+            self.entity.setdefault('modification_date', datetime.now())
 
 
 class _SetCreatorOp(hook.Operation):