changeset 385:cdcdedc532b7

obsolete: Stop turning obsolete secret changesets secret Extinct changeset are not properly excluded by core.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Wed, 25 Jul 2012 19:23:43 +0200
parents 51958dae7ca8
children a3797de26544
files hgext/obsolete.py tests/test-amend.t tests/test-evolve.t tests/test-obsolete-push.t tests/test-obsolete-rebase.t tests/test-obsolete.t tests/test-stabilize-result.t tests/test-uncommit.t
diffstat 8 files changed, 41 insertions(+), 79 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/obsolete.py	Wed Jul 25 19:14:18 2012 +0200
+++ b/hgext/obsolete.py	Wed Jul 25 19:23:43 2012 +0200
@@ -554,15 +554,6 @@
         ui.warn(_('Working directory parent is obsolete\n'))
     return res
 
-def wrapmaycreateobsmarker(origfn, ui, repo, *args, **opts):
-    lock = repo.lock()
-    try:
-        res = origfn(ui, repo, *args, **opts)
-        repo._turn_extinct_secret()
-    finally:
-        lock.release()
-    return res
-
 def warnobserrors(orig, ui, repo, *args, **kwargs):
     """display warning is the command resulted in more instable changeset"""
     priorunstables = len(repo.revs('unstable()'))
@@ -585,10 +576,6 @@
         if newconflictings > 0:
             ui.warn(_('%i new conflictings changesets\n') % newconflictings)
 
-def noextinctsvisibleheads(orig, repo):
-    repo._turn_extinct_secret()
-    return orig(repo)
-
 def wrapcmdutilamend(orig, ui, repo, commitfunc, old, *args, **kwargs):
     oldnode = old.node()
     new = orig(ui, repo, commitfunc, old, *args, **kwargs)
@@ -604,7 +591,6 @@
                 repo.obsstore.create(tr, oldnode, [new], 0, meta)
                 tr.close()
                 repo._clearobsoletecache()
-                repo._turn_extinct_secret()
             finally:
                 tr.release()
         finally:
@@ -614,11 +600,9 @@
 def uisetup(ui):
     extensions.wrapcommand(commands.table, "update", wrapmayobsoletewc)
     extensions.wrapcommand(commands.table, "pull", wrapmayobsoletewc)
-    extensions.wrapcommand(commands.table, "debugobsolete", wrapmaycreateobsmarker)
     if util.safehasattr(cmdutil, 'amend'):
         extensions.wrapfunction(cmdutil, 'amend', wrapcmdutilamend)
     extensions.wrapfunction(discovery, 'checkheads', wrapcheckheads)
-    extensions.wrapfunction(discovery, 'visibleheads', noextinctsvisibleheads)
     extensions.wrapfunction(phases, 'advanceboundary', wrapclearcache)
 
 ### serialisation
@@ -689,9 +673,7 @@
 
     if not util.safehasattr(repo.opener, 'tryread'):
         raise util.Abort('Obsolete extension require Mercurial 2.2 (or later)')
-    opull = repo.pull
     opush = repo.push
-    olock = repo.lock
     o_rollback = repo._rollback
     o_updatebranchcache = repo.updatebranchcache
 
@@ -812,7 +794,6 @@
                     mid = self.obsstore.create(tr, obj, subs, 0, meta)
                     tr.close()
                     self._clearobsoletecache()
-                    self._turn_extinct_secret()
                     return mid
                 finally:
                     tr.release()
@@ -828,30 +809,10 @@
             for n in oldnodes:
                 self.addobsolete(newnode, n)
 
-        def _turn_extinct_secret(self):
-            """ensure all extinct changeset are secret"""
-            self._clearobsoletecache()
-            # this is mainly for safety purpose
-            # both pull and push
-            query = '(obsolete() - obsolete()::(unstable() - secret())) - secret()'
-            expobs = [c.node() for c in repo.set(query)]
-            phases.retractboundary(repo, 2, expobs)
-
         ### pull // push support
 
-        def pull(self, remote, *args, **kwargs):
-            """wrapper around push that push obsolete relation"""
-            l = repo.lock()
-            try:
-                result = opull(remote, *args, **kwargs)
-                self._turn_extinct_secret()
-                return result
-            finally:
-                l.release()
-
         def push(self, remote, *args, **opts):
             """wrapper around pull that pull obsolete relation"""
-            self._turn_extinct_secret()
             try:
                 result = opush(remote, *args, **opts)
             except util.Abort, ex:
@@ -861,7 +822,6 @@
                     and ex.hint is None):
                     ex.hint = hint
                 raise
-            self._turn_extinct_secret()
             return result
 
 
--- a/tests/test-amend.t	Wed Jul 25 19:14:18 2012 +0200
+++ b/tests/test-amend.t	Wed Jul 25 19:23:43 2012 +0200
@@ -93,7 +93,7 @@
   7384bbcba36f 000000000000
   bd19cbe78fbf a34b93d251e4
   $ glog
-  @  6@foo(secret) amends a34b93d251e49c93d5685ebacad785c73a7e8605
+  @  6@foo(draft) amends a34b93d251e49c93d5685ebacad785c73a7e8605
   |
   o  5@default(draft) resetbranch
   |
--- a/tests/test-evolve.t	Wed Jul 25 19:14:18 2012 +0200
+++ b/tests/test-evolve.t	Wed Jul 25 19:23:43 2012 +0200
@@ -231,13 +231,13 @@
   $ glog --hidden
   o  6:23409eba69a0@default(draft) a nifty feature
   |
-  | x  5:e416e48b2742@default(secret) french looks better
+  | x  5:e416e48b2742@default(draft) french looks better
   | |
   | | o  4:f8111a076f09@default(draft) another feature
   | |/
-  | | x  3:524e478d4811@default(secret) fix spelling of Zwei
+  | | x  3:524e478d4811@default(draft) fix spelling of Zwei
   | | |
-  | | x  2:7b36850622b2@default(secret) another feature
+  | | x  2:7b36850622b2@default(draft) another feature
   | |/
   | x  1:568a468b60fc@default(draft) a nifty feature
   |/
--- a/tests/test-obsolete-push.t	Wed Jul 25 19:14:18 2012 +0200
+++ b/tests/test-obsolete-push.t	Wed Jul 25 19:23:43 2012 +0200
@@ -32,9 +32,9 @@
   $ glog --hidden
   @  2:244232c2222a@default(unstable/secret) C
   |
-  | x  1:6c81ed0049f8@default(extinct/secret) B
+  | x  1:6c81ed0049f8@default(extinct/draft) B
   |/
-  x  0:1994f17a630e@default(suspended/secret) A
+  x  0:1994f17a630e@default(suspended/draft) A
   
   $ hg init ../clone
   $ cat >  ../clone/.hg/hgrc <<EOF
@@ -44,5 +44,4 @@
   $ hg outgoing ../clone --template "$template"
   comparing with ../clone
   searching for changes
-  no changes found (ignored 3 secret changesets)
-  [1]
+  0:1994f17a630e@default(suspended/draft) A
--- a/tests/test-obsolete-rebase.t	Wed Jul 25 19:14:18 2012 +0200
+++ b/tests/test-obsolete-rebase.t	Wed Jul 25 19:23:43 2012 +0200
@@ -70,7 +70,7 @@
   $ glog --hidden
   @  4:9c5494949763@default(draft) adde
   |
-  | x  3:98e4a024635e@default(secret) adde
+  | x  3:98e4a024635e@default(draft) adde
   | |
   | o  2:102a90ea7b4a@default(draft) addb
   | |
@@ -92,11 +92,11 @@
   $ hg ci -m changea
   $ hg rebase -d 1
   $ glog --hidden
-  x  5:4e322f7ce8e3@foo(secret) changea
+  x  5:4e322f7ce8e3@foo(draft) changea
   |
   | o  4:9c5494949763@default(draft) adde
   | |
-  | | x  3:98e4a024635e@default(secret) adde
+  | | x  3:98e4a024635e@default(draft) adde
   | | |
   +---o  2:102a90ea7b4a@default(draft) addb
   | |
@@ -123,15 +123,15 @@
   $ glog --hidden
   @  8:a7773ffa7edc@default(draft) Collapsed revision
   |
-  | x  7:03f31481307a@default(secret) changec
+  | x  7:03f31481307a@default(draft) changec
   | |
-  | x  6:076e9b2ffbe1@default(secret) addc
+  | x  6:076e9b2ffbe1@default(draft) addc
   | |
-  | | x  5:4e322f7ce8e3@foo(secret) changea
+  | | x  5:4e322f7ce8e3@foo(draft) changea
   | |/
   +---o  4:9c5494949763@default(draft) adde
   | |
-  | | x  3:98e4a024635e@default(secret) adde
+  | | x  3:98e4a024635e@default(draft) adde
   | | |
   | | o  2:102a90ea7b4a@default(draft) addb
   | |/
@@ -182,21 +182,21 @@
   |
   o  11:03f165c84ea8@default(draft) addd
   |
-  | x  10:4b9d80f48523@default(secret) appendab
+  | x  10:4b9d80f48523@default(draft) appendab
   | |
-  | x  9:a31943eabc43@default(secret) addd
+  | x  9:a31943eabc43@default(draft) addd
   | |
   +---o  8:a7773ffa7edc@default(draft) Collapsed revision
   | |
-  | | x  7:03f31481307a@default(secret) changec
+  | | x  7:03f31481307a@default(draft) changec
   | | |
-  | | x  6:076e9b2ffbe1@default(secret) addc
+  | | x  6:076e9b2ffbe1@default(draft) addc
   | |/
-  | | x  5:4e322f7ce8e3@foo(secret) changea
+  | | x  5:4e322f7ce8e3@foo(draft) changea
   | |/
   +---o  4:9c5494949763@default(draft) adde
   | |
-  | | x  3:98e4a024635e@default(secret) adde
+  | | x  3:98e4a024635e@default(draft) adde
   | | |
   | | o  2:102a90ea7b4a@default(draft) addb
   | |/
--- a/tests/test-obsolete.t	Wed Jul 25 19:14:18 2012 +0200
+++ b/tests/test-obsolete.t	Wed Jul 25 19:23:43 2012 +0200
@@ -137,13 +137,13 @@
 
   $ hg glog --template '{rev}:{node|short}@{branch}({obsolete}/{phase}) {desc|firstline}\n' \
   >   --hidden
-  @  5:a7a6f2b5d8a5@default(unstable/secret) add d
+  @  5:a7a6f2b5d8a5@default(unstable/draft) add d
   |
   | o  4:725c380fe99b@default(stable/draft) add obsol_c'
   | |
-  x |  3:0d3f46688ccc@default(suspended/secret) add obsol_c
+  x |  3:0d3f46688ccc@default(suspended/draft) add obsol_c
   |/
-  | x  2:4538525df7e2@default(extinct/secret) add c
+  | x  2:4538525df7e2@default(extinct/draft) add c
   |/
   o  1:7c3bad9141dc@default(stable/draft) add b
   |
@@ -154,6 +154,8 @@
 
   $ hg init ../other-new
   $ hg phase --draft 'secret() - extinct()' # until we fix exclusion
+  abort: empty revision set
+  [255]
   $ hg push ../other-new
   pushing to ../other-new
   searching for changes
@@ -240,7 +242,7 @@
   $ hg push ../other-new
   pushing to ../other-new
   searching for changes
-  no changes found (ignored 2 secret changesets)
+  no changes found
   [1]
 
   $ hg up -q .^ # 3
@@ -305,21 +307,22 @@
 
   $ hg clone . ../cloned
   > # The warning should go away once we have default value to set ready before we pull
-  requesting all changes
-  adding changesets
-  adding manifests
-  adding file changes
-  added 5 changesets with 5 changes to 5 files (+1 heads)
   updating to branch default
   4 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
   $ qlog -R ../cloned
+  7
+  - 909a0fb57e5d
+  6
+  - 95de7fc6918d
+  5
+  - a7a6f2b5d8a5
   4
-  - 909a0fb57e5d
+  - 725c380fe99b
   3
-  - 725c380fe99b
+  - 0d3f46688ccc
   2
-  - 0d3f46688ccc
+  - 4538525df7e2
   1
   - 7c3bad9141dc
   0
--- a/tests/test-stabilize-result.t	Wed Jul 25 19:14:18 2012 +0200
+++ b/tests/test-stabilize-result.t	Wed Jul 25 19:23:43 2012 +0200
@@ -37,11 +37,11 @@
   $ glog --hidden
   @  4:1447e1c4828d@default(draft) bk:[changea] changea
   |
-  | x  3:41ad4fe8c795@default(secret) bk:[] amends 102a90ea7b4a3361e4082ed620918c261189a36a
+  | x  3:41ad4fe8c795@default(draft) bk:[] amends 102a90ea7b4a3361e4082ed620918c261189a36a
   | |
-  | | x  2:cce2c55b8965@default(secret) bk:[] changea
+  | | x  2:cce2c55b8965@default(draft) bk:[] changea
   | |/
-  | x  1:102a90ea7b4a@default(secret) bk:[] addb
+  | x  1:102a90ea7b4a@default(draft) bk:[] addb
   |/
   o  0:07f494440405@default(draft) bk:[] adda
   
--- a/tests/test-uncommit.t	Wed Jul 25 19:14:18 2012 +0200
+++ b/tests/test-uncommit.t	Wed Jul 25 19:23:43 2012 +0200
@@ -220,7 +220,7 @@
   $ glog --hidden
   @  4:e8db4aa611f6@bar(stable/draft) touncommit
   |
-  | x  3:5eb72dbe0cb4@bar(extinct/secret) touncommit
+  | x  3:5eb72dbe0cb4@bar(extinct/draft) touncommit
   |/
   o    2:f63b90038565@default(stable/draft) merge
   |\
@@ -263,11 +263,11 @@
   R m
   R n
   $ glog --hidden
-  @  5:c706fe2c12f8@bar(stable/secret) touncommit
+  @  5:c706fe2c12f8@bar(stable/draft) touncommit
   |
   | o  4:e8db4aa611f6@bar(stable/draft) touncommit
   |/
-  | x  3:5eb72dbe0cb4@bar(extinct/secret) touncommit
+  | x  3:5eb72dbe0cb4@bar(extinct/draft) touncommit
   |/
   o    2:f63b90038565@default(stable/draft) merge
   |\