Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
github
hub
提交
1d5d4ba3
H
hub
项目概览
github
/
hub
11 个月 前同步成功
通知
3
Star
22523
Fork
2406
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1d5d4ba3
编写于
9月 27, 2015
作者:
M
Mislav Marohnić
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #861 from github/crash_report_improvement
Improve crash report with command and version
上级
a5cf30e9
a4698bcf
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
44 addition
and
25 deletion
+44
-25
commands/updater.go
commands/updater.go
+5
-4
commands/version.go
commands/version.go
+2
-13
github/crash_report.go
github/crash_report.go
+18
-5
script/build
script/build
+1
-1
script/package
script/package
+2
-2
version/version.go
version/version.go
+16
-0
未找到文件。
commands/updater.go
浏览文件 @
1d5d4ba3
...
@@ -18,6 +18,7 @@ import (
...
@@ -18,6 +18,7 @@ import (
"github.com/github/hub/github"
"github.com/github/hub/github"
"github.com/github/hub/ui"
"github.com/github/hub/ui"
"github.com/github/hub/utils"
"github.com/github/hub/utils"
"github.com/github/hub/version"
)
)
const
(
const
(
...
@@ -27,15 +28,15 @@ const (
...
@@ -27,15 +28,15 @@ const (
var
EnableAutoUpdate
=
false
var
EnableAutoUpdate
=
false
func
NewUpdater
()
*
Updater
{
func
NewUpdater
()
*
Updater
{
ver
sion
:=
os
.
Getenv
(
"HUB_VERSION"
)
ver
:=
os
.
Getenv
(
"HUB_VERSION"
)
if
ver
sion
==
""
{
if
ver
==
""
{
ver
sion
=
Version
ver
=
version
.
Version
}
}
timestampPath
:=
filepath
.
Join
(
os
.
Getenv
(
"HOME"
),
".config"
,
"hub-update"
)
timestampPath
:=
filepath
.
Join
(
os
.
Getenv
(
"HOME"
),
".config"
,
"hub-update"
)
return
&
Updater
{
return
&
Updater
{
Host
:
github
.
DefaultGitHubHost
(),
Host
:
github
.
DefaultGitHubHost
(),
CurrentVersion
:
ver
sion
,
CurrentVersion
:
ver
,
timestampPath
:
timestampPath
,
timestampPath
:
timestampPath
,
}
}
}
}
...
...
commands/version.go
浏览文件 @
1d5d4ba3
package
commands
package
commands
import
(
import
(
"fmt"
"os"
"os"
"github.com/github/hub/git"
"github.com/github/hub/ui"
"github.com/github/hub/ui"
"github.com/github/hub/
utils
"
"github.com/github/hub/
version
"
)
)
var
Version
=
"2.2.1"
var
cmdVersion
=
&
Command
{
var
cmdVersion
=
&
Command
{
Run
:
runVersion
,
Run
:
runVersion
,
Usage
:
"version"
,
Usage
:
"version"
,
...
@@ -23,13 +19,6 @@ func init() {
...
@@ -23,13 +19,6 @@ func init() {
}
}
func
runVersion
(
cmd
*
Command
,
args
*
Args
)
{
func
runVersion
(
cmd
*
Command
,
args
*
Args
)
{
gitVersion
,
err
:=
git
.
Version
()
ui
.
Println
(
version
.
FullVersion
())
utils
.
Check
(
err
)
ghVersion
:=
fmt
.
Sprintf
(
"hub version %s"
,
Version
)
ui
.
Println
(
gitVersion
)
ui
.
Println
(
ghVersion
)
os
.
Exit
(
0
)
os
.
Exit
(
0
)
}
}
github/crash_report.go
浏览文件 @
1d5d4ba3
...
@@ -12,6 +12,7 @@ import (
...
@@ -12,6 +12,7 @@ import (
"github.com/github/hub/git"
"github.com/github/hub/git"
"github.com/github/hub/ui"
"github.com/github/hub/ui"
"github.com/github/hub/utils"
"github.com/github/hub/utils"
"github.com/github/hub/version"
)
)
const
(
const
(
...
@@ -74,19 +75,31 @@ func report(reportedError error, stack string) {
...
@@ -74,19 +75,31 @@ func report(reportedError error, stack string) {
ui
.
Println
(
issue
.
HTMLURL
)
ui
.
Println
(
issue
.
HTMLURL
)
}
}
func
reportTitleAndBody
(
reportedError
error
,
stack
string
)
(
title
,
body
string
,
err
error
)
{
const
crashReportTmpl
=
"Crash report - %v
\n\n
"
+
message
:=
"Crash report - %v
\n\n
Error (%s): `%v`
\n\n
Stack:
\n\n
```
\n
%s
\n
```
\n\n
Runtime:
\n\n
```
\n
%s
\n
```
\n\n
"
"Error (%s): `%v`
\n\n
"
+
message
+=
`
"Stack:
\n\n
```
\n
%s
\n
```
\n\n
"
+
"Runtime:
\n\n
```
\n
%s
\n
```
\n\n
"
+
"Version:
\n\n
```
\n
%s
\n
```
\n
"
+
`
# Creating crash report:
# Creating crash report:
#
#
# This information will be posted as a new issue under
jingweno/gh
.
# This information will be posted as a new issue under
github/hub
.
# We're NOT including any information about the command that you were executing,
# We're NOT including any information about the command that you were executing,
# but knowing a little bit more about it would really help us to solve this problem.
# but knowing a little bit more about it would really help us to solve this problem.
# Feel free to modify the title and the description for this issue.
# Feel free to modify the title and the description for this issue.
`
`
func
reportTitleAndBody
(
reportedError
error
,
stack
string
)
(
title
,
body
string
,
err
error
)
{
errType
:=
reflect
.
TypeOf
(
reportedError
)
.
String
()
errType
:=
reflect
.
TypeOf
(
reportedError
)
.
String
()
message
=
fmt
.
Sprintf
(
message
,
reportedError
,
errType
,
reportedError
,
stack
,
runtimeInfo
())
message
:=
fmt
.
Sprintf
(
crashReportTmpl
,
reportedError
,
errType
,
reportedError
,
stack
,
runtimeInfo
(),
version
.
FullVersion
(),
)
editor
,
err
:=
NewEditor
(
"CRASH_REPORT"
,
"crash report"
,
message
)
editor
,
err
:=
NewEditor
(
"CRASH_REPORT"
,
"crash report"
,
message
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
script/build
浏览文件 @
1d5d4ba3
...
@@ -41,7 +41,7 @@ up_to_date() {
...
@@ -41,7 +41,7 @@ up_to_date() {
build_hub
()
{
build_hub
()
{
setup_gopath
setup_gopath
[
-
n
"$1"
]
&&
(
up_to_date
"$1"
||
go
build
-
ldflags
"-X github.com/github/hub/
commands
.Version `./script/version`"
-
o
"$1"
)
[
-
n
"$1"
]
&&
(
up_to_date
"$1"
||
go
build
-
ldflags
"-X github.com/github/hub/
version
.Version `./script/version`"
-
o
"$1"
)
}
}
test_hub
()
{
test_hub
()
{
...
...
script/package
浏览文件 @
1d5d4ba3
...
@@ -100,7 +100,7 @@ class Packer
...
@@ -100,7 +100,7 @@ class Packer
end
end
def
parse_version!
def
parse_version!
content
=
File
.
read
root_path
(
"
commands
"
,
"version.go"
)
content
=
File
.
read
root_path
(
"
version
"
,
"version.go"
)
match
=
/var Version = "(.+)"/
.
match
content
match
=
/var Version = "(.+)"/
.
match
content
raise
"Fail to parse Hub version"
unless
match
raise
"Fail to parse Hub version"
unless
match
...
@@ -137,7 +137,7 @@ class Packer
...
@@ -137,7 +137,7 @@ class Packer
# specifying osarch for Windows
# specifying osarch for Windows
# see https://github.com/mitchellh/gox/issues/19#issuecomment-68117016
# see https://github.com/mitchellh/gox/issues/19#issuecomment-68117016
osarch
=
OS
.
windows?
?
"windows/
#{
OS
.
windows_64?
?
"amd64"
:
"386"
}
"
:
""
osarch
=
OS
.
windows?
?
"windows/
#{
OS
.
windows_64?
?
"amd64"
:
"386"
}
"
:
""
cmd
=
"gox -os=
#{
OS
.
type
}
-output=
#{
output
}
-ldflags
\"
-X github.com/github/hub/
commands
.Version
#{
release_version
}
\"
"
cmd
=
"gox -os=
#{
OS
.
type
}
-output=
#{
output
}
-ldflags
\"
-X github.com/github/hub/
version
.Version
#{
release_version
}
\"
"
cmd
+=
" -osarch=
#{
osarch
}
"
unless
osarch
.
empty?
cmd
+=
" -osarch=
#{
osarch
}
"
unless
osarch
.
empty?
exec
!
(
cmd
)
exec
!
(
cmd
)
end
end
...
...
version/version.go
0 → 100644
浏览文件 @
1d5d4ba3
package
version
import
(
"fmt"
"github.com/github/hub/git"
"github.com/github/hub/utils"
)
var
Version
=
"2.2.0"
func
FullVersion
()
string
{
gitVersion
,
err
:=
git
.
Version
()
utils
.
Check
(
err
)
return
fmt
.
Sprintf
(
"%s
\n
hub version %s"
,
gitVersion
,
Version
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录