Patchwork [2,of,5] pullreport: skip filtered revs instead of obsolete ones

login
register
mail settings
Submitter Boris Feld
Date Sept. 28, 2018, 10:22 a.m.
Message ID <4bd42e72e7ba8c0ee9dc.1538130139@Laptop-Boris.lan>
Download mbox | patch
Permalink /patch/35158/
State Superseded
Headers show

Comments

Boris Feld - Sept. 28, 2018, 10:22 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1538058910 -7200
#      Thu Sep 27 16:35:10 2018 +0200
# Node ID 4bd42e72e7ba8c0ee9dc4e153127882e6961602a
# Parent  b36914d9928effac212d851c9617de93d6260746
# EXP-Topic obsolete-duplicates
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 4bd42e72e7ba
pullreport: skip filtered revs instead of obsolete ones

Obsolescence is closely related to visibility but still a distinct concept. We
can receive changesets that are obsolete but visible (eg: when pulling
orphans). Such changeset should be reported too. In addition, the filtering
level can be anything, we should respect it.
Yuya Nishihara - Sept. 28, 2018, 11:56 a.m.
On Fri, 28 Sep 2018 12:22:19 +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1538058910 -7200
> #      Thu Sep 27 16:35:10 2018 +0200
> # Node ID 4bd42e72e7ba8c0ee9dc4e153127882e6961602a
> # Parent  b36914d9928effac212d851c9617de93d6260746
> # EXP-Topic obsolete-duplicates
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 4bd42e72e7ba
> pullreport: skip filtered revs instead of obsolete ones
> 
> Obsolescence is closely related to visibility but still a distinct concept. We
> can receive changesets that are obsolete but visible (eg: when pulling
> orphans). Such changeset should be reported too. In addition, the filtering
> level can be anything, we should respect it.
> 
> diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
> --- a/mercurial/scmutil.py
> +++ b/mercurial/scmutil.py
> @@ -1603,13 +1603,11 @@ def registersummarycallback(repo, otr, t
>              if origrepolen >= len(repo):
>                  return
>  
> -            # Compute the bounds of new revisions' range, excluding obsoletes.
> -            unfi = repo.unfiltered()
> -            revs = unfi.revs('%d: and not obsolete()', origrepolen)
> +            # Compute the bounds of new visible revisions' range.
> +            revs = list(repo.changelog.revs(start=origrepolen))

Use revset? It's probably better to not construct a list of tens of thousands
of integers.

>              if not revs:
> -                # Got only obsoletes.
>                  return
> -            minrev, maxrev = repo[revs.min()], repo[revs.max()]
> +            minrev, maxrev = repo[revs[0]], repo[revs[-1]]
Boris Feld - Sept. 28, 2018, 12:36 p.m.
On 28/09/2018 13:56, Yuya Nishihara wrote:
> On Fri, 28 Sep 2018 12:22:19 +0200, Boris Feld wrote:
>> # HG changeset patch
>> # User Boris Feld <boris.feld@octobus.net>
>> # Date 1538058910 -7200
>> #      Thu Sep 27 16:35:10 2018 +0200
>> # Node ID 4bd42e72e7ba8c0ee9dc4e153127882e6961602a
>> # Parent  b36914d9928effac212d851c9617de93d6260746
>> # EXP-Topic obsolete-duplicates
>> # Available At https://bitbucket.org/octobus/mercurial-devel/
>> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 4bd42e72e7ba
>> pullreport: skip filtered revs instead of obsolete ones
>>
>> Obsolescence is closely related to visibility but still a distinct concept. We
>> can receive changesets that are obsolete but visible (eg: when pulling
>> orphans). Such changeset should be reported too. In addition, the filtering
>> level can be anything, we should respect it.
>>
>> diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
>> --- a/mercurial/scmutil.py
>> +++ b/mercurial/scmutil.py
>> @@ -1603,13 +1603,11 @@ def registersummarycallback(repo, otr, t
>>               if origrepolen >= len(repo):
>>                   return
>>   
>> -            # Compute the bounds of new revisions' range, excluding obsoletes.
>> -            unfi = repo.unfiltered()
>> -            revs = unfi.revs('%d: and not obsolete()', origrepolen)
>> +            # Compute the bounds of new visible revisions' range.
>> +            revs = list(repo.changelog.revs(start=origrepolen))
> Use revset? It's probably better to not construct a list of tens of thousands
> of integers.

The issue here is that we don't have a way to express what we want as a 
revset (to our knowledge). The revnum `origrepolen` could be filtered so 
it cannot be used explicitly in "%d"

We either need:

   unfi.revs("%d - _filteredrevs(%s)", origrepolen, repo.filtername)

or

   repo.revs("firstrevgreaterthan(%s):", origrepolen)

Should we implement either one of the possibility above or do you have 
another idea?

>
>>               if not revs:
>> -                # Got only obsoletes.
>>                   return
>> -            minrev, maxrev = repo[revs.min()], repo[revs.max()]
>> +            minrev, maxrev = repo[revs[0]], repo[revs[-1]]
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Yuya Nishihara - Sept. 28, 2018, 12:48 p.m.
On Fri, 28 Sep 2018 14:36:50 +0200, Boris FELD wrote:
> On 28/09/2018 13:56, Yuya Nishihara wrote:
> > On Fri, 28 Sep 2018 12:22:19 +0200, Boris Feld wrote:
> >> # HG changeset patch
> >> # User Boris Feld <boris.feld@octobus.net>
> >> # Date 1538058910 -7200
> >> #      Thu Sep 27 16:35:10 2018 +0200
> >> # Node ID 4bd42e72e7ba8c0ee9dc4e153127882e6961602a
> >> # Parent  b36914d9928effac212d851c9617de93d6260746
> >> # EXP-Topic obsolete-duplicates
> >> # Available At https://bitbucket.org/octobus/mercurial-devel/
> >> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 4bd42e72e7ba
> >> pullreport: skip filtered revs instead of obsolete ones
> >>
> >> Obsolescence is closely related to visibility but still a distinct concept. We
> >> can receive changesets that are obsolete but visible (eg: when pulling
> >> orphans). Such changeset should be reported too. In addition, the filtering
> >> level can be anything, we should respect it.
> >>
> >> diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
> >> --- a/mercurial/scmutil.py
> >> +++ b/mercurial/scmutil.py
> >> @@ -1603,13 +1603,11 @@ def registersummarycallback(repo, otr, t
> >>               if origrepolen >= len(repo):
> >>                   return
> >>   
> >> -            # Compute the bounds of new revisions' range, excluding obsoletes.
> >> -            unfi = repo.unfiltered()
> >> -            revs = unfi.revs('%d: and not obsolete()', origrepolen)
> >> +            # Compute the bounds of new visible revisions' range.
> >> +            revs = list(repo.changelog.revs(start=origrepolen))
> > Use revset? It's probably better to not construct a list of tens of thousands
> > of integers.
> 
> The issue here is that we don't have a way to express what we want as a 
> revset (to our knowledge). The revnum `origrepolen` could be filtered so 
> it cannot be used explicitly in "%d"
> 
> We either need:
> 
>    unfi.revs("%d - _filteredrevs(%s)", origrepolen, repo.filtername)
> 
> or
> 
>    repo.revs("firstrevgreaterthan(%s):", origrepolen)
> 
> Should we implement either one of the possibility above or do you have 
> another idea?

Good point. Maybe we can instantiate smartset.spanset() directly then?

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1603,13 +1603,11 @@  def registersummarycallback(repo, otr, t
             if origrepolen >= len(repo):
                 return
 
-            # Compute the bounds of new revisions' range, excluding obsoletes.
-            unfi = repo.unfiltered()
-            revs = unfi.revs('%d: and not obsolete()', origrepolen)
+            # Compute the bounds of new visible revisions' range.
+            revs = list(repo.changelog.revs(start=origrepolen))
             if not revs:
-                # Got only obsoletes.
                 return
-            minrev, maxrev = repo[revs.min()], repo[revs.max()]
+            minrev, maxrev = repo[revs[0]], repo[revs[-1]]
 
             if minrev == maxrev:
                 revrange = minrev
diff --git a/tests/test-obsolete-distributed.t b/tests/test-obsolete-distributed.t
--- a/tests/test-obsolete-distributed.t
+++ b/tests/test-obsolete-distributed.t
@@ -537,5 +537,5 @@  Actual test
   added 2 changesets with 0 changes to 0 files
   1 new obsolescence markers
   1 new orphan changesets
-  new changesets 95d586532b49 (1 drafts)
+  new changesets 66f7d451a68b:95d586532b49 (2 drafts)
   (run 'hg update' to get a working copy)