git-review-notes 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/features/git-review.feature
CHANGED
@@ -7,13 +7,15 @@ Feature: Adding 'Reviewed-By:' note for reviewed commits
|
|
7
7
|
When I run `git checkout branch-for-review`
|
8
8
|
And I run `git log`
|
9
9
|
Then the output should not contain "Reviewed-By:"
|
10
|
-
When I run `git review`
|
10
|
+
When I run `git review` interactively
|
11
|
+
And I type "y"
|
11
12
|
Then the output should contain "Reviewed-By: Reviewer <reviewer@example.com>"
|
12
|
-
And the output should contain "
|
13
|
+
And the output should contain "refs/notes/commits -> refs/notes/commits"
|
13
14
|
|
14
15
|
Scenario: Mark already merged commits
|
15
16
|
When I run `git log`
|
16
17
|
Then the output should not contain "Reviewed-By:"
|
17
|
-
When I run `git review commits HEAD HEAD~1`
|
18
|
+
When I run `git review commits HEAD HEAD~1` interactively
|
19
|
+
And I type "y"
|
18
20
|
Then the output should contain "Reviewed-By: Reviewer <reviewer@example.com>"
|
19
|
-
And the output should contain "
|
21
|
+
And the output should contain "refs/notes/commits -> refs/notes/commits"
|
@@ -2,33 +2,46 @@ require 'active_support/core_ext/kernel/reporting'
|
|
2
2
|
|
3
3
|
Before do
|
4
4
|
setup_sample_repository
|
5
|
+
@dirs = ["tmp/aruba/workcopy"]
|
5
6
|
end
|
6
7
|
|
7
8
|
def setup_sample_repository
|
8
9
|
silence_stream(STDERR) do
|
9
10
|
silence_stream(STDOUT) do
|
10
11
|
system <<-SHELL
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
12
|
+
rm -rf tmp/aruba
|
13
|
+
mkdir -p tmp/aruba/origin
|
14
|
+
|
15
|
+
cd tmp/aruba/origin
|
16
|
+
git init --bare
|
17
|
+
cd ..
|
18
|
+
|
19
|
+
git clone origin/ workcopy/
|
20
|
+
cd workcopy
|
21
|
+
pwd
|
22
|
+
|
23
|
+
git config --add user.name Reviewer
|
24
|
+
git config --add user.email reviewer@example.com
|
25
|
+
|
26
|
+
touch README
|
27
|
+
git add README
|
28
|
+
git commit -m 'first commit.'
|
29
|
+
touch Gemfile
|
30
|
+
git add Gemfile
|
31
|
+
git commit -m 'second commit.'
|
32
|
+
git push origin master
|
33
|
+
|
34
|
+
git branch branch-for-review
|
35
|
+
git checkout branch-for-review
|
36
|
+
touch file1
|
37
|
+
git add file1
|
38
|
+
git commit -m 'commit 1 in branch-for-review.'
|
39
|
+
touch file2
|
40
|
+
git add file2
|
41
|
+
git commit -m 'commit 2 in branch-for-review.'
|
42
|
+
git push origin branch-for-review
|
43
|
+
|
44
|
+
git checkout master
|
32
45
|
SHELL
|
33
46
|
end
|
34
47
|
end
|
data/lib/git_review_notes/cli.rb
CHANGED
@@ -9,20 +9,18 @@ module GitReviewNotes
|
|
9
9
|
|
10
10
|
current_branch_commits = git.log.between("master", git.current_branch)
|
11
11
|
add_reviewed_by(current_branch_commits)
|
12
|
-
push_refs_notes
|
13
12
|
|
14
13
|
system "git log master..#{git.current_branch}"
|
15
|
-
|
14
|
+
ask_for_pushing_review(current_branch_commits)
|
16
15
|
end
|
17
16
|
|
18
17
|
desc "commits", "Add not with Reviewed-By: for specified commits separated by space."
|
19
18
|
def commits(*commits_shas)
|
20
19
|
commits = commits_shas.map {|sha| git.object(sha)}
|
21
20
|
add_reviewed_by(commits)
|
22
|
-
push_refs_notes
|
23
21
|
|
24
22
|
system "git log"
|
25
|
-
|
23
|
+
ask_for_pushing_review(commits)
|
26
24
|
end
|
27
25
|
|
28
26
|
|
@@ -43,9 +41,11 @@ module GitReviewNotes
|
|
43
41
|
system "git push origin refs/notes/*"
|
44
42
|
end
|
45
43
|
|
46
|
-
def
|
44
|
+
def ask_for_pushing_review(commits)
|
47
45
|
puts
|
48
|
-
|
46
|
+
if yes?("Are you sure about to push this review for #{commits.size} commit(s)? [y/N]", :green)
|
47
|
+
push_refs_notes
|
48
|
+
end
|
49
49
|
end
|
50
50
|
|
51
51
|
def git
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-review-notes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Aleksei Gusev
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-11-
|
18
|
+
date: 2011-11-28 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: git
|