changeset 50517:cd2a2963b982

stream-clone: upgrade the error message for bad stream request The new version if more compact and more consistent with the general Mercurial usage.
author Arseniy Alekseyev <aalekseyev@janestreet.com>
date Sun, 21 May 2023 00:00:29 +0200
parents 43ed1f12b00a
children f2bcb56a1d39
files mercurial/bundle2.py tests/test-clone-stream.t
diffstat 2 files changed, 9 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundle2.py	Sun May 21 03:21:00 2023 +0200
+++ b/mercurial/bundle2.py	Sun May 21 00:00:29 2023 +0200
@@ -1881,17 +1881,9 @@
         return
 
     if not streamclone.allowservergeneration(repo):
-        raise error.Abort(
-            _(
-                b'stream data requested but server does not allow '
-                b'this feature'
-            ),
-            hint=_(
-                b'well-behaved clients should not be '
-                b'requesting stream data from servers not '
-                b'advertising it; the client may be buggy'
-            ),
-        )
+        msg = _(b'stream data requested but server does not allow this feature')
+        hint = _(b'the client seems buggy')
+        raise error.Abort(msg, hint=hint)
 
     # Stream clones don't compress well. And compression undermines a
     # goal of stream clones, which is to be fast. Communicate the desire
--- a/tests/test-clone-stream.t	Sun May 21 03:21:00 2023 +0200
+++ b/tests/test-clone-stream.t	Sun May 21 00:00:29 2023 +0200
@@ -164,10 +164,10 @@
   
 
   $ f --size body --hexdump --bytes 100
-  body: size=232
+  body: size=140
   0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
-  0010: cf 0b 45 52 52 4f 52 3a 41 42 4f 52 54 00 00 00 |..ERROR:ABORT...|
-  0020: 00 01 01 07 3c 04 72 6d 65 73 73 61 67 65 73 74 |....<.rmessagest|
+  0010: 73 0b 45 52 52 4f 52 3a 41 42 4f 52 54 00 00 00 |s.ERROR:ABORT...|
+  0020: 00 01 01 07 3c 04 16 6d 65 73 73 61 67 65 73 74 |....<..messagest|
   0030: 72 65 61 6d 20 64 61 74 61 20 72 65 71 75 65 73 |ream data reques|
   0040: 74 65 64 20 62 75 74 20 73 65 72 76 65 72 20 64 |ted but server d|
   0050: 6f 65 73 20 6e 6f 74 20 61 6c 6c 6f 77 20 74 68 |oes not allow th|
@@ -232,10 +232,10 @@
   
 
   $ f --size body --hexdump --bytes 100
-  body: size=232
+  body: size=140
   0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
-  0010: cf 0b 45 52 52 4f 52 3a 41 42 4f 52 54 00 00 00 |..ERROR:ABORT...|
-  0020: 00 01 01 07 3c 04 72 6d 65 73 73 61 67 65 73 74 |....<.rmessagest|
+  0010: 73 0b 45 52 52 4f 52 3a 41 42 4f 52 54 00 00 00 |s.ERROR:ABORT...|
+  0020: 00 01 01 07 3c 04 16 6d 65 73 73 61 67 65 73 74 |....<..messagest|
   0030: 72 65 61 6d 20 64 61 74 61 20 72 65 71 75 65 73 |ream data reques|
   0040: 74 65 64 20 62 75 74 20 73 65 72 76 65 72 20 64 |ted but server d|
   0050: 6f 65 73 20 6e 6f 74 20 61 6c 6c 6f 77 20 74 68 |oes not allow th|