Patchwork [2,of,2,V2] streamclone: abort when client needs to handle obsmarkers, but doesn't

login
register
mail settings
Submitter Anton Shestakov
Date Oct. 18, 2018, 1:49 p.m.
Message ID <7827e8870afe4a150576.1539870560@neuro>
Download mbox | patch
Permalink /patch/36146/
State New
Headers show

Comments

Anton Shestakov - Oct. 18, 2018, 1:49 p.m.
# HG changeset patch
# User Anton Shestakov <av6@dwimlabs.net>
# Date 1538754012 -28800
#      Fri Oct 05 23:40:12 2018 +0800
# Node ID 7827e8870afe4a1505767a748dd07e94569196ac
# Parent  212b1f69138c7d1fa166356448305219259f34f9
# EXP-Topic stream-obsmarkers
streamclone: abort when client needs to handle obsmarkers, but doesn't

When client doesn't have any of obsolescence markers exchange capabilities,
then it's safe to say it can't handle obsmarkers. However, if it understands
even one format version, then stream clones are fine -- client can use
"obsmarkers" bundle2 part.
Augie Fackler - Oct. 22, 2018, 3:41 p.m.
On Thu, Oct 18, 2018 at 09:49:20PM +0800, Anton Shestakov wrote:
> # HG changeset patch
> # User Anton Shestakov <av6@dwimlabs.net>
> # Date 1538754012 -28800
> #      Fri Oct 05 23:40:12 2018 +0800
> # Node ID 7827e8870afe4a1505767a748dd07e94569196ac
> # Parent  212b1f69138c7d1fa166356448305219259f34f9
> # EXP-Topic stream-obsmarkers
> streamclone: abort when client needs to handle obsmarkers, but doesn't

queued, thanks
Gregory Szorc - Oct. 31, 2018, 7:48 p.m.
On Thu, Oct 18, 2018 at 6:53 AM Anton Shestakov <av6@dwimlabs.net> wrote:

> # HG changeset patch
> # User Anton Shestakov <av6@dwimlabs.net>
> # Date 1538754012 -28800
> #      Fri Oct 05 23:40:12 2018 +0800
> # Node ID 7827e8870afe4a1505767a748dd07e94569196ac
> # Parent  212b1f69138c7d1fa166356448305219259f34f9
> # EXP-Topic stream-obsmarkers
> streamclone: abort when client needs to handle obsmarkers, but doesn't
>
> When client doesn't have any of obsolescence markers exchange capabilities,
> then it's safe to say it can't handle obsmarkers. However, if it
> understands
> even one format version, then stream clones are fine -- client can use
> "obsmarkers" bundle2 part.
>

I'm tempted to say we should try to get this into 4.8. But the patch won't
apply cleanly without part 1.

Also, if this does land, it represents a behavior different from stream
clone version 1. I think that is OK, as the new behavior of rejecting to
clone hidden changesets when they will become visible again seems correct.


>
> diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
> --- a/mercurial/bundle2.py
> +++ b/mercurial/bundle2.py
> @@ -1700,7 +1700,10 @@ def addpartbundlestream2(bundler, repo,
>      includeobsmarkers = False
>      if repo.obsstore:
>          remoteversions = obsmarkersversion(bundler.capabilities)
> -        if repo.obsstore._version in remoteversions:
> +        if not remoteversions:
> +            raise error.Abort(_('server has obsolescence markers, but
> client '
> +                                'cannot receive them via stream clone'))
> +        elif repo.obsstore._version in remoteversions:
>              includeobsmarkers = True
>
>      filecount, bytecount, it = streamclone.generatev2(repo, includepats,
> diff --git a/tests/test-clone-uncompressed.t
> b/tests/test-clone-uncompressed.t
> --- a/tests/test-clone-uncompressed.t
> +++ b/tests/test-clone-uncompressed.t
> @@ -556,6 +556,12 @@ Clone non-publishing with obsolescence
>    $ hg debugobsolete -R with-obsolescence
>    50382b884f66690b7045cac93a540cba4d4c906f 0
> {c17445101a72edac06facd130d14808dfbd5c7c2} (Thu Jan 01 00:00:00 1970 +0000)
> {'user': 'test'}
>
> +  $ hg clone -U --stream --config experimental.evolution=0
> http://localhost:$HGPORT with-obsolescence-no-evolution
> +  streaming all changes
> +  remote: abort: server has obsolescence markers, but client cannot
> receive them via stream clone
> +  abort: pull failed on remote
> +  [255]
> +
>    $ killdaemons.py
>
>  #endif
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
Anton Shestakov - Nov. 1, 2018, 3:59 a.m.
On Wed, 31 Oct 2018 12:48:49 -0700
Gregory Szorc <gregory.szorc@gmail.com> wrote:

> On Thu, Oct 18, 2018 at 6:53 AM Anton Shestakov <av6@dwimlabs.net> wrote:
> 
> > # HG changeset patch
> > # User Anton Shestakov <av6@dwimlabs.net>
> > # Date 1538754012 -28800
> > #      Fri Oct 05 23:40:12 2018 +0800
> > # Node ID 7827e8870afe4a1505767a748dd07e94569196ac
> > # Parent  212b1f69138c7d1fa166356448305219259f34f9
> > # EXP-Topic stream-obsmarkers
> > streamclone: abort when client needs to handle obsmarkers, but doesn't
> >
> > When client doesn't have any of obsolescence markers exchange capabilities,
> > then it's safe to say it can't handle obsmarkers. However, if it
> > understands
> > even one format version, then stream clones are fine -- client can use
> > "obsmarkers" bundle2 part.
> >  
> 
> I'm tempted to say we should try to get this into 4.8.

Looks like it was quietly pushed before 4.8rc0 was cut, so it's in.

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1700,7 +1700,10 @@  def addpartbundlestream2(bundler, repo, 
     includeobsmarkers = False
     if repo.obsstore:
         remoteversions = obsmarkersversion(bundler.capabilities)
-        if repo.obsstore._version in remoteversions:
+        if not remoteversions:
+            raise error.Abort(_('server has obsolescence markers, but client '
+                                'cannot receive them via stream clone'))
+        elif repo.obsstore._version in remoteversions:
             includeobsmarkers = True
 
     filecount, bytecount, it = streamclone.generatev2(repo, includepats,
diff --git a/tests/test-clone-uncompressed.t b/tests/test-clone-uncompressed.t
--- a/tests/test-clone-uncompressed.t
+++ b/tests/test-clone-uncompressed.t
@@ -556,6 +556,12 @@  Clone non-publishing with obsolescence
   $ hg debugobsolete -R with-obsolescence
   50382b884f66690b7045cac93a540cba4d4c906f 0 {c17445101a72edac06facd130d14808dfbd5c7c2} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
 
+  $ hg clone -U --stream --config experimental.evolution=0 http://localhost:$HGPORT with-obsolescence-no-evolution
+  streaming all changes
+  remote: abort: server has obsolescence markers, but client cannot receive them via stream clone
+  abort: pull failed on remote
+  [255]
+
   $ killdaemons.py
 
 #endif