[PATCH 2 of 2] chg: format code by clang-format version 11.0.1-+rc1-1

Yuya Nishihara yuya at tcha.org
Sat Dec 19 03:56:40 UTC 2020


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1608347244 -32400
#      Sat Dec 19 12:07:24 2020 +0900
# Node ID babd57945ad10283f753b25d15ab593811959a70
# Parent  5db45dfd6206490f8668559838c8888c4d4ca9ac
chg: format code by clang-format version 11.0.1-+rc1-1

test-check-clang-format.t started failing on my Debian sid environment, and
new style looks slightly better. So let's bump the required clang-format
version to 11.

diff --git a/contrib/chg/chg.c b/contrib/chg/chg.c
--- a/contrib/chg/chg.c
+++ b/contrib/chg/chg.c
@@ -451,9 +451,10 @@ static int runinstructions(struct cmdser
  */
 static int isunsupported(int argc, const char *argv[])
 {
-	enum { SERVE = 1,
-	       DAEMON = 2,
-	       SERVEDAEMON = SERVE | DAEMON,
+	enum {
+		SERVE = 1,
+		DAEMON = 2,
+		SERVEDAEMON = SERVE | DAEMON,
 	};
 	unsigned int state = 0;
 	int i;
diff --git a/contrib/chg/hgclient.c b/contrib/chg/hgclient.c
--- a/contrib/chg/hgclient.c
+++ b/contrib/chg/hgclient.c
@@ -26,15 +26,16 @@
 #include "procutil.h"
 #include "util.h"
 
-enum { CAP_GETENCODING = 0x0001,
-       CAP_RUNCOMMAND = 0x0002,
-       /* cHg extension: */
-       CAP_ATTACHIO = 0x0100,
-       CAP_CHDIR = 0x0200,
-       CAP_SETENV = 0x0800,
-       CAP_SETUMASK2 = 0x1000,
-       CAP_VALIDATE = 0x2000,
-       CAP_SETPROCNAME = 0x4000,
+enum {
+	CAP_GETENCODING = 0x0001,
+	CAP_RUNCOMMAND = 0x0002,
+	/* cHg extension: */
+	CAP_ATTACHIO = 0x0100,
+	CAP_CHDIR = 0x0200,
+	CAP_SETENV = 0x0800,
+	CAP_SETUMASK2 = 0x1000,
+	CAP_VALIDATE = 0x2000,
+	CAP_SETPROCNAME = 0x4000,
 };
 
 typedef struct {
diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -592,8 +592,8 @@ def has_pylint():
 @check("clang-format", "clang-format C code formatter")
 def has_clang_format():
     m = matchoutput('clang-format --version', br'clang-format version (\d+)')
-    # style changed somewhere between 4.x and 6.x
-    return m and int(m.group(1)) >= 6
+    # style changed somewhere between 10.x and 11.x
+    return m and int(m.group(1)) >= 11
 
 
 @check("jshint", "JSHint static code analysis tool")




More information about the Mercurial-devel mailing list