D1957: streamclonebundle: make sure we accept new stream clone bundle spec

2018-03-30 Thread lothiraldan (Boris Feld)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb837655c1509: streamclonebundle: make sure we accept new 
stream clone bundle spec (authored by lothiraldan, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1957?vs=7378=7388

REVISION DETAIL
  https://phab.mercurial-scm.org/D1957

AFFECTED FILES
  mercurial/exchange.py
  tests/test-stream-bundle-v2.t

CHANGE DETAILS

diff --git a/tests/test-stream-bundle-v2.t b/tests/test-stream-bundle-v2.t
--- a/tests/test-stream-bundle-v2.t
+++ b/tests/test-stream-bundle-v2.t
@@ -112,3 +112,55 @@
E: remote created -> g
   getting E
   5 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg clone --stream http://localhost:$HGPORT streamv2-clone-explicit --debug
+  using http://localhost:$HGPORT/
+  sending capabilities command
+  sending clonebundles command
+  applying clone bundle from http://localhost:$HGPORT1/bundle.hg
+  bundle2-input-bundle: with-transaction
+  bundle2-input-part: "stream2" (params: 3 mandatory) supported
+  applying stream bundle
+  11 files to transfer, 1.65 KB of data
+  adding [s] data/A.i (66 bytes)
+  adding [s] data/B.i (66 bytes)
+  adding [s] data/C.i (66 bytes)
+  adding [s] data/D.i (66 bytes)
+  adding [s] data/E.i (66 bytes)
+  adding [s] 00manifest.i (584 bytes)
+  adding [s] 00changelog.i (595 bytes)
+  adding [s] phaseroots (43 bytes)
+  adding [c] branch2-served (94 bytes)
+  adding [c] rbc-names-v1 (7 bytes)
+  adding [c] rbc-revs-v1 (40 bytes)
+  transferred 1.65 KB in *.* seconds (*/sec) (glob)
+  bundle2-input-part: total payload size 1840
+  bundle2-input-bundle: 0 parts total
+  finished applying clone bundle
+  query 1; heads
+  sending batch command
+  searching for changes
+  all remote heads known locally
+  no changes found
+  sending getbundle command
+  bundle2-input-bundle: with-transaction
+  bundle2-input-part: "listkeys" (params: 1 mandatory) supported
+  bundle2-input-part: "phase-heads" supported
+  bundle2-input-part: total payload size 24
+  bundle2-input-bundle: 1 parts total
+  checking for updated bookmarks
+  updating to branch default
+  resolving manifests
+   branchmerge: False, force: False, partial: False
+   ancestor: , local: +, remote: 9bc730a19041
+   A: remote created -> g
+  getting A
+   B: remote created -> g
+  getting B
+   C: remote created -> g
+  getting C
+   D: remote created -> g
+  getting D
+   E: remote created -> g
+  getting E
+  5 files updated, 0 files merged, 0 files removed, 0 files unresolved
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -2180,6 +2180,18 @@
 
 return m
 
+def isstreamclonespec(bundlespec):
+# Stream clone v1
+if (bundlespec.compression == 'UN' and bundlespec.version == 's1'):
+return True
+
+# Stream clone v2
+if (bundlespec.compression == 'UN' and bundlespec.version == '02' and \
+bundlespec.contentopts.get('streamv2')):
+return True
+
+return False
+
 def filterclonebundleentries(repo, entries, streamclonerequested=False):
 """Remove incompatible clone bundle manifest entries.
 
@@ -2199,9 +2211,7 @@
 
 # If a stream clone was requested, filter out non-streamclone
 # entries.
-comp = bundlespec.compression
-version = bundlespec.version
-if streamclonerequested and (comp != 'UN' or version != 's1'):
+if streamclonerequested and not isstreamclonespec(bundlespec):
 repo.ui.debug('filtering %s because not a stream clone\n' %
   entry['URL'])
 continue



To: lothiraldan, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1957: streamclonebundle: make sure we accept new stream clone bundle spec

2018-03-30 Thread lothiraldan (Boris Feld)
lothiraldan updated this revision to Diff 7378.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1957?vs=5029=7378

REVISION DETAIL
  https://phab.mercurial-scm.org/D1957

AFFECTED FILES
  mercurial/exchange.py
  tests/test-stream-bundle-v2.t

CHANGE DETAILS

diff --git a/tests/test-stream-bundle-v2.t b/tests/test-stream-bundle-v2.t
--- a/tests/test-stream-bundle-v2.t
+++ b/tests/test-stream-bundle-v2.t
@@ -112,3 +112,55 @@
E: remote created -> g
   getting E
   5 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg clone --stream http://localhost:$HGPORT streamv2-clone-explicit --debug
+  using http://localhost:$HGPORT/
+  sending capabilities command
+  sending clonebundles command
+  applying clone bundle from http://localhost:$HGPORT1/bundle.hg
+  bundle2-input-bundle: with-transaction
+  bundle2-input-part: "stream2" (params: 3 mandatory) supported
+  applying stream bundle
+  11 files to transfer, 1.65 KB of data
+  adding [s] data/A.i (66 bytes)
+  adding [s] data/B.i (66 bytes)
+  adding [s] data/C.i (66 bytes)
+  adding [s] data/D.i (66 bytes)
+  adding [s] data/E.i (66 bytes)
+  adding [s] 00manifest.i (584 bytes)
+  adding [s] 00changelog.i (595 bytes)
+  adding [s] phaseroots (43 bytes)
+  adding [c] branch2-served (94 bytes)
+  adding [c] rbc-names-v1 (7 bytes)
+  adding [c] rbc-revs-v1 (40 bytes)
+  transferred 1.65 KB in *.* seconds (*/sec) (glob)
+  bundle2-input-part: total payload size 1840
+  bundle2-input-bundle: 0 parts total
+  finished applying clone bundle
+  query 1; heads
+  sending batch command
+  searching for changes
+  all remote heads known locally
+  no changes found
+  sending getbundle command
+  bundle2-input-bundle: with-transaction
+  bundle2-input-part: "listkeys" (params: 1 mandatory) supported
+  bundle2-input-part: "phase-heads" supported
+  bundle2-input-part: total payload size 24
+  bundle2-input-bundle: 1 parts total
+  checking for updated bookmarks
+  updating to branch default
+  resolving manifests
+   branchmerge: False, force: False, partial: False
+   ancestor: , local: +, remote: 9bc730a19041
+   A: remote created -> g
+  getting A
+   B: remote created -> g
+  getting B
+   C: remote created -> g
+  getting C
+   D: remote created -> g
+  getting D
+   E: remote created -> g
+  getting E
+  5 files updated, 0 files merged, 0 files removed, 0 files unresolved
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -2180,6 +2180,18 @@
 
 return m
 
+def isstreamclonespec(bundlespec):
+# Stream clone v1
+if (bundlespec.compression == 'UN' and bundlespec.version == 's1'):
+return True
+
+# Stream clone v2
+if (bundlespec.compression == 'UN' and bundlespec.version == '02' and \
+bundlespec.contentopts.get('streamv2')):
+return True
+
+return False
+
 def filterclonebundleentries(repo, entries, streamclonerequested=False):
 """Remove incompatible clone bundle manifest entries.
 
@@ -2199,9 +2211,7 @@
 
 # If a stream clone was requested, filter out non-streamclone
 # entries.
-comp = bundlespec.compression
-version = bundlespec.version
-if streamclonerequested and (comp != 'UN' or version != 's1'):
+if streamclonerequested and not isstreamclonespec(bundlespec):
 repo.ui.debug('filtering %s because not a stream clone\n' %
   entry['URL'])
 continue



To: lothiraldan, #hg-reviewers
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1957: streamclonebundle: make sure we accept new stream clone bundle spec

2018-03-15 Thread lothiraldan (Boris Feld)
lothiraldan added a comment.


  @indygreg  I'm  on having this discussion. When do you want to have it? What 
would be the best medium for it, a video-call?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1957

To: lothiraldan, #hg-reviewers
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1957: streamclonebundle: make sure we accept new stream clone bundle spec

2018-02-20 Thread indygreg (Gregory Szorc)
indygreg added a comment.


  In general, I'm pretty happy with this series. Although I held off accepting 
changesets because I think we should have a mini discussion about //content 
options// versus //capabilities// before things get out of control and we 
duplicate too much logic.
  
  I'd also like to note that bundle specs are intended to be user facing and 
their behavior should be as simple as possible for people. e.g. consider adding 
keywords to parameters instead of requiring parameters have values.
  
  Also, while you are here, we should consider defining a `v3` bundlespec that 
allows embedding of bookmarks, phases, obsolescence markers, etc. Basically all 
the modern features of bundle2 that modern peers and servers will negotiate 
with each other.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1957

To: lothiraldan, #hg-reviewers
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1957: streamclonebundle: make sure we accept new stream clone bundle spec

2018-02-20 Thread lothiraldan (Boris Feld)
lothiraldan added a comment.


  Ping on this series

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1957

To: lothiraldan, #hg-reviewers
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1957: streamclonebundle: make sure we accept new stream clone bundle spec

2018-02-07 Thread lothiraldan (Boris Feld)
lothiraldan added a subscriber: indygreg.
lothiraldan added a comment.


  @indygreg Could you take a look at the series before it gets too distant to 
merge cleanly?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1957

To: lothiraldan, #hg-reviewers
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1957: streamclonebundle: make sure we accept new stream clone bundle spec

2018-01-31 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  When asked specifically, the code do a sanity check on the clone bundle to
  ensure it's a stream bundle. As we introduced a new stream bundle spec, update
  the logic to support it.
  
  With this final changeset, we can now announce safely a stream v2 clone bundle
  and old clients would not crash trying to process it.
  
  This changeset address the last comment from Gregory Szorc on the stream v2
  bundle series.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1957

AFFECTED FILES
  mercurial/exchange.py
  tests/test-stream-bundle-v2.t

CHANGE DETAILS

diff --git a/tests/test-stream-bundle-v2.t b/tests/test-stream-bundle-v2.t
--- a/tests/test-stream-bundle-v2.t
+++ b/tests/test-stream-bundle-v2.t
@@ -112,3 +112,55 @@
E: remote created -> g
   getting E
   5 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg clone --stream http://localhost:$HGPORT streamv2-clone-explicit --debug
+  using http://localhost:$HGPORT/
+  sending capabilities command
+  sending clonebundles command
+  applying clone bundle from http://localhost:$HGPORT1/bundle.hg
+  bundle2-input-bundle: with-transaction
+  bundle2-input-part: "stream2" (params: 3 mandatory) supported
+  applying stream bundle
+  11 files to transfer, 1.65 KB of data
+  adding [s] data/A.i (66 bytes)
+  adding [s] data/B.i (66 bytes)
+  adding [s] data/C.i (66 bytes)
+  adding [s] data/D.i (66 bytes)
+  adding [s] data/E.i (66 bytes)
+  adding [s] 00manifest.i (584 bytes)
+  adding [s] 00changelog.i (595 bytes)
+  adding [s] phaseroots (43 bytes)
+  adding [c] branch2-served (94 bytes)
+  adding [c] rbc-names-v1 (7 bytes)
+  adding [c] rbc-revs-v1 (40 bytes)
+  transferred 1.65 KB in *.* seconds (*/sec) (glob)
+  bundle2-input-part: total payload size 1840
+  bundle2-input-bundle: 0 parts total
+  finished applying clone bundle
+  query 1; heads
+  sending batch command
+  searching for changes
+  all remote heads known locally
+  no changes found
+  sending getbundle command
+  bundle2-input-bundle: with-transaction
+  bundle2-input-part: "listkeys" (params: 1 mandatory) supported
+  bundle2-input-part: "phase-heads" supported
+  bundle2-input-part: total payload size 24
+  bundle2-input-bundle: 1 parts total
+  checking for updated bookmarks
+  updating to branch default
+  resolving manifests
+   branchmerge: False, force: False, partial: False
+   ancestor: , local: +, remote: 9bc730a19041
+   A: remote created -> g
+  getting A
+   B: remote created -> g
+  getting B
+   C: remote created -> g
+  getting C
+   D: remote created -> g
+  getting D
+   E: remote created -> g
+  getting E
+  5 files updated, 0 files merged, 0 files removed, 0 files unresolved
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -2155,6 +2155,17 @@
 
 return m
 
+def isstreamclonespec(comp, version, params, contentops):
+# Stream clone v1
+if (comp == 'UN' and version == 's1'):
+return True
+
+# Stream clone v2
+if (comp == 'UN' and version == '02' and contentops.get('streamv2')):
+return True
+
+return False
+
 def filterclonebundleentries(repo, entries, streamclonerequested=False):
 """Remove incompatible clone bundle manifest entries.
 
@@ -2170,11 +2181,13 @@
 spec = entry.get('BUNDLESPEC')
 if spec:
 try:
-comp, version, params, _ = parsebundlespec(repo, spec, 
strict=True)
+comp, version, params, contentops = parsebundlespec(
+repo, spec, strict=True)
 
 # If a stream clone was requested, filter out non-streamclone
 # entries.
-if streamclonerequested and (comp != 'UN' or version != 's1'):
+if streamclonerequested and not isstreamclonespec(
+comp, version, params, contentops):
 repo.ui.debug('filtering %s because not a stream clone\n' %
   entry['URL'])
 continue



To: lothiraldan, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel