git-si 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d8b981e514fb17acde6931c0b798d36a28d0544
4
- data.tar.gz: 0cad14a2f7c3a24f52439f731bec169132f42b02
3
+ metadata.gz: 2885ccf96954518937e9ec898c075081f098655c
4
+ data.tar.gz: 4853b379d09f6360f1b4582e589f75a9d95e43b6
5
5
  SHA512:
6
- metadata.gz: bba2942db8d9ce95ce755e9eba06f8c437ddf4c4a729e460cfe90f7b207ea95ebef9846baa23b3a315d491df9c5b9477caa1d2ac20c4c7169af389989b82ffc8
7
- data.tar.gz: 1f5325dd2baeb1cb95b8d853f78d9de3d53c09cfe29157facef891fe7f95d1021c39e0eefda8d28f9c9f8b9ab3cf7576b344c05d7c28e08b22977e05744e2529
6
+ metadata.gz: c77d7b7a5b4ae1efce186b13b016b4362fc7d77a0f82c7754fca2f596a4b99db3a3f4e6966c22c15e85ba23f37bc05884f904b3a0027f2c4b27b32ed28703827
7
+ data.tar.gz: ce7c31528eca1fb2ab5c7db72423ba6e5d531ec26b68be2dde507aa0aea2cda8566806668834b364ed2b9351e9c3e1d6c089c3f60dabb1fc7a3406b26f964a4f
data/README.md CHANGED
@@ -29,17 +29,19 @@ This will take you into your favorite editor to enter a commit message.
29
29
 
30
30
  All commands:
31
31
 
32
- git si add [FILES] # Perform an svn and a git add on the files.
33
- git si blame <FILE> # Alias for svn blame.
34
- git si commit # Perform an svn commit and update the mirror branch.
35
- git si diff [FILES] # Perform an svn diff piped through a colorizer. Also tests to be sure a rebase is not needed.
36
- git si fetch # Updates mirror branch to latest svn commit.
37
- git si help [COMMAND] # Describe available commands or one specific command
38
- git si init # Initializes git-si in this directory with a gitignore and creates a special mirror branch.
39
- git si pull # Fetch the latest svn commit and rebase the current branch.
40
- git si rebase # Rebases current branch to mirror branch.
41
- git si status [FILES] # Perform an svn status.
42
- git si usage # How does this thing work?
32
+ git-si add [FILES] # Perform an svn and a git add on the files.
33
+ git-si blame <FILE> # Alias for svn blame.
34
+ git-si commit # Perform an svn commit and update the mirror branch.
35
+ git-si diff [FILES] # Perform an svn diff piped through a colorizer. Also tests to be sure a rebase is not needed.
36
+ git-si fetch # Updates mirror branch to latest svn commit.
37
+ git-si help [COMMAND] # Describe available commands or one specific command
38
+ git-si init # Initializes git-si in this directory with a gitignore and creates a special mirror branch.
39
+ git-si pull # Fetch the latest svn commit and rebase the current branch.
40
+ git-si readd # Add files to svn that have been added to git.
41
+ git-si rebase # Rebases current branch to mirror branch.
42
+ git-si status [FILES] # Perform an svn status.
43
+ git-si usage # How does this thing work?
44
+ git-si version # Print the version.
43
45
 
44
46
 
45
47
  ## Contributing
data/git-si.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["payton@foolord.com"]
11
11
  spec.description = %q{Git Svn Interface: a simple git extention to use git locally with a remote svn repo.}
12
12
  spec.summary = %q{It's like a simple version of git-svn which doesn't keep track of history locally.}
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/sirbrillig/git-si"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
@@ -1,5 +1,5 @@
1
1
  module Git
2
2
  module Si
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
data/lib/git/si.rb CHANGED
@@ -29,6 +29,11 @@ module Git
29
29
 
30
30
  @@mirror_branch = 'MIRRORBRANCH'
31
31
 
32
+ desc "version", "Print the version."
33
+ def version
34
+ say "git-si version #{Git::Si::VERSION}"
35
+ end
36
+
32
37
  desc "usage", "How does this thing work?"
33
38
  def usage
34
39
  say "git-si #{Git::Si::VERSION}
@@ -77,6 +82,9 @@ use the commands below.
77
82
  notice_message "Could not determine last version information. This may be fine if you haven't used git-si before."
78
83
  end
79
84
 
85
+ notice_message "Adding any files that are not already in svn to ensure an accurate diff."
86
+ readd()
87
+
80
88
  command = "svn diff " + args.join(' ')
81
89
  notice_message "Running #{command}"
82
90
  results = `#{command}`
@@ -146,6 +154,10 @@ continue, it's wise to reset the master branch afterward."
146
154
 
147
155
  git_status = `git status --porcelain`
148
156
  raise GitError.new("There are local changes; please commit them before continuing.") if git_status.match(/^[^\?]/)
157
+
158
+ notice_message "Adding any files that are not already in svn to ensure changes are committed."
159
+ readd()
160
+
149
161
  svn_diff = `svn diff`
150
162
  raise SvnError.new("Failed to get the svn diff. I'm not sure why. Check for any errors above.") if ! $?.success?
151
163
  raise SvnError.new("There are no changes to commit.") if svn_diff.strip.empty?
@@ -180,6 +192,36 @@ continue, it's wise to reset the master branch afterward."
180
192
  end
181
193
  end
182
194
 
195
+ desc "readd", "Add files to svn that have been added to git."
196
+ def readd()
197
+ on_local_branch do
198
+ command = "svn status --ignore-externals"
199
+ svn_status = `#{command}`
200
+ raise SvnError.new("Failed to get the svn status. I'm not sure why. Check for any errors above.") if ! $?.success?
201
+ files_to_add = []
202
+ svn_status.each_line do |line|
203
+ case line.strip!
204
+ when /^X/, /\.git/, /\.swp$/
205
+ when /^\?\s+(\S.+)/
206
+ filename = $1
207
+ file_in_git = `git ls-files #{filename}`
208
+ raise GitError.new("Failed to list git files. I'm not sure why. Check for any errors above.") unless $?.success?
209
+ files_to_add << filename if file_in_git
210
+ say filename
211
+ end
212
+ end
213
+ if files_to_add.empty?
214
+ notice_message "There are no files to add."
215
+ return
216
+ end
217
+ if yes? "Do you want to add the above files to svn? [y/N] ", :green
218
+ command = "svn add " + files_to_add.join(' ')
219
+ run_command(command)
220
+ success_message "Added files to svn that had been added to git."
221
+ end
222
+ end
223
+ end
224
+
183
225
  desc "blame <FILE>", "Alias for svn blame."
184
226
  def blame(*args)
185
227
  on_local_branch do
@@ -207,7 +249,7 @@ continue, it's wise to reset the master branch afterward."
207
249
  end
208
250
 
209
251
  # check for existing .gitingore
210
- gitignore = [".svn", "*.swp", ".config", "*.err", "*.pid", "*.log"]
252
+ gitignore = [".svn", "*.sw?", ".config", "*.err", "*.pid", "*.log", "svn-commit.*"]
211
253
  command = "svn status --ignore-externals "
212
254
  svn_status = `#{command}`
213
255
  raise SvnError.new("Failed to get the svn status. I'm not sure why. Check for any errors above.") if ! $?.success?
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.1.0
4
+ version: 0.2.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: 2013-11-01 00:00:00.000000000 Z
11
+ date: 2013-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -113,7 +113,7 @@ files:
113
113
  - lib/git-si.rb
114
114
  - lib/git/si.rb
115
115
  - lib/git/si/version.rb
116
- homepage: ''
116
+ homepage: https://github.com/sirbrillig/git-si
117
117
  licenses:
118
118
  - MIT
119
119
  metadata: {}