Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
kvdb
rocksdb
提交
78ee2250
R
rocksdb
项目概览
kvdb
/
rocksdb
11 个月 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rocksdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
78ee2250
编写于
1月 14, 2014
作者:
N
Naman Gupta
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of github.com:facebook/rocksdb into sanitizedOptions
上级
1d9bac4d
d702d807
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
93 addition
and
43 deletion
+93
-43
.clang-format
.clang-format
+0
-42
Makefile
Makefile
+10
-1
build_tools/format-diff.sh
build_tools/format-diff.sh
+83
-0
未找到文件。
.clang-format
浏览文件 @
78ee2250
...
...
@@ -2,46 +2,4 @@
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html
---
BasedOnStyle: Google
AccessModifierOffset: -1
ConstructorInitializerIndentWidth: 4
AlignEscapedNewlinesLeft: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: true
BreakBeforeBinaryOperators: false
BreakConstructorInitializersBeforeComma: false
BinPackParameters: false
ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: true
DerivePointerBinding: true
ExperimentalAutoDetectBinPacking: true
IndentCaseLabels: false
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 10
PenaltyBreakComment: 60
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 20
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerBindsToType: true
SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: true
Standard: Cpp11
IndentWidth: 2
TabWidth: 8
UseTab: Never
BreakBeforeBraces: Attach
IndentFunctionDeclarationAfterType: false
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
...
Makefile
浏览文件 @
78ee2250
...
...
@@ -135,7 +135,7 @@ endif # PLATFORM_SHARED_EXT
all
:
$(LIBRARY) $(PROGRAMS) $(SHARED)
.PHONY
:
blackbox_crash_test check clean coverage crash_test ldb_tests
\
release tags valgrind_check whitebox_crash_test
release tags valgrind_check whitebox_crash_test
format
release
:
$(MAKE)
clean
...
...
@@ -196,6 +196,9 @@ tags:
ctags
*
-R
cscope
-b
`
find
.
-name
'*.cc'
`
`
find
.
-name
'*.h'
`
format
:
build_tools/format-diff.sh
# ---------------------------------------------------------------------------
# Unit tests and tools
# ---------------------------------------------------------------------------
...
...
@@ -411,6 +414,12 @@ DEPFILES = $(filter-out util/build_version.d,$(SOURCES:.cc=.d))
depend
:
$(DEPFILES)
# if the make goal is either "clean" or "format", we shouldn't
# try to import the *.d files.
# TODO(kailiu) The unfamiliarity of Make's conditions leads to the ugly
# working solution.
ifneq
($(MAKECMDGOALS),clean)
ifneq
($(MAKECMDGOALS),format)
-include
$(DEPFILES)
endif
endif
build_tools/format-diff.sh
0 → 100755
浏览文件 @
78ee2250
#!/bin/bash
set
-e
# If clang_format_diff.py command is not specfied, we assume we are able to
# access directly without any path.
if
[
-z
$CLANG_FORMAT_DIFF
]
then
CLANG_FORMAT_DIFF
=
"clang-format-diff.py"
fi
# Check clang-format-diff.py
if
!
which
$CLANG_FORMAT_DIFF
&> /dev/null
then
echo
"You didn't have clang-format-diff.py available in your computer!"
echo
"You can download it by running: "
echo
" curl https://fburl.com/clang-format-diff"
exit
128
fi
# Check argparse, a library that clang-format-diff.py requires.
python 2>/dev/null
<<
EOF
import argparse
EOF
if
[
"
$?
"
!=
0
]
then
echo
"To run clang-format-diff.py, we'll need the library "
argparse
" to be"
echo
"installed. You can try either of the follow ways to install it:"
echo
" 1. Manually download argparse: https://pypi.python.org/pypi/argparse"
echo
" 2. easy_install argparse (if you have easy_install)"
echo
" 3. pip install argparse (if you have pip)"
exit
129
fi
# TODO(kailiu) following work is not complete since we still need to figure
# out how to add the modified files done pre-commit hook to git's commit index.
#
# Check if this script has already been added to pre-commit hook.
# Will suggest user to add this script to pre-commit hook if their pre-commit
# is empty.
# PRE_COMMIT_SCRIPT_PATH="`git rev-parse --show-toplevel`/.git/hooks/pre-commit"
# if ! ls $PRE_COMMIT_SCRIPT_PATH &> /dev/null
# then
# echo "Would you like to add this script to pre-commit hook, which will do "
# echo -n "the format check for all the affected lines before you check in (y/n):"
# read add_to_hook
# if [ "$add_to_hook" == "y" ]
# then
# ln -s `git rev-parse --show-toplevel`/build_tools/format-diff.sh $PRE_COMMIT_SCRIPT_PATH
# fi
# fi
# Check the format of recently changed lines,
diffs
=
$(
git diff
-U0
HEAD^ |
$CLANG_FORMAT_DIFF
-p
1
)
if
[
-z
"
$diffs
"
]
then
echo
"Nothing needs to be reformatted!"
exit
0
fi
# Highlight the insertion/deletion from the clang-format-diff.py's output
COLOR_END
=
"
\0
33[0m"
COLOR_RED
=
"
\0
33[0;31m"
COLOR_GREEN
=
"
\0
33[0;32m"
echo
-e
"Detect lines that doesn't follow the format rules:
\r
"
# Add the color to the diff. lines added will be green; lines removed will be red.
echo
"
$diffs
"
|
sed
-e
"s/
\(
^-.*
$\
)/
`
echo
-e
\"
$COLOR_RED
\1
$COLOR_END
\"
`
/"
|
sed
-e
"s/
\(
^+.*
$\
)/
`
echo
-e
\"
$COLOR_GREEN
\1
$COLOR_END
\"
`
/"
echo
-e
"Would you like to fix the format automatically (y/n):
\c
"
# Make sure under any mode, we can read user input.
exec
< /dev/tty
read
to_fix
if
[
"
$to_fix
"
!=
"y"
]
then
exit
1
fi
# Do in-place format adjustment.
git diff
-U0
HEAD^ |
$CLANG_FORMAT_DIFF
-i
-p
1
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录