bundle2: lowercase part types
authorEric Sumner <ericsumner@fb.com>
Wed, 17 Dec 2014 15:11:26 -0800
changeset 23591 414374cfb531
parent 23590 4440c7cc3728
child 23602 a4679a74df14
bundle2: lowercase part types Since the capitalization no longer carries any meaning (previous diff), this patch normalizes all of the bundle2 part type strings to lower case.
mercurial/exchange.py
mercurial/wireproto.py
tests/test-bundle2-exchange.t
tests/test-bundle2-format.t
tests/test-bundle2-remote-changegroup.t
--- a/mercurial/exchange.py	Wed Dec 17 21:14:19 2014 -0800
+++ b/mercurial/exchange.py	Wed Dec 17 15:11:26 2014 -0800
@@ -49,7 +49,7 @@
         if version is None:
             raise ValueError('bundler do not support common obsmarker format')
         stream = obsolete.encodemarkers(markers, True, version=version)
-        return bundler.newpart('B2X:OBSMARKERS', data=stream)
+        return bundler.newpart('b2x:obsmarkers', data=stream)
     return None
 
 class pushoperation(object):
@@ -454,7 +454,7 @@
                                      pushop.remote,
                                      pushop.outgoing)
     if not pushop.force:
-        bundler.newpart('B2X:CHECK:HEADS', data=iter(pushop.remoteheads))
+        bundler.newpart('b2x:check:heads', data=iter(pushop.remoteheads))
     b2caps = bundle2.bundle2caps(pushop.remote)
     version = None
     cgversions = b2caps.get('b2x:changegroup')
@@ -469,7 +469,7 @@
         cg = changegroup.getlocalchangegroupraw(pushop.repo, 'push',
                                                 pushop.outgoing,
                                                 version=version)
-    cgpart = bundler.newpart('B2X:CHANGEGROUP', data=cg)
+    cgpart = bundler.newpart('b2x:changegroup', data=cg)
     if version is not None:
         cgpart.addparam('version', version)
     def handlereply(op):
--- a/mercurial/wireproto.py	Wed Dec 17 21:14:19 2014 -0800
+++ b/mercurial/wireproto.py	Wed Dec 17 15:11:26 2014 -0800
@@ -837,7 +837,7 @@
             os.unlink(tempname)
     except error.BundleValueError, exc:
             bundler = bundle2.bundle20(repo.ui)
-            errpart = bundler.newpart('B2X:ERROR:UNSUPPORTEDCONTENT')
+            errpart = bundler.newpart('b2x:error:unsupportedcontent')
             if exc.parttype is not None:
                 errpart.addparam('parttype', exc.parttype)
             if exc.params:
@@ -854,7 +854,7 @@
             advargs = []
             if inst.hint is not None:
                 advargs.append(('hint', inst.hint))
-            bundler.addpart(bundle2.bundlepart('B2X:ERROR:ABORT',
+            bundler.addpart(bundle2.bundlepart('b2x:error:abort',
                                                manargs, advargs))
             return streamres(bundler.getchunks())
         else:
@@ -863,7 +863,7 @@
     except error.PushRaced, exc:
         if getattr(exc, 'duringunbundle2', False):
             bundler = bundle2.bundle20(repo.ui)
-            bundler.newpart('B2X:ERROR:PUSHRACED', [('message', str(exc))])
+            bundler.newpart('b2x:error:pushraced', [('message', str(exc))])
             return streamres(bundler.getchunks())
         else:
             return pusherr(str(exc))
--- a/tests/test-bundle2-exchange.t	Wed Dec 17 21:14:19 2014 -0800
+++ b/tests/test-bundle2-exchange.t	Wed Dec 17 15:11:26 2014 -0800
@@ -364,7 +364,7 @@
   >     if reason == 'abort':
   >         bundler.newpart('test:abort')
   >     if reason == 'unknown':
-  >         bundler.newpart('TEST:UNKNOWN')
+  >         bundler.newpart('test:unknown')
   >     if reason == 'race':
   >         # 20 Bytes of crap
   >         bundler.newpart('b2x:check:heads', data='01234567890123456789')
--- a/tests/test-bundle2-format.t	Wed Dec 17 21:14:19 2014 -0800
+++ b/tests/test-bundle2-format.t	Wed Dec 17 15:11:26 2014 -0800
@@ -127,9 +127,9 @@
   >        # advisory known part with unknown mandatory param
   >        bundler.newpart('test:song', [('randomparam','')], mandatory=False)
   >     if opts['unknown']:
-  >        bundler.newpart('test:UNKNOWN', data='some random content')
+  >        bundler.newpart('test:unknown', data='some random content')
   >     if opts['unknownparams']:
-  >        bundler.newpart('test:SONG', [('randomparams', '')])
+  >        bundler.newpart('test:song', [('randomparams', '')])
   >     if opts['parts']:
   >        bundler.newpart('test:ping', mandatory=False)
   >     if opts['genraise']:
--- a/tests/test-bundle2-remote-changegroup.t	Wed Dec 17 21:14:19 2014 -0800
+++ b/tests/test-bundle2-remote-changegroup.t	Wed Dec 17 15:11:26 2014 -0800
@@ -50,13 +50,13 @@
   >            bundledata = open(file, 'rb').read()
   >            digest = util.digester.preferred(b2caps['digests'])
   >            d = util.digester([digest], bundledata)
-  >            part = newpart('B2X:REMOTE-CHANGEGROUP')
+  >            part = newpart('b2x:remote-changegroup')
   >            part.addparam('url', url)
   >            part.addparam('size', str(len(bundledata)))
   >            part.addparam('digests', digest)
   >            part.addparam('digest:%s' % digest, d[digest])
   >         elif verb == 'raw-remote-changegroup':
-  >            part = newpart('B2X:REMOTE-CHANGEGROUP')
+  >            part = newpart('b2x:remote-changegroup')
   >            for k, v in eval(args).items():
   >                part.addparam(k, str(v))
   >         elif verb == 'changegroup':
@@ -65,7 +65,7 @@
   >             heads = [repo.lookup(r) for r in repo.revs(heads)]
   >             cg = changegroup.getchangegroup(repo, 'changegroup',
   >                 heads=heads, common=common)
-  >             newpart('B2X:CHANGEGROUP', cg.getchunks())
+  >             newpart('b2x:changegroup', cg.getchunks())
   >         else:
   >             raise Exception('unknown verb')
   > 
@@ -137,7 +137,7 @@
   $ hg pull -R clone ssh://user@dummy/repo
   pulling from ssh://user@dummy/repo
   searching for changes
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   adding changesets
   adding manifests
   adding file changes
@@ -180,12 +180,12 @@
   $ hg pull -R clone ssh://user@dummy/repo
   pulling from ssh://user@dummy/repo
   searching for changes
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   adding changesets
   adding manifests
   adding file changes
   added 2 changesets with 2 changes to 2 files (+1 heads)
-  remote: B2X:CHANGEGROUP
+  remote: b2x:changegroup
   adding changesets
   adding manifests
   adding file changes
@@ -228,12 +228,12 @@
   $ hg pull -R clone ssh://user@dummy/repo
   pulling from ssh://user@dummy/repo
   searching for changes
-  remote: B2X:CHANGEGROUP
+  remote: b2x:changegroup
   adding changesets
   adding manifests
   adding file changes
   added 2 changesets with 2 changes to 2 files (+1 heads)
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   adding changesets
   adding manifests
   adding file changes
@@ -279,17 +279,17 @@
   $ hg pull -R clone ssh://user@dummy/repo
   pulling from ssh://user@dummy/repo
   searching for changes
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   adding changesets
   adding manifests
   adding file changes
   added 2 changesets with 2 changes to 2 files (+1 heads)
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   adding changesets
   adding manifests
   adding file changes
   added 2 changesets with 1 changes to 1 files
-  remote: B2X:CHANGEGROUP
+  remote: b2x:changegroup
   adding changesets
   adding manifests
   adding file changes
@@ -324,7 +324,7 @@
   > EOF
   $ hg clone ssh://user@dummy/repo clone
   requesting all changes
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   adding changesets
   adding manifests
   adding file changes
@@ -338,7 +338,7 @@
   > EOF
   $ hg clone ssh://user@dummy/repo clone
   requesting all changes
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   adding changesets
   adding manifests
   adding file changes
@@ -354,7 +354,7 @@
   > EOF
   $ hg clone ssh://user@dummy/repo clone
   requesting all changes
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   adding changesets
   adding manifests
   adding file changes
@@ -372,7 +372,7 @@
   > EOF
   $ hg clone ssh://user@dummy/repo clone
   requesting all changes
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   adding changesets
   adding manifests
   adding file changes
@@ -388,7 +388,7 @@
   > EOF
   $ hg clone ssh://user@dummy/repo clone
   requesting all changes
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   adding changesets
   adding manifests
   adding file changes
@@ -404,7 +404,7 @@
   > EOF
   $ hg clone ssh://user@dummy/repo clone
   requesting all changes
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   adding changesets
   adding manifests
   adding file changes
@@ -433,12 +433,12 @@
   $ hg pull -R clone ssh://user@dummy/repo
   pulling from ssh://user@dummy/repo
   searching for changes
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   adding changesets
   adding manifests
   adding file changes
   added 2 changesets with 2 changes to 2 files (+1 heads)
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   adding changesets
   adding manifests
   adding file changes
@@ -467,7 +467,7 @@
   $ hg pull -R clone ssh://user@dummy/repo
   pulling from ssh://user@dummy/repo
   searching for changes
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   abort: remote-changegroup: missing "url" param
   [255]
 
@@ -479,7 +479,7 @@
   $ hg pull -R clone ssh://user@dummy/repo
   pulling from ssh://user@dummy/repo
   searching for changes
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   abort: remote-changegroup: missing "size" param
   [255]
 
@@ -491,7 +491,7 @@
   $ hg pull -R clone ssh://user@dummy/repo
   pulling from ssh://user@dummy/repo
   searching for changes
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   abort: remote-changegroup: invalid value for param "size"
   [255]
 
@@ -503,7 +503,7 @@
   $ hg pull -R clone ssh://user@dummy/repo
   pulling from ssh://user@dummy/repo
   searching for changes
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   adding changesets
   adding manifests
   adding file changes
@@ -522,7 +522,7 @@
   $ hg pull -R clone ssh://user@dummy/repo
   pulling from ssh://user@dummy/repo
   searching for changes
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   abort: missing support for b2x:remote-changegroup - digest:foo
   [255]
 
@@ -534,7 +534,7 @@
   $ hg pull -R clone ssh://user@dummy/repo
   pulling from ssh://user@dummy/repo
   searching for changes
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   abort: remote-changegroup: missing "digest:sha1" param
   [255]
 
@@ -546,7 +546,7 @@
   $ hg pull -R clone ssh://user@dummy/repo
   pulling from ssh://user@dummy/repo
   searching for changes
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   abort: remote-changegroup does not support ssh urls
   [255]
 
@@ -561,7 +561,7 @@
   $ hg pull -R clone ssh://user@dummy/repo
   pulling from ssh://user@dummy/repo
   searching for changes
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   abort: http://localhost:$HGPORT/notbundle.hg: not a Mercurial bundle
   [255]
 
@@ -576,7 +576,7 @@
   $ hg pull -R clone ssh://user@dummy/repo
   pulling from ssh://user@dummy/repo
   searching for changes
-  remote: B2X:REMOTE-CHANGEGROUP
+  remote: b2x:remote-changegroup
   abort: http://localhost:$HGPORT/notbundle10.hg: not a bundle version 1.0
   [255]