[PATCH 2 of 3 STABLE] obsolete: warns if markers exist in a repo where the feature is not enabled

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sat Jul 28 07:51:08 CDT 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1343473525 -7200
# Branch stable
# Node ID 4bea3b6e5f0261584fa4cef174bb4e8e850a28e2
# Parent  4cf78c967f0590ae922cf5df5b4628a97f2691ab
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.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -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
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -486,3 +486,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
+  


More information about the Mercurial-devel mailing list