Mercurial > hg
changeset 17296:a1f8869f2eee stable
obsolete: introduce an `_enabled` switch to disable the feature by default
Obsolete markers wide-usage and propagation should be avoided by default until
the obsolete feature is more mature.
This changeset introduce the `_enable` variable and prevent the creation of
obsolete marker if the feature is set to `False` (the default).
More limitation comes in followup changesets.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Sat, 28 Jul 2012 13:19:06 +0200 |
parents | 1f08ecc7febb |
children | 6955d69a52a4 |
files | mercurial/obsolete.py tests/test-obsolete-changeset-exchange.t tests/test-obsolete.t |
diffstat | 3 files changed, 28 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/obsolete.py Fri Jul 27 18:32:56 2012 +0200 +++ b/mercurial/obsolete.py Sat Jul 28 13:19:06 2012 +0200 @@ -58,7 +58,9 @@ _pack = struct.pack _unpack = struct.unpack - +# the obsolete feature is not mature enought to be enabled by default. +# you have to rely on third party extension extension to enable this. +_enabled = False # data used for parsing and writing _fmversion = 0 @@ -194,6 +196,8 @@ Take care of filtering duplicate. Return the number of new marker.""" + if not _enabled: + raise util.Abort('obsolete feature is not enabled on this repo') new = [m for m in markers if m not in self._all] if new: f = self.sopener('obsstore', 'ab')
--- a/tests/test-obsolete-changeset-exchange.t Fri Jul 27 18:32:56 2012 +0200 +++ b/tests/test-obsolete-changeset-exchange.t Sat Jul 28 13:19:06 2012 +0200 @@ -1,6 +1,13 @@ Test changesets filtering during exchanges (some tests are still in test-obsolete.t) + $ cat > obs.py << EOF + > import mercurial.obsolete + > mercurial.obsolete._enabled = True + > EOF + $ echo '[extensions]' >> $HGRCPATH + $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH + Push does corrupt remote ------------------------
--- a/tests/test-obsolete.t Fri Jul 27 18:32:56 2012 +0200 +++ b/tests/test-obsolete.t Sat Jul 28 13:19:06 2012 +0200 @@ -27,10 +27,25 @@ $ hg init tmpa $ cd tmpa + $ mkcommit kill_me + +Checking that the feature is properly disabled + + $ hg debugobsolete -d '0 0' `getid kill_me` -u babar + abort: obsolete feature is not enabled on this repo + [255] + +Enabling it + + $ cat > ../obs.py << EOF + > import mercurial.obsolete + > mercurial.obsolete._enabled = True + > EOF + $ echo '[extensions]' >> $HGRCPATH + $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH Killing a single changeset without replacement - $ mkcommit kill_me $ hg debugobsolete 0 abort: changeset references must be full hexadecimal node identifiers [255]