Mercurial > hg
annotate tests/test-contrib-check-commit.t @ 29791:28591876fa63
test-gpg: run migration of v1 secret keys beforehand
This suppresses unwanted output at "hg sign".
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 14 Aug 2016 17:07:05 +0900 |
parents | e529b5f1b9e3 |
children | 2fb3ae89e4e1 |
rev | line source |
---|---|
27328
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
1 Test the 'check-commit' script |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
2 ============================== |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
3 |
27700
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
4 A fine patch: |
27328
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
5 |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
6 $ cat > patch-with-long-header.diff << EOF |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
7 > # HG changeset patch |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
8 > # User timeless <timeless@mozdev.org> |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
9 > # Date 1448911706 0 |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
10 > # Mon Nov 30 19:28:26 2015 +0000 |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
11 > # Node ID c41cb6d2b7dbd62b1033727f8606b8c09fc4aa88 |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
12 > # Parent 42aa0e570eaa364a622bc4443b0bcb79b1100a58 |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
13 > # ClownJoke This is a veryly long header that should not be warned about because its not the description |
27700
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
14 > bundle2: use Oxford comma (issue123) (BC) |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
15 > |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
16 > diff --git a/hgext/transplant.py b/hgext/transplant.py |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
17 > --- a/hgext/transplant.py |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
18 > +++ b/hgext/transplant.py |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
19 > @@ -599,7 +599,7 @@ |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
20 > return |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
21 > if not (opts.get('source') or revs or |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
22 > opts.get('merge') or opts.get('branch')): |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
23 > - raise error.Abort(_('no source URL, branch revision or revision ' |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
24 > + raise error.Abort(_('no source URL, branch revision, or revision ' |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
25 > 'list provided')) |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
26 > if opts.get('all'): |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
27 > |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
28 > + def blahblah(x): |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
29 > + pass |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
30 > EOF |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
31 $ cat patch-with-long-header.diff | $TESTDIR/../contrib/check-commit |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
32 |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
33 A patch with lots of errors: |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
34 |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
35 $ cat > patch-with-long-header.diff << EOF |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
36 > # HG changeset patch |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
37 > # User timeless |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
38 > # Date 1448911706 0 |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
39 > # Mon Nov 30 19:28:26 2015 +0000 |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
40 > # Node ID c41cb6d2b7dbd62b1033727f8606b8c09fc4aa88 |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
41 > # Parent 42aa0e570eaa364a622bc4443b0bcb79b1100a58 |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
42 > # ClownJoke This is a veryly long header that should not be warned about because its not the description |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
43 > transplant/foo: this summary is way too long use Oxford comma (bc) (bug123) (issue 244) |
27328
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
44 > |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
45 > diff --git a/hgext/transplant.py b/hgext/transplant.py |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
46 > --- a/hgext/transplant.py |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
47 > +++ b/hgext/transplant.py |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
48 > @@ -599,7 +599,7 @@ |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
49 > return |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
50 > if not (opts.get('source') or revs or |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
51 > opts.get('merge') or opts.get('branch')): |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
52 > - raise error.Abort(_('no source URL, branch revision or revision ' |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
53 > + raise error.Abort(_('no source URL, branch revision, or revision ' |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
54 > 'list provided')) |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
55 > if opts.get('all'): |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
56 > EOF |
96dc6664fa9c
check-commit: add a test for the patch checking script in contrib
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
57 $ cat patch-with-long-header.diff | $TESTDIR/../contrib/check-commit |
27783
1d095371de47
check-commit: sort errors by line number
timeless <timeless@mozdev.org>
parents:
27782
diff
changeset
|
58 1: username is not an email address |
1d095371de47
check-commit: sort errors by line number
timeless <timeless@mozdev.org>
parents:
27782
diff
changeset
|
59 # User timeless |
1d095371de47
check-commit: sort errors by line number
timeless <timeless@mozdev.org>
parents:
27782
diff
changeset
|
60 7: summary keyword should be most user-relevant one-word command or topic |
27700
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
61 transplant/foo: this summary is way too long use Oxford comma (bc) (bug123) (issue 244) |
27783
1d095371de47
check-commit: sort errors by line number
timeless <timeless@mozdev.org>
parents:
27782
diff
changeset
|
62 7: (BC) needs to be uppercase |
27700
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
63 transplant/foo: this summary is way too long use Oxford comma (bc) (bug123) (issue 244) |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
64 7: use (issueDDDD) instead of bug |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
65 transplant/foo: this summary is way too long use Oxford comma (bc) (bug123) (issue 244) |
27783
1d095371de47
check-commit: sort errors by line number
timeless <timeless@mozdev.org>
parents:
27782
diff
changeset
|
66 7: no space allowed between issue and number |
27700
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
67 transplant/foo: this summary is way too long use Oxford comma (bc) (bug123) (issue 244) |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
68 7: summary line too long (limit is 78) |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
69 transplant/foo: this summary is way too long use Oxford comma (bc) (bug123) (issue 244) |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
70 [1] |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
71 |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
72 A patch with other errors: |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
73 |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
74 $ cat > patch-with-long-header.diff << EOF |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
75 > # HG changeset patch |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
76 > # User timeless |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
77 > # Date 1448911706 0 |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
78 > # Mon Nov 30 19:28:26 2015 +0000 |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
79 > # Node ID c41cb6d2b7dbd62b1033727f8606b8c09fc4aa88 |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
80 > # Parent 42aa0e570eaa364a622bc4443b0bcb79b1100a58 |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
81 > # ClownJoke This is a veryly long header that should not be warned about because its not the description |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
82 > This has no topic and ends with a period. |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
83 > |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
84 > diff --git a/hgext/transplant.py b/hgext/transplant.py |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
85 > --- a/hgext/transplant.py |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
86 > +++ b/hgext/transplant.py |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
87 > @@ -599,7 +599,7 @@ |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
88 > if opts.get('all'): |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
89 > |
28013
e529b5f1b9e3
check-commit: check for double-addition of blank lines
Matt Mackall <mpm@selenic.com>
parents:
27783
diff
changeset
|
90 > |
e529b5f1b9e3
check-commit: check for double-addition of blank lines
Matt Mackall <mpm@selenic.com>
parents:
27783
diff
changeset
|
91 > + |
e529b5f1b9e3
check-commit: check for double-addition of blank lines
Matt Mackall <mpm@selenic.com>
parents:
27783
diff
changeset
|
92 > + some = otherjunk |
e529b5f1b9e3
check-commit: check for double-addition of blank lines
Matt Mackall <mpm@selenic.com>
parents:
27783
diff
changeset
|
93 > + |
27700
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
94 > + |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
95 > + def blah_blah(x): |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
96 > + pass |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
97 > + |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
98 > |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
99 > EOF |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
100 $ cat patch-with-long-header.diff | $TESTDIR/../contrib/check-commit |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
101 1: username is not an email address |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
102 # User timeless |
27783
1d095371de47
check-commit: sort errors by line number
timeless <timeless@mozdev.org>
parents:
27782
diff
changeset
|
103 7: don't capitalize summary lines |
27700
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
104 This has no topic and ends with a period. |
27783
1d095371de47
check-commit: sort errors by line number
timeless <timeless@mozdev.org>
parents:
27782
diff
changeset
|
105 7: summary line doesn't start with 'topic: ' |
27700
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
106 This has no topic and ends with a period. |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
107 7: don't add trailing period on summary line |
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
108 This has no topic and ends with a period. |
27783
1d095371de47
check-commit: sort errors by line number
timeless <timeless@mozdev.org>
parents:
27782
diff
changeset
|
109 19: adds double empty line |
1d095371de47
check-commit: sort errors by line number
timeless <timeless@mozdev.org>
parents:
27782
diff
changeset
|
110 + |
28013
e529b5f1b9e3
check-commit: check for double-addition of blank lines
Matt Mackall <mpm@selenic.com>
parents:
27783
diff
changeset
|
111 20: adds a function with foo_bar naming |
e529b5f1b9e3
check-commit: check for double-addition of blank lines
Matt Mackall <mpm@selenic.com>
parents:
27783
diff
changeset
|
112 + def blah_blah(x): |
e529b5f1b9e3
check-commit: check for double-addition of blank lines
Matt Mackall <mpm@selenic.com>
parents:
27783
diff
changeset
|
113 23: adds double empty line |
e529b5f1b9e3
check-commit: check for double-addition of blank lines
Matt Mackall <mpm@selenic.com>
parents:
27783
diff
changeset
|
114 + |
27700
374fad80ce69
tests: extend check-commit self-tests
Matt Mackall <mpm@selenic.com>
parents:
27328
diff
changeset
|
115 [1] |