##// END OF EJS Templates
obsolete: introduce an `_enabled` switch to disable the feature by default...
Pierre-Yves David -
r17296:a1f8869f stable
parent child Browse files
Show More
@@ -58,7 +58,9 b' from i18n import _'
58 _pack = struct.pack
58 _pack = struct.pack
59 _unpack = struct.unpack
59 _unpack = struct.unpack
60
60
61
61 # the obsolete feature is not mature enought to be enabled by default.
62 # you have to rely on third party extension extension to enable this.
63 _enabled = False
62
64
63 # data used for parsing and writing
65 # data used for parsing and writing
64 _fmversion = 0
66 _fmversion = 0
@@ -194,6 +196,8 b' class obsstore(object):'
194
196
195 Take care of filtering duplicate.
197 Take care of filtering duplicate.
196 Return the number of new marker."""
198 Return the number of new marker."""
199 if not _enabled:
200 raise util.Abort('obsolete feature is not enabled on this repo')
197 new = [m for m in markers if m not in self._all]
201 new = [m for m in markers if m not in self._all]
198 if new:
202 if new:
199 f = self.sopener('obsstore', 'ab')
203 f = self.sopener('obsstore', 'ab')
@@ -1,6 +1,13 b''
1 Test changesets filtering during exchanges (some tests are still in
1 Test changesets filtering during exchanges (some tests are still in
2 test-obsolete.t)
2 test-obsolete.t)
3
3
4 $ cat > obs.py << EOF
5 > import mercurial.obsolete
6 > mercurial.obsolete._enabled = True
7 > EOF
8 $ echo '[extensions]' >> $HGRCPATH
9 $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH
10
4 Push does corrupt remote
11 Push does corrupt remote
5 ------------------------
12 ------------------------
6
13
@@ -27,10 +27,25 b''
27
27
28 $ hg init tmpa
28 $ hg init tmpa
29 $ cd tmpa
29 $ cd tmpa
30 $ mkcommit kill_me
31
32 Checking that the feature is properly disabled
33
34 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
35 abort: obsolete feature is not enabled on this repo
36 [255]
37
38 Enabling it
39
40 $ cat > ../obs.py << EOF
41 > import mercurial.obsolete
42 > mercurial.obsolete._enabled = True
43 > EOF
44 $ echo '[extensions]' >> $HGRCPATH
45 $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH
30
46
31 Killing a single changeset without replacement
47 Killing a single changeset without replacement
32
48
33 $ mkcommit kill_me
34 $ hg debugobsolete 0
49 $ hg debugobsolete 0
35 abort: changeset references must be full hexadecimal node identifiers
50 abort: changeset references must be full hexadecimal node identifiers
36 [255]
51 [255]
General Comments 0
You need to be logged in to leave comments. Login now