Patchwork [V4] repoview: add non-global tags to candidate list for blocking hidden changesets

login
register
mail settings
Submitter Sean Farley
Date March 19, 2014, 9:19 p.m.
Message ID <91f1f09d3b72055e65b2.1395263983@laptop.local>
Download mbox | patch
Permalink /patch/3995/
State Accepted
Commit 77c7ff36e36b244f0bf379d8fbf35af330fe573f
Headers show

Comments

Sean Farley - March 19, 2014, 9:19 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1395191433 18000
#      Tue Mar 18 20:10:33 2014 -0500
# Node ID 91f1f09d3b72055e65b23d3f354e2a27f88b8b06
# Parent  d666da075b912b7bae3c602842caed0e09b7235d
repoview: add non-global tags to candidate list for blocking hidden changesets

Previously, only bookmarks would be considered for blocking a changeset from
being hidden. Now, we also consider non-global tags. This is helpful if we have
local tags that might be hard to find once they are hidden, or tag that are
added by extensions (e.g. hggit or remotebranches).
Pierre-Yves David - March 19, 2014, 9:21 p.m.
On 03/19/2014 02:19 PM, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1395191433 18000
> #      Tue Mar 18 20:10:33 2014 -0500
> # Node ID 91f1f09d3b72055e65b23d3f354e2a27f88b8b06
> # Parent  d666da075b912b7bae3c602842caed0e09b7235d
> repoview: add non-global tags to candidate list for blocking hidden changesets
>
> Previously, only bookmarks would be considered for blocking a changeset from
> being hidden. Now, we also consider non-global tags. This is helpful if we have
> local tags that might be hard to find once they are hidden, or tag that are
> added by extensions (e.g. hggit or remotebranches).

LGTM (not applied or tested locally)
Augie Fackler - March 20, 2014, 2:39 p.m.
On Wed, Mar 19, 2014 at 04:19:43PM -0500, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1395191433 18000
> #      Tue Mar 18 20:10:33 2014 -0500
> # Node ID 91f1f09d3b72055e65b23d3f354e2a27f88b8b06
> # Parent  d666da075b912b7bae3c602842caed0e09b7235d
> repoview: add non-global tags to candidate list for blocking hidden changesets
>

I dither a little about this behavior wise, but the fact that I'm +0
and marmoute likes it means I'm going to queue it.

>
> Previously, only bookmarks would be considered for blocking a changeset from
> being hidden. Now, we also consider non-global tags. This is helpful if we have
> local tags that might be hard to find once they are hidden, or tag that are
> added by extensions (e.g. hggit or remotebranches).
>
> diff --git a/mercurial/repoview.py b/mercurial/repoview.py
> --- a/mercurial/repoview.py
> +++ b/mercurial/repoview.py
> @@ -33,10 +33,13 @@ def computehidden(repo):
>          blockers = [r for r in tofilter if r not in hideable]
>          for par in repo[None].parents():
>              blockers.append(par.rev())
>          for bm in repo._bookmarks.values():
>              blockers.append(repo[bm].rev())
> +        tags = [n for t, n in repo.tags().iteritems()
> +                if (repo.tagtype(t) and repo.tagtype(t) != 'global')]
> +        blockers.extend(repo[t].rev() for t in tags)
>          blocked = cl.ancestors(blockers, inclusive=True)
>          return frozenset(r for r in hideable if r not in blocked)
>      return frozenset()
>
>  def computeunserved(repo):
> diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
> --- a/tests/test-obsolete.t
> +++ b/tests/test-obsolete.t
> @@ -882,6 +882,22 @@ This test issue 3814
>    comparing with ../repo-issue3814
>    searching for changes
>    no changes found
>    [1]
>
> +Test that a local tag blocks a changeset from being hidden
>
> +  $ hg tag -l visible -r 0 --hidden
> +  $ hg log -G
> +  @  changeset:   2:3816541e5485
> +     tag:         tip
> +     parent:      -1:000000000000
> +     user:        test
> +     date:        Thu Jan 01 00:00:00 1970 +0000
> +     summary:     A
> +
> +  x  changeset:   0:193e9254ce7e
> +     tag:         visible
> +     user:        test
> +     date:        Thu Jan 01 00:00:00 1970 +0000
> +     summary:     A
> +
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -33,10 +33,13 @@  def computehidden(repo):
         blockers = [r for r in tofilter if r not in hideable]
         for par in repo[None].parents():
             blockers.append(par.rev())
         for bm in repo._bookmarks.values():
             blockers.append(repo[bm].rev())
+        tags = [n for t, n in repo.tags().iteritems()
+                if (repo.tagtype(t) and repo.tagtype(t) != 'global')]
+        blockers.extend(repo[t].rev() for t in tags)
         blocked = cl.ancestors(blockers, inclusive=True)
         return frozenset(r for r in hideable if r not in blocked)
     return frozenset()
 
 def computeunserved(repo):
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -882,6 +882,22 @@  This test issue 3814
   comparing with ../repo-issue3814
   searching for changes
   no changes found
   [1]
 
+Test that a local tag blocks a changeset from being hidden
 
+  $ hg tag -l visible -r 0 --hidden
+  $ hg log -G
+  @  changeset:   2:3816541e5485
+     tag:         tip
+     parent:      -1:000000000000
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     A
+  
+  x  changeset:   0:193e9254ce7e
+     tag:         visible
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     A
+