Merge lp:~chipaca/snappy/precommit into lp:~snappy-dev/snappy/snappy-moved-to-github

Proposed by John Lenton
Status: Merged
Approved by: John Lenton
Approved revision: 704
Merged at revision: 706
Proposed branch: lp:~chipaca/snappy/precommit
Merge into: lp:~snappy-dev/snappy/snappy-moved-to-github
Diff against target: 169 lines (+76/-40)
4 files modified
.precommit (+32/-0)
.tarmac.sh (+1/-1)
i18n/xgettext-go/main.go (+0/-2)
run-checks (+43/-37)
To merge this branch: bzr merge lp:~chipaca/snappy/precommit
Reviewer Review Type Date Requested Status
Michael Vogt (community) Approve
Review via email: mp+271290@code.launchpad.net

Commit message

Added a precommit hook. Made some changes to run-checks to make it better as a precommit script.

Also made vet happy wrt unreachable code in xgettext-go.

Description of the change

A very silly branch that you can ignore until things are less manic.

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

Looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file '.precommit'
--- .precommit 1970-01-01 00:00:00 +0000
+++ .precommit 2015-09-16 12:23:49 +0000
@@ -0,0 +1,32 @@
1#!/bin/sh
2set -e
3echo "$@"
4# put me in the project root, call me ".precommit".
5# And put this here-document in ~/.bazaar/plugins/precommit_script.py:
6<<EOF
7import os
8
9if not os.getenv("SKIP_COMMIT_HOOK"):
10 import subprocess
11 from bzrlib.mutabletree import MutableTree
12 from bzrlib import errors
13
14 def start_commit_hook(*_):
15 """This hook will execute '.precommit' script from root path of the bazaar
16 branch. Commit will be canceled if precommit fails."""
17
18 # this hook only makes sense if a precommit file exist.
19 if not os.path.exists(".precommit"):
20 return
21 try:
22 subprocess.check_call(os.path.abspath(".precommit"))
23 # if precommit fails (process return not zero) cancel commit.
24 except subprocess.CalledProcessError:
25 raise errors.BzrError("pre commit check failed (set SKIP_COMMIT_HOOK to skip).")
26
27 MutableTree.hooks.install_named_hook('start_commit', start_commit_hook,
28 'Run "precommit" script on start_commit')
29EOF
30
31./run-checks --quick
32
033
=== modified file '.tarmac.sh'
--- .tarmac.sh 2015-02-13 13:29:27 +0000
+++ .tarmac.sh 2015-09-16 12:23:49 +0000
@@ -11,4 +11,4 @@
11cp -a . $GOPATH/src/launchpad.net/snappy/11cp -a . $GOPATH/src/launchpad.net/snappy/
12cd $GOPATH/src/launchpad.net/snappy12cd $GOPATH/src/launchpad.net/snappy
1313
14./run-checks14sh -v ./run-checks
1515
=== modified file 'i18n/xgettext-go/main.go'
--- i18n/xgettext-go/main.go 2015-09-10 06:16:31 +0000
+++ i18n/xgettext-go/main.go 2015-09-16 12:23:49 +0000
@@ -89,8 +89,6 @@
89 default:89 default:
90 panic(fmt.Sprintf("unknown type: %v", val))90 panic(fmt.Sprintf("unknown type: %v", val))
91 }91 }
92
93 return ""
94}92}
9593
96func inspectNodeForTranslations(fset *token.FileSet, f *ast.File, n ast.Node) bool {94func inspectNodeForTranslations(fset *token.FileSet, f *ast.File, n ast.Node) bool {
9795
=== modified file 'run-checks'
--- run-checks 2015-09-02 18:11:49 +0000
+++ run-checks 2015-09-16 12:23:49 +0000
@@ -1,6 +1,6 @@
1#!/bin/sh1#!/bin/sh
22
3set -ev3set -eu
44
5if which goctest >/dev/null; then5if which goctest >/dev/null; then
6 goctest="goctest"6 goctest="goctest"
@@ -8,6 +8,11 @@
8 goctest="go test"8 goctest="go test"
9fi9fi
1010
11QUICK=""
12if [ "${1:-}" = "--quick" ]; then
13 QUICK=yes
14fi
15
11echo Checking docs16echo Checking docs
12./mdlint.py docs/*.md17./mdlint.py docs/*.md
1318
@@ -20,27 +25,26 @@
20 exit 125 exit 1
21fi26fi
2227
23echo Installing godeps28if [ -z "$QUICK" ]; then
24go get launchpad.net/godeps29 echo Installing godeps
25export PATH=$PATH:$GOPATH/bin30 go get launchpad.net/godeps
2631 export PATH=$PATH:$GOPATH/bin
27echo Install golint32
28go get github.com/golang/lint/golint33 echo Install golint
29export PATH=$PATH:$GOPATH/bin34 go get github.com/golang/lint/golint
3035 export PATH=$PATH:$GOPATH/bin
31echo Obtaining dependencies36
32godeps -u dependencies.tsv37 echo Obtaining dependencies
3338 godeps -u dependencies.tsv
3439
3540 echo Building
36echo Building41 go build -v launchpad.net/snappy/...
37go build -v launchpad.net/snappy/...42
3843
3944 # tests
40# tests45 echo Running tests from $(pwd)
41echo Running tests from $(pwd)46 $goctest -v -cover ./...
42$goctest -v -cover ./...47fi
43
4448
45# go vet49# go vet
46echo Running vet50echo Running vet
@@ -67,21 +71,23 @@
67fi71fi
6872
6973
70# integration tests74if [ -z "$QUICK" ]; then
71echo Building the integration tests75 # integration tests
72go build _integration-tests/main.go76 echo Building the integration tests
7377 go build _integration-tests/main.go
74# the rabbit hole78
75echo Running the tests for the integration testutils79 # the rabbit hole
76$goctest -v -cover ./_integration-tests/testutils/...80 echo Running the tests for the integration testutils
7781 $goctest -v -cover ./_integration-tests/testutils/...
78# integration suite in kvm82
79if which adt-run >/dev/null 2>&1; then83 # integration suite in kvm
80 echo "Running integration tests on rolling edge"84 if which adt-run >/dev/null 2>&1; then
81 go run _integration-tests/main.go --snappy-from-branch85 echo "Running integration tests on rolling edge"
82 # print the results.86 go run _integration-tests/main.go --snappy-from-branch
83 if which subunit2pyunit >/dev/null 2>&1; then87 # print the results.
84 subunit-1to2 /tmp/snappy-test/output/artifacts/results.subunit | subunit2pyunit88 if which subunit2pyunit >/dev/null 2>&1; then
89 subunit-1to2 /tmp/snappy-test/output/artifacts/results.subunit | subunit2pyunit
90 fi
85 fi91 fi
86fi92fi
8793

Subscribers

People subscribed via source and target branches