git-si 0.2.4 → 0.3.0

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/git/si.rb +29 -6
  3. data/lib/git/si/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4685908b89dbddc4f3109c5151d448f404671e4d
4
- data.tar.gz: 625f88967c58c4d7eb7b58763ab7c9d42b42ea76
3
+ metadata.gz: c77dbf792e64c63bff1a45af38b1554db4d32d0d
4
+ data.tar.gz: 45647e4d3e817d743fda2559d11fc52e84ac8588
5
5
  SHA512:
6
- metadata.gz: 5e8de12a928e493f16d6028bbd474963a3ea75dfc8e12f039a4be0140d91503a6814d4787fcac9ed2a892dc47a38fb8e5f1d2ed55737aa9194c00100edfa251d
7
- data.tar.gz: fc4199a2c41eac79973432f8e5fe8313cdd7d7b27fead45007ce3e81957412c580f9335eed413a1043fe36ac2f13f34a1fad0e535ce9e76914df7da8a1955181
6
+ metadata.gz: d2ce1a14dbaa857ccdbfa81b06b8ab117a76cf6f060779a848bec3f4f540bef6a74b0b965d04aa1eda7747145501c1dad9ff4ace08fae315931c3709c00d2649
7
+ data.tar.gz: e6c9b056273c3592539963724ed417f0206641fbfea819386f5ffafe92381b422066b8882865cfc972248668ee4009db4a2dddc8f7c0e09603d7cdb63d8161e9
data/lib/git/si.rb CHANGED
@@ -119,9 +119,23 @@ use the commands below.
119
119
  end
120
120
  on_mirror_branch do
121
121
  notice_message "Fetching remote data from svn"
122
- run_command("svn up --accept theirs-full --ignore-externals")
122
+ updated_files = `svn up --accept theirs-full --ignore-externals`
123
+ files_to_add = []
124
+ updated_files.each_line do |line|
125
+ say line
126
+ case line.strip!
127
+ when /^\w\s+(\S.+)/
128
+ files_to_add << '"' + $1 + '"'
129
+ end
130
+ end
131
+ notice_message "Reverting any local changes in mirror branch"
123
132
  run_command("svn revert -R ./")
124
- system("git add .")
133
+ unless files_to_add.empty?
134
+ files_to_add.each do |filename|
135
+ say "Updating file in git: #{filename}"
136
+ end
137
+ system("git add " + files_to_add.join(' '))
138
+ end
125
139
  run_command("git commit --allow-empty -am 'svn update to version #{get_svn_version}'")
126
140
  end
127
141
  success_message "fetch complete!"
@@ -168,12 +182,21 @@ continue, it's wise to reset the master branch afterward."
168
182
 
169
183
  run_command("svn commit")
170
184
  success_message "commit complete!"
171
- if yes? "Do you want to update the mirror branch to the latest commit? [y/N] ", :green
172
- on_mirror_branch do
173
- fetch
174
- mirror_is_updated = true
185
+
186
+ files_unchanged = true
187
+ git_status = `git status --porcelain`
188
+ files_unchanged = false if git_status.match(/^[^\?]/)
189
+ unless files_unchanged
190
+ if yes? "Some files were added or modified during the commit; should I revert them? [y/N] ", :yellow
191
+ run_command("git reset --hard HEAD")
192
+ files_unchanged = true
175
193
  end
176
194
  end
195
+
196
+ if files_unchanged and yes? "Do you want to update the mirror branch to the latest commit? [y/N] ", :green
197
+ fetch
198
+ mirror_is_updated = true
199
+ end
177
200
  end
178
201
 
179
202
  if mirror_is_updated
@@ -1,5 +1,5 @@
1
1
  module Git
2
2
  module Si
3
- VERSION = "0.2.4"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-si
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Payton Swick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-09 00:00:00.000000000 Z
11
+ date: 2014-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler