git-review 0.8.4 → 0.8.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/lib/git-review.rb +9 -1
- metadata +3 -3
data/lib/git-review.rb
CHANGED
|
@@ -121,10 +121,13 @@ class GitReview
|
|
|
121
121
|
@local_branch = "review_#{Time.now.strftime("%y%m%d")}_#{branch_name}"
|
|
122
122
|
git_call "checkout -b #{@local_branch}"
|
|
123
123
|
if source_branch == @local_branch
|
|
124
|
+
# Stash any uncommitted changes.
|
|
125
|
+
git_call('stash') if (save_uncommitted_changes = !git_call('diff HEAD').empty?)
|
|
124
126
|
# Go back to master and get rid of pending commits (as these are now on the new branch).
|
|
125
127
|
git_call "checkout #{target_branch}"
|
|
126
128
|
git_call "reset --hard origin/#{target_branch}"
|
|
127
129
|
git_call "checkout #{@local_branch}"
|
|
130
|
+
git_call('stash pop') if save_uncommitted_changes
|
|
128
131
|
end
|
|
129
132
|
else
|
|
130
133
|
@local_branch = source_branch
|
|
@@ -136,6 +139,11 @@ class GitReview
|
|
|
136
139
|
def create
|
|
137
140
|
# Prepare @local_branch.
|
|
138
141
|
prepare
|
|
142
|
+
# Don't create request with uncommitted changes in current branch.
|
|
143
|
+
unless git_call('diff HEAD').empty?
|
|
144
|
+
puts 'You have uncommitted changes. Please stash or commit before creating the request.'
|
|
145
|
+
return
|
|
146
|
+
end
|
|
139
147
|
unless git_call("cherry #{target_branch}").empty?
|
|
140
148
|
# Push latest commits to the remote branch (and by that, create it if necessary).
|
|
141
149
|
git_call "push --set-upstream origin #{@local_branch}"
|
|
@@ -154,7 +162,7 @@ class GitReview
|
|
|
154
162
|
puts 'Successfully created new request.'
|
|
155
163
|
end
|
|
156
164
|
else
|
|
157
|
-
|
|
165
|
+
puts 'Nothing to push to remote yet. Commit something first.'
|
|
158
166
|
end
|
|
159
167
|
end
|
|
160
168
|
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: git-review
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 53
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 8
|
|
9
|
-
-
|
|
10
|
-
version: 0.8.
|
|
9
|
+
- 5
|
|
10
|
+
version: 0.8.5
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Dominik Bamberger, Cristian Messel
|