changeset 24:ec816f1fb2d1

Add clang-format file
author ng0@n0.is
date Fri, 03 May 2019 11:22:35 +0000
parents df30fc374169
children 472ac0205242
files .clang-format Makefile cvsps.1
diffstat 3 files changed, 174 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.clang-format	Fri May 03 11:22:35 2019 +0000
@@ -0,0 +1,137 @@
+#BasedOnStyle: Chromium
+#Language: Cpp
+#MaxEmptyLinesToKeep: 3
+#AllowShortIfStatementsOnASingleLine: false
+#AllowShortLoopsOnASingleLine: false
+#DerivePointerAlignment: false
+#PointerAlignment: Right
+#TabWidth: 4
+#UseTab: Always
+#IndentWidth: 4
+#BreakBeforeBraces: Linux
+#AccessModifierOffset: -4
+
+---
+Language:        Cpp
+# BasedOnStyle:  LLVM
+AccessModifierOffset: -4
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlines: Left
+AlignOperands:   true
+AlignTrailingComments: false
+AllowAllArgumentsOnNextLine: false
+AllowAllParametersOfDeclarationOnNextLine: false
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: TopLevel
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: MultiLine
+BinPackArguments: false
+BinPackParameters: false
+BraceWrapping:
+  AfterClass:      false
+  AfterControlStatement: true
+  AfterEnum:       true
+  AfterFunction:   true
+  AfterNamespace:  false
+  AfterObjCDeclaration: false
+  AfterStruct:     true
+  AfterUnion:      true
+  AfterExternBlock: false
+  BeforeCatch:     false
+  BeforeElse:      true
+  IndentBraces:    false
+  SplitEmptyFunction: true
+  SplitEmptyRecord: true
+  SplitEmptyNamespace: true
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeInheritanceComma: false
+BreakInheritanceList: BeforeColon
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+BreakConstructorInitializers: BeforeColon
+BreakAfterJavaFieldAnnotations: false
+BreakStringLiterals: false
+ColumnLimit:     80
+CommentPragmas:  '^ IWYU pragma:'
+CompactNamespaces: false
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 2
+ContinuationIndentWidth: 2
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+DisableFormat:   false
+ExperimentalAutoDetectBinPacking: true
+FixNamespaceComments: true
+ForEachMacros:   
+  - foreach
+  - Q_FOREACH
+  - BOOST_FOREACH
+IncludeBlocks:   Preserve
+IncludeCategories: 
+  - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
+    Priority:        2
+  - Regex:           '^(<|"(gtest|gmock|isl|json)/)'
+    Priority:        3
+  - Regex:           '.*'
+    Priority:        1
+IncludeIsMainRegex: '(Test)?$'
+IndentCaseLabels: false
+IndentPPDirectives: None
+IndentWidth:     8
+IndentWrappedFunctionNames: false
+JavaScriptQuotes: Leave
+JavaScriptWrapImports: true
+KeepEmptyLinesAtTheStartOfBlocks: true
+MacroBlockBegin: ''
+MacroBlockEnd:   ''
+MaxEmptyLinesToKeep: 2
+NamespaceIndentation: None
+ObjCBinPackProtocolList: Auto
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 2
+PenaltyBreakBeforeFirstCallParameter: 9999999
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerAlignment: Right
+ReflowComments:  true
+SortIncludes:    false
+SortUsingDeclarations: true
+SpaceAfterCStyleCast: true
+SpaceAfterLogicalNot: true
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
+SpaceBeforeParens: Always
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles:  false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard:        Cpp11
+StatementMacros:
+  - Q_UNUSED
+  - QT_REQUIRE_VERSION
+TabWidth:        2
+UseTab:          Never
+...
+
+
--- a/Makefile	Fri May 03 11:22:10 2019 +0000
+++ b/Makefile	Fri May 03 11:22:35 2019 +0000
@@ -1,39 +1,16 @@
-MAJOR=2
-MINOR=2b2
-CC?=gcc
-CFLAGS?=-g -O2 -Wall
-CPPFLAGS+=-I. -DVERSION=\"$(MAJOR).$(MINOR)\"
-LDLIBS+=-lz
-PREFIX?=/usr/local
-MANPREFIX?=${PREFIX}/share/man
-PROG=cvsps
-OBJS=\
-	cbtcommon/debug.o\
-	cbtcommon/hash.o\
-	cbtcommon/text_util.o\
-	cbtcommon/sio.o\
-	cbtcommon/tcpsocket.o\
-	cvsps.o\
-	cache.o\
-	util.o\
-	stats.o\
-	cap.o\
-	cvs_direct.o\
-	list_sort.o
+PROG=		cvsps
+MAJOR=		2
+MINOR=		2b2
+
+DFLAGS=		-DVERSION=\"$(MAJOR).$(MINOR)\"
 
-all: ${PROG}
+CPPFLAGS+=	-I${.CURDIR} -I.
+CPPFLAGS+=	${DFLAGS}
 
-cvsps: $(OBJS)
+LDADD+=		-lz
 
-install:
-	install -d ${DESTDIR}${PREFIX}/bin ${MANPREFIX}/man1
-	install -m 755 cvsps ${DESTDIR}${PREFIX}/bin
-	install -m 644 cvsps.1 ${DESTDIR}${MANPREFIX}/man1
+MAN+=		cvsps.1
 
-clean:
-	rm -f cvsps *.o cbtcommon/*.o core
+CLEANFILES+=	*~ *.o
 
-check:
-	printf "No tests\n"
-
-.PHONY: install clean
+.include <bsd.prog.mk>
--- a/cvsps.1	Fri May 03 11:22:10 2019 +0000
+++ b/cvsps.1	Fri May 03 11:22:35 2019 +0000
@@ -1,10 +1,10 @@
 .TH "cvsps" 1
-.SH NAME
+.Sh NAME
 CVSps \- create patchset information from CVS
-.SH SYNOPSIS
+.Sh SYNOPSIS
 .B cvsps
 [\-h] [\-x] [\-u] [\-z <fuzz>] [\-g] [\-s <patchset>] [\-a <author>] [\-f <file>] [\-d <date1> [\-d <date2>]] [\-l <text>] [\-b <branch>] [\-r <tag> [\-r <tag>]] [\-p <directory>] [\-v] [\-t] [\-\-norc] [\-\-summary\-first] [\-\-test\-log <filename>] [\-\-bkcvs] [\-\-no\-rlog] [\-\-diff\-opts <option string>] [\-\-cvs\-direct] [\-\-debuglvl <bitmask>] [\-Z <compression>] [\-\-root <cvsroot>] [\-q] [\-A] [<repository>]
-.SH DESCRIPTION
+.Sh DESCRIPTION
 CVSps is a program for generating 'patchset' information from a CVS
 repository.  A patchset in this case is defined as a set of changes made
 to a collection of files, and all committed at the same time (using a
@@ -12,7 +12,7 @@
 big picture of the evolution of a cvs project.  While cvs tracks revision
 information, it is often difficult to see what changes were committed
 'atomically' to the repository.
-.SH OPTIONS
+.Sh OPTIONS
 .TP
 .B \-h
 display usage summary
@@ -109,7 +109,7 @@
 .TP
 .B \<repository>
 Operate on the specified repository (overrides working dir.)
-.SH "NOTE ON TAG HANDLING"
+.Sh "NOTE ON TAG HANDLING"
 Tags are fundamentally 'file at a time' in cvs, but like everything else,
 it would be nice to imagine that they are 'repository at a time.'  The
 approach cvsps takes is that a tag is assigned to a patchset.  The meaning
@@ -134,7 +134,7 @@
 cvsps will flag each member of the affected patchsets as before or after the tag
 and the patchset summary will indicate which members are which, and diffs will
 be generated accordingly.
-.SH "NOTE ON CVS VERSIONS"
+.Sh "NOTE ON CVS VERSIONS"
 Among the different cvs subcommands used by cvsps is the 'rlog' command.  The
 rlog command is used to get revision history of a module, and it disregards
 the current working directory.  The important difference between 'rlog' and 'log'
@@ -149,7 +149,7 @@
 different semantics and usage.  cvsps will attempt to work around this problem
 by detecting capable versions of cvs.  If an old version is detected, 'log' will
 be used instead of 'rlog', and YMMV.
-.SH "NOTE ON GENERATED DIFFS"
+.Sh "NOTE ON GENERATED DIFFS"
 Another important note is that cvsps will attempt, whenever possible, to use the
 r\-commands (rlog, rdiff  and co) instead of the local commands (log, diff, and update).
 This is to allow cvsps to function without a completely checked out tree.  Because
@@ -161,14 +161,14 @@
 directory in the path, and \-p0 will be required when applying the patch.  When
 diffs are generated in cvs\-direct mode (see below), however, they will always
 be \-p1 style patches.
-.SH "NOTE ON BKCVS"
+.Sh "NOTE ON BKCVS"
 The \-\-bkcvs option is a special operating mode that should only be used when parsing
 the log files from the BK \-> CVS exported linux kernel trees.  cvsps uses special
 semantics for recreating the BK ChangeSet metadata that has been embedded in the log
 files for those trees.  The \-\-bkcvs option should only be specified when the cache
 file is being created or updated (i.e. initial run of cvsps, or when \-u and \-x options
 are used).
-.SH "NOTE ON CVS\-DIRECT"
+.Sh "NOTE ON CVS\-DIRECT"
 As of version 2.0b6 cvsps has a partial implementation of the cvs client code built
 in.  This reduces the RTT and/or handshaking overhead from one per patchset member
 to one per patchset.  This dramatically increases the speed of generating diffs
@@ -177,30 +177,30 @@
 2.0 comes out.  The built\-in cvs code attempts to be compatible with cvs, but may
 have problems, which should be reported.  It honors the CVS_RSH and CVS_SERVER
 environment variables, but does not parse the ~/.cvsrc file.
-.SH "NOTE ON CVSPS RC FILE"
+.Sh "NOTE ON CVSPS RC FILE"
 CVSps parses an rc file at startup.  This file should be located in ~/.cvsps/cvspsrc.
 The file should contain arguments, in the exact syntax as the command line, one per line.
 If an argument takes a parameter, the parameter should be on the same line as the argument.
-.SH "NOTE ON DATE FORMATS"
+.Sh "NOTE ON DATE FORMATS"
 All dates are reported in localtime.  This can be overridden (as usual) using the TZ
 environment variable.  Dates as arguments must be in the format 'yyyy/mm/dd hh:mm:ss'; for example,
 .IP "" 4
 $ cvsps -d '2004/05/01 00:00:00' -d '2004/07/07 12:00:00'
-.SH "SEE ALSO"
-.BR cvs ( 1 ),
-.BR ci ( 1 ),
-.BR co ( 1 ),
-.BR cvs ( 5 ),
-.BR cvsbug ( 8 ),
-.BR diff ( 1 ),
-.BR grep ( 1 ),
-.BR patch ( 1 ),
-.BR rcs ( 1 ),
-.BR rcsdiff ( 1 ),
-.BR rcsmerge ( 1 ),
-.BR rlog ( 1 ).
-.SH "REPORTING BUGS"
+.Sh "SEE ALSO"
+.Xr cvs 1 ,
+.Xr ci 1 ,
+.Xr co 1 ,
+.Xr diff 1 ,
+.Xr grep 1 ,
+.Xr patch 1 ,
+.Xr rcs 1 ,
+.Xr rcsdiff 1 ,
+.Xr rcsmerge 1 ,
+.Xr rlog 1 ,
+.Xr cvs 5 ,
+.Xr cvsbug 8
+.Sh "REPORTING BUGS"
 Report bugs to "David Mansfield <cvsps@dm.cobite.com>"
-.SH BUGS
+.Sh BUGS
 No known bugs.