Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
9155e4ff
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
接近 2 年 前同步成功
通知
1
Star
18
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Harfbuzz
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9155e4ff
编写于
5月 08, 2012
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cleanup diff
Doesn't do --color anymore. That will go into a new hb-diff-colorize tool.
上级
7d22135b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
21 deletion
+21
-21
test/shaping/hb-diff
test/shaping/hb-diff
+3
-7
test/shaping/hb_test_tools.py
test/shaping/hb_test_tools.py
+18
-14
未找到文件。
test/shaping/hb-diff
浏览文件 @
9155e4ff
...
...
@@ -3,12 +3,8 @@
from
hb_test_tools
import
*
import
sys
,
os
colors
=
Colors
.
Auto
(
sys
.
argv
)
if
len
(
sys
.
argv
)
!=
3
:
print
"usage: %s [--color] file1 file2"
%
sys
.
argv
[
0
]
if
len
(
sys
.
argv
)
<
3
:
print
"usage: %s file1 file2..."
%
sys
.
argv
[
0
]
sys
.
exit
(
1
)
files
=
(
FileHelpers
.
open_file_or_stdin
(
f
)
for
f
in
sys
.
argv
[
1
:
3
])
FancyDiffer
.
diff_files
(
*
files
,
colors
=
colors
)
ZipDiffer
.
diff_files
(
FileHelpers
.
open_file_or_stdin
(
f
)
for
f
in
sys
.
argv
[
1
:])
test/shaping/hb_test_tools.py
浏览文件 @
9155e4ff
...
...
@@ -3,6 +3,9 @@
import
sys
,
os
,
re
,
difflib
,
unicodedata
,
errno
from
itertools
import
*
diff_symbols
=
"-+=*&^%$#@!~/"
diff_colors
=
[
'red'
,
'green'
,
'blue'
]
class
Colors
:
class
Null
:
red
=
''
...
...
@@ -89,20 +92,20 @@ class FancyDiffer:
return
[
' '
,
oo
[
0
],
'
\n
'
]
return
[
'-'
,
oo
[
0
],
'
\n
'
,
'+'
,
oo
[
1
],
'
\n
'
]
class
ZipDiffer
:
@
staticmethod
def
diff_files
(
f1
,
f2
,
colors
=
Colors
.
Null
):
def
diff_files
(
files
,
symbols
=
diff_symbols
):
files
=
tuple
(
files
)
# in case it's a generator, copy it
try
:
for
(
l1
,
l2
)
in
izip
(
f1
,
f2
):
if
l1
==
l2
:
sys
.
stdout
.
writelines
([
" "
,
l
1
])
for
lines
in
izip_longest
(
*
files
):
if
all
(
lines
[
0
]
==
line
for
line
in
lines
[
1
:])
:
sys
.
stdout
.
writelines
([
" "
,
l
ines
[
0
]
])
continue
sys
.
stdout
.
writelines
(
FancyDiffer
.
diff_lines
(
l1
,
l2
,
colors
))
# print out residues
for
l
in
f1
:
sys
.
stdout
.
writelines
([
"-"
,
colors
.
red
,
l
,
colors
.
end
])
for
l
in
f2
:
sys
.
stdout
.
writelines
([
"-"
,
colors
.
green
,
l
,
colors
.
end
])
for
i
,
l
in
enumerate
(
lines
):
if
l
:
sys
.
stdout
.
writelines
([
symbols
[
i
],
l
])
except
IOError
as
e
:
if
e
.
errno
!=
errno
.
EPIPE
:
print
>>
sys
.
stderr
,
"%s: %s: %s"
%
(
sys
.
argv
[
0
],
e
.
filename
,
e
.
strerror
)
...
...
@@ -112,9 +115,9 @@ class FancyDiffer:
class
DiffFilters
:
@
staticmethod
def
filter_failures
(
f
):
def
filter_failures
(
f
,
symbols
=
diff_symbols
):
for
l
in
f
:
if
l
[
0
]
in
'-+'
:
if
l
[
0
]
in
symbols
:
# TODO retain all lines of the failure
yield
l
...
...
@@ -146,12 +149,13 @@ class UtilMains:
@
staticmethod
def
process_multiple_files
(
callback
,
mnemonic
=
"FILE"
):
if
len
(
sys
.
argv
)
==
1
:
if
"--help"
in
sys
.
argv
:
print
"Usage: %s %s..."
%
(
sys
.
argv
[
0
],
mnemonic
)
sys
.
exit
(
1
)
try
:
for
s
in
sys
.
argv
[
1
:]:
files
=
sys
.
argv
[
1
:]
if
len
(
sys
.
argv
)
>
1
else
[
'-'
]
for
s
in
files
:
callback
(
FileHelpers
.
open_file_or_stdin
(
s
))
except
IOError
as
e
:
if
e
.
errno
!=
errno
.
EPIPE
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录