git-review 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/git-review.rb +10 -5
- metadata +2 -2
data/lib/git-review.rb
CHANGED
@@ -79,16 +79,17 @@ class GitReview
|
|
79
79
|
def merge
|
80
80
|
return unless request_exists?
|
81
81
|
option = @args.shift
|
82
|
-
unless @current_request['head']['
|
82
|
+
unless @current_request['head']['repo']
|
83
83
|
# Someone deleted the source repo.
|
84
84
|
user = @current_request['head']['user']['login']
|
85
85
|
url = @current_request['patch_url']
|
86
86
|
puts "Sorry, #{user} deleted the source repository, git-review doesn't support this."
|
87
|
-
puts '
|
87
|
+
puts 'Tell the contributor not to do this.'
|
88
|
+
puts
|
89
|
+
puts 'You can still manually patch your repo by running:'
|
88
90
|
puts
|
89
91
|
puts " curl #{url} | git am"
|
90
92
|
puts
|
91
|
-
puts 'Tell the contributor not to do this.'
|
92
93
|
return false
|
93
94
|
end
|
94
95
|
message = "Accept request ##{@current_request['number']} and merge changes into \"#{target}\""
|
@@ -125,10 +126,12 @@ class GitReview
|
|
125
126
|
# Prepare local repository to create a new request.
|
126
127
|
# Sets @local_branch.
|
127
128
|
def prepare
|
129
|
+
# Remember original branch the user was currently working on.
|
130
|
+
@original_branch = source_branch
|
128
131
|
# People should work on local branches, but especially for single commit changes,
|
129
132
|
# more often than not, they don't. Therefore we create a branch for them,
|
130
133
|
# to be able to use code review the way it is intended.
|
131
|
-
if
|
134
|
+
if @original_branch == target_branch
|
132
135
|
# Unless a branch name is already provided, ask for one.
|
133
136
|
if (branch_name = @args.shift).nil?
|
134
137
|
puts 'Please provide a name for the branch:'
|
@@ -147,7 +150,7 @@ class GitReview
|
|
147
150
|
git_call('stash pop') if save_uncommitted_changes
|
148
151
|
end
|
149
152
|
else
|
150
|
-
@local_branch =
|
153
|
+
@local_branch = @original_branch
|
151
154
|
end
|
152
155
|
end
|
153
156
|
|
@@ -178,6 +181,8 @@ class GitReview
|
|
178
181
|
if potential_new_request and potential_new_request['number'] > last_request_id
|
179
182
|
puts "Successfully created new request ##{potential_new_request['number']}."
|
180
183
|
end
|
184
|
+
# Return to the user's original branch.
|
185
|
+
git_call "checkout #{@original_branch}"
|
181
186
|
else
|
182
187
|
puts 'Nothing to push to remote yet. Commit something first.'
|
183
188
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-review
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: launchy
|