Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
7a81968e
提交
7a81968e
authored
8月 19, 2015
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-7988 add -askall and -noedit params
上级
28368584
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
95 行增加
和
46 行删除
+95
-46
filebug.pl
support-d/utils/filebug.pl
+95
-46
没有找到文件。
support-d/utils/filebug.pl
浏览文件 @
7a81968e
#!/usr/bin/perl
#use strict;
use
Getopt::
Long
qw(GetOptions)
;
use
Term::
ReadKey
;
use
JIRA::
REST
;
use
Data::
Dumper
;
my
$editor
=
$ENV
{
"EDITOR"
}
||
$ENV
{
"VISUAL"
}
||
`which emacs`
||
`which vi`
;
my
$default_versions
=
"1.7"
;
my
$default_components
=
"freeswitch-core"
;
sub
getpass
{
ReadMode
(
"noecho"
);
print
"Password: "
;
...
...
@@ -14,23 +19,35 @@ sub getpass {
return
$pwd
;
}
sub
getuser
{
print
"User: "
;
chomp
(
my
$usr
=
<>
);
return
$usr
;
sub
getfield
{
my
$prompt
=
shift
;
my
$default
=
shift
;
print
$prompt
.
(
$default
?
"[$default]: "
:
""
);
chomp
(
my
$data
=
<>
);
if
(
!
$data
)
{
$data
=
$default
;
}
return
$data
;
}
sub
get_text
{
my
@chars
=
(
"A"
..
"Z"
,
"a"
..
"z"
);
my
$string
;
$string
.=
$chars
[
rand
@chars
]
for
1
..
8
;
my
$editor
=
$ENV
{
"EDITOR"
}
||
$ENV
{
"VISUAL"
}
||
`which emacs`
||
`which vi`
;
system
(
"$editor /tmp/TEXT.$string"
);
my
$text
=
`cat /tmp/TEXT.$string`
;
unlink
(
"/tmp/TEXT.$string"
);
return
$text
;
my
$text
=
shift
;
my
@chars
=
(
"A"
..
"Z"
,
"a"
..
"z"
);
my
$string
;
$string
.=
$chars
[
rand
@chars
]
for
1
..
8
;
if
(
$text
)
{
open
O
,
">/tmp/TEXT.$string"
;
print
O
$text
;
close
O
;
}
system
(
"$editor /tmp/TEXT.$string"
);
my
$newtext
=
`cat /tmp/TEXT.$string`
;
unlink
(
"/tmp/TEXT.$string"
);
return
$newtext
;
}
my
%
opts
;
...
...
@@ -39,32 +56,39 @@ my $hashtxt = `git log -1 --oneline 2>/dev/null`;
my
(
$hash
)
=
split
(
" "
,
$hashtxt
);
GetOptions
(
'project=s'
=>
\
$opts
{
project
},
'summary=s'
=>
\
$opts
{
summary
},
'desc=s'
=>
\
$opts
{
desc
},
'components=s'
=>
\
$opts
{
components
},
'hash=s'
=>
\
$opts
{
hash
},
'user=s'
=>
\
$opts
{
user
},
'pass=s'
=>
\
$opts
{
pass
},
'type=s'
=>
\
$opts
{
type
},
'debug'
=>
\
$opts
{
debug
},
)
or
die
"Usage: $0 -summary <summary> -desc <desc> [-debug] ....\n"
;
'project=s'
=>
\
$opts
{
project
},
'summary=s'
=>
\
$opts
{
summary
},
'desc=s'
=>
\
$opts
{
desc
},
'components=s'
=>
\
$opts
{
components
},
'hash=s'
=>
\
$opts
{
hash
},
'user=s'
=>
\
$opts
{
user
},
'pass=s'
=>
\
$opts
{
pass
},
'type=s'
=>
\
$opts
{
type
},
'versions=s'
=>
\
$opts
{
versions
},
'noedit'
=>
\
$opts
{
noedit
},
'askall'
=>
\
$opts
{
askall
},
'debug'
=>
\
$opts
{
debug
},
)
or
die
"Usage: $0 -summary <summary> -desc <desc> [-debug] ....\n"
;
$opts
{
project
}
or
$opts
{
project
}
=
"FS"
;
if
(
$opts
{
component
s
})
{
$opts
{
components_array
}
=
[
map {{nam
e
=>
$_
}}
split
(
" "
,
$opts
{
component
s
})];
if
(
$opts
{
version
s
})
{
$opts
{
versions_array
}
=
[
map {{nam
e
=>
$_
}}
split
(
" "
,
$opts
{
version
s
})];
}
else
{
$opts
{
components_array
}
=
[
map {{nam
e
=>
$_
}}
qw(freeswitch-core)
];
$opts
{
versions_array
}
=
[
map {{name => $_}} ($defaul
t_versions
)];
$opts
{
versions
}
=
$default_versions
;;
}
#print Dumper \%opts;
#exit;
if
(
$opts
{
components
})
{
$opts
{
components_array
}
=
[
map {{nam
e
=>
$_
}}
split
(
" "
,
$opts
{
components
})];
}
else
{
$opts
{
components_array
}
=
[
map {{name => $_}} ($defaul
t_components
)];
$opts
{
components
}
=
$default_components
;
}
if
(
!
$opts
{
user
})
{
$opts
{
user
}
=
get
user
(
);
$opts
{
user
}
=
get
field
(
"User: "
);
}
if
(
!
$opts
{
pass
}
&&
!
$opts
{
debug
})
{
...
...
@@ -86,24 +110,48 @@ if (!$opts{type}) {
$opts
{
type
}
=
"Bug"
;
}
if
(
!
$opts
{
summary
})
{
die
"missing summary:"
;
}
if
(
!
$opts
{
hash
})
{
$opts
{
hash
}
=
$hash
;
if
(
!
$opts
{
desc
})
{
$opts
{
desc
}
=
get_text
();
if
(
!
$opts
{
hash
})
{
$opts
{
hash
}
=
"N/A"
;
}
}
if
(
!
$opts
{
desc
})
{
die
"missing desc:"
;
}
if
(
$opts
{
askall
})
{
$opts
{
project
}
=
getfield
(
"Project: "
,
$opts
{
project
});
$opts
{
type
}
=
getfield
(
"Type: "
,
$opts
{
type
});
$opts
{
versions
}
=
getfield
(
"Versions: "
,
$opts
{
versions
});
$opts
{
versions_array
}
=
[
map {{nam
e
=>
$_
}}
split
(
" "
,
$opts
{
versions
})];
$opts
{
summary
}
=
getfield
(
"Summary: "
,
$opts
{
summary
});
$opts
{
components
}
=
getfield
(
"Components: "
,
$opts
{
components
});
$opts
{
components_array
}
=
[
map {{nam
e
=>
$_
}}
split
(
" "
,
$opts
{
components
})];
$opts
{
hash
}
=
getfield
(
"GIT Hash: "
,
$opts
{
hash
});
if
(
$opts
{
noedit
})
{
$opts
{
desc
}
=
getfield
(
"Description: "
,
$opts
{
desc
});
}
else
{
$opts
{
desc
}
=
get_text
(
$opts
{
desc
});
}
}
if
(
!
$opts
{
hash
})
{
$opts
{
hash
}
=
$hash
;
if
(
!
$opts
{
desc
})
{
if
(
$opts
{
noedit
})
{
$opts
{
desc
}
=
getfield
(
"Description: "
,
$opts
{
desc
});
}
else
{
$opts
{
desc
}
=
get_text
(
$opts
{
desc
});
}
if
(
!
$opts
{
desc
})
{
die
"missing desc:"
;
}
}
if
(
!
$opts
{
hash
})
{
$opts
{
hash
}
=
"N/A"
;
}
if
(
!
$opts
{
summary
})
{
$opts
{
summary
}
=
getfield
(
"Summary: "
,
$opts
{
summary
});
if
(
!
$opts
{
summary
})
{
die
"Summary is mandatory."
;
}
}
my
$input
=
{
...
...
@@ -114,7 +162,8 @@ my $input = {
description
=>
$opts
{
desc
},
customfield_10024
=>
$opts
{
hash
},
customfield_10025
=>
$opts
{
hash
},
components
=>
$opts
{
components_array
}
components
=>
$opts
{
components_array
},
affectsVersion
=>
$opts
{
versions_array
}
},
};
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论