Patchwork [2,of,7,c-hglib] hg_read_header: better name for unexpected channels

login
register
mail settings
Submitter Giovanni Gherdovich
Date Nov. 23, 2014, 5:54 p.m.
Message ID <e7ee8936e3389c091036.1416765286@tosh>
Download mbox | patch
Permalink /patch/6831/
State Accepted
Delegated to: Pierre-Yves David
Headers show

Comments

Giovanni Gherdovich - Nov. 23, 2014, 5:54 p.m.
# HG changeset patch
# User Giovanni Gherdovich <g.gherdovich@gmail.com>
# Date 1416479957 -3600
#      Thu Nov 20 11:39:17 2014 +0100
# Branch refactor examples
# Node ID e7ee8936e3389c091036ccc1790eb140d1cafaa1
# Parent  0dc61b8b4a873ba6174f3c56937d4ba4c960088c
hg_read_header: better name for unexpected channels

If c-hglib sees any channel name other than 'o', 'e', 'I', 'L', 'r'
it must ignore it.
This "catch-all case" was named "wrong_channel".
Since there is nothing "wrong" with an unexpected name,
it's just unsupported, this patch renames it to "unknown_channel".
Yuya Nishihara - Nov. 24, 2014, 10:37 a.m.
On Sun, 23 Nov 2014 18:54:46 +0100, Giovanni Gherdovich wrote:
> # HG changeset patch
> # User Giovanni Gherdovich <g.gherdovich@gmail.com>
> # Date 1416479957 -3600
> #      Thu Nov 20 11:39:17 2014 +0100
> # Branch refactor examples
> # Node ID e7ee8936e3389c091036ccc1790eb140d1cafaa1
> # Parent  0dc61b8b4a873ba6174f3c56937d4ba4c960088c
> hg_read_header: better name for unexpected channels
> 
> If c-hglib sees any channel name other than 'o', 'e', 'I', 'L', 'r'
> it must ignore it.

OT: unknown channels of uppercase letter should not be ignored. Typically,
the server will stop until the client sends some response.

http://mercurial.selenic.com/wiki/CommandServer#Channels

> This "catch-all case" was named "wrong_channel".
> Since there is nothing "wrong" with an unexpected name,
> it's just unsupported, this patch renames it to "unknown_channel".
Giovanni Gherdovich - Nov. 24, 2014, 7:14 p.m.
>
> OT: unknown channels of uppercase letter should not be ignored. Typically,
> the server will stop until the client sends some response.
>
> http://mercurial.selenic.com/wiki/CommandServer#Channels
>

Ah, good catch Yuya, thanks.
That part of the spec went totally over my head.
It's OT for the change I do here, but still the commit message contain
false information.

Will wait a few days to see if there is any other comment, then send a V2
with an amended commit message.

GGhh
Matt Mackall - Nov. 25, 2014, 8:45 p.m.
On Mon, 2014-11-24 at 20:14 +0100, Giovanni Gherdovich wrote:
> >
> > OT: unknown channels of uppercase letter should not be ignored. Typically,
> > the server will stop until the client sends some response.
> >
> > http://mercurial.selenic.com/wiki/CommandServer#Channels
> >
> 
> Ah, good catch Yuya, thanks.
> That part of the spec went totally over my head.
> It's OT for the change I do here, but still the commit message contain
> false information.
> 
> Will wait a few days to see if there is any other comment, then send a V2
> with an amended commit message.

I've queued these with a tweak to the second commit message. Please
follow-up with something that enforces the upper/lower distinction.

Patch

diff -r 0dc61b8b4a87 -r e7ee8936e338 hglib/client.c
--- a/hglib/client.c	Sat Nov 22 11:14:37 2014 +0100
+++ b/hglib/client.c	Thu Nov 20 11:39:17 2014 +0100
@@ -51,7 +51,7 @@ 
 		handle->header->channel = L;
 		break;
 	default:
-		handle->header->channel = wrong_channel;
+		handle->header->channel = unknown_channel;
 		break;
 	}
 	return handle->header;
diff -r 0dc61b8b4a87 -r e7ee8936e338 hglib/client.h
--- a/hglib/client.h	Sat Nov 22 11:14:37 2014 +0100
+++ b/hglib/client.h	Thu Nov 20 11:39:17 2014 +0100
@@ -15,7 +15,7 @@ 
 	r = 'r',
 	I = 'I',
 	L = 'L',
-	wrong_channel
+	unknown_channel
 };
 
 /**