changeset 17297:6955d69a52a4 stable

obsolete: warns if markers exist in a repo where the feature is not enabled We don't simply abort to allow the user to run other diagnostic commands.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Sat, 28 Jul 2012 13:05:25 +0200
parents a1f8869f2eee
children 59c14bf5a48c
files mercurial/localrepo.py tests/test-obsolete.t
diffstat 2 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Sat Jul 28 13:19:06 2012 +0200
+++ b/mercurial/localrepo.py	Sat Jul 28 13:05:25 2012 +0200
@@ -289,6 +289,10 @@
     @storecache('obsstore')
     def obsstore(self):
         store = obsolete.obsstore(self.sopener)
+        if store and not obsolete._enabled:
+            # message is rare enough to not be stranlated
+            msg = 'obsolete feature not enabled but %i markers found!\n'
+            self.ui.warn(msg % len(list(store)))
         return store
 
     @propertycache
--- a/tests/test-obsolete.t	Sat Jul 28 13:19:06 2012 +0200
+++ b/tests/test-obsolete.t	Sat Jul 28 13:05:25 2012 +0200
@@ -492,3 +492,17 @@
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files (+1 heads)
+
+Checking _enable=False warning if obsolete marker exist
+
+  $ echo '[extensions]' >> $HGRCPATH
+  $ echo "obs=!" >> $HGRCPATH
+  $ hg log -r tip
+  obsolete feature not enabled but 7 markers found!
+  changeset:   6:d6a026544050
+  tag:         tip
+  parent:      3:5601fb93a350
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     add obsolete_e
+