git-si 0.0.1 → 0.1.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: f5c033e4e7de28be2feb823ec8f1d32db17796b7
4
- data.tar.gz: cb102435c9881c6614b06c20a27a67911de50186
3
+ metadata.gz: 5d8b981e514fb17acde6931c0b798d36a28d0544
4
+ data.tar.gz: 0cad14a2f7c3a24f52439f731bec169132f42b02
5
5
  SHA512:
6
- metadata.gz: ad49417b382b982f453ee176e7e54acd424c7fe2a39ac19c208e0ca74634c2ae3d1b93c4cc34715efda4918eb70669f1d155495cfc1c6422c9817073d87ff244
7
- data.tar.gz: d5c427755fd6df789324d55e22e37eea8ac2633338c6c63340986a781eae4eb93496f0ce1f0dd422fb6b2d31d8e76bd8312c1a2c857d7bade152d0b4ace0bab9
6
+ metadata.gz: bba2942db8d9ce95ce755e9eba06f8c437ddf4c4a729e460cfe90f7b207ea95ebef9846baa23b3a315d491df9c5b9477caa1d2ac20c4c7169af389989b82ffc8
7
+ data.tar.gz: 1f5325dd2baeb1cb95b8d853f78d9de3d53c09cfe29157facef891fe7f95d1021c39e0eefda8d28f9c9f8b9ab3cf7576b344c05d7c28e08b22977e05744e2529
data/README.md CHANGED
@@ -1,21 +1,46 @@
1
1
  # Git::Si
2
2
 
3
- Git Svn Interface: a simple git extention to use git locally with a remote svn repo. It's like a simple version of git-svn which doesn't keep track of history locally.
3
+ Git Svn Interface: a simple git extention to use git locally with a remote svn
4
+ repo. It's like a simple version of git-svn which doesn't keep track of history
5
+ locally.
4
6
 
5
7
  ## Installation
6
8
 
7
9
  $ gem install git-si
8
10
 
11
+ or locally if you don't have access to the global gem directory:
12
+
13
+ $ gem install --user-install git-si
14
+
9
15
  ## Usage
10
16
 
11
- Commands:
12
- git-si add [FILES] # Perform an svn and a git add on the files.
13
- git-si diff [FILES] # Perform an svn diff piped through a colorizer. Also tests to be sure a rebase is not needed.
14
- git-si fetch # Updates mirror branch to latest svn commit.
15
- git-si help [COMMAND] # Describe available commands or one specific command
16
- git-si pull # Fetch the latest svn commit and rebase the current branch.
17
- git-si rebase # Rebases current branch to mirror branch.
18
- git-si status [FILES] # Perform an svn status.
17
+ To begin, enter a directory versioned by svn and run `git si init`. This will
18
+ set up git, the mirror branch, and a gitignore if you don't have one already.
19
+
20
+ Use git locally as you would normally, making branches for your features as you
21
+ like. To update your local branch with changes made on the svn server, run `git
22
+ si pull`. (If there are conflicts you can use `git mergetool` to handle them.)
23
+
24
+ Compare your local copy to the server with `git si diff`. It even colorizes and
25
+ pages the output for you!
26
+
27
+ When you are ready to push your changes to the svn server, run `git si commit`.
28
+ This will take you into your favorite editor to enter a commit message.
29
+
30
+ All commands:
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?
43
+
19
44
 
20
45
  ## Contributing
21
46
 
@@ -1,5 +1,5 @@
1
1
  module Git
2
2
  module Si
3
- VERSION = "0.0.1"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
data/lib/git/si.rb CHANGED
@@ -31,7 +31,7 @@ module Git
31
31
 
32
32
  desc "usage", "How does this thing work?"
33
33
  def usage
34
- say "git-si
34
+ say "git-si #{Git::Si::VERSION}
35
35
 
36
36
  Git Svn Interface: a simple git extention to use git locally with a remote svn
37
37
  repo. It's like a simple version of git-svn which doesn't keep track of history
@@ -131,12 +131,50 @@ use the commands below.
131
131
 
132
132
  desc "commit", "Perform an svn commit and update the mirror branch."
133
133
  def commit
134
+ mirror_is_updated = false
135
+
134
136
  on_local_branch do
137
+ local_branch = get_local_branch()
138
+ if local_branch == 'master'
139
+ notice_message "Warning: you're using the master branch as working copy. This can
140
+ cause trouble because when your changes are committed and you try to
141
+ rebase on top of them, you may end up with merge errors as you are
142
+ trying to apply patches of previous versions of your code. If you
143
+ continue, it's wise to reset the master branch afterward."
144
+ return if ask("Do you want to continue with this commit? [Y/n] ", :green) =~ /\s*^n/i
145
+ end
146
+
147
+ git_status = `git status --porcelain`
148
+ raise GitError.new("There are local changes; please commit them before continuing.") if git_status.match(/^[^\?]/)
149
+ svn_diff = `svn diff`
150
+ raise SvnError.new("Failed to get the svn diff. I'm not sure why. Check for any errors above.") if ! $?.success?
151
+ raise SvnError.new("There are no changes to commit.") if svn_diff.strip.empty?
152
+
135
153
  run_command("svn commit")
136
154
  success_message "commit complete!"
137
- if yes? "Do you want to update the mirror branch to the latest commit? [y/N] "
155
+ if yes? "Do you want to update the mirror branch to the latest commit? [y/N] ", :green
138
156
  on_mirror_branch do
139
157
  fetch
158
+ mirror_is_updated = true
159
+ end
160
+ end
161
+ end
162
+
163
+ if mirror_is_updated
164
+ local_branch = get_local_branch()
165
+ if local_branch == 'master'
166
+ if yes? "Do you want to reset the current branch to the latest commit (losing all git history)? [y/N] ", :green
167
+ run_command("git checkout #{@@mirror_branch}")
168
+ run_command("git branch -D '#{local_branch}'")
169
+ run_command("git checkout -b #{local_branch}")
170
+ success_message "branch '#{local_branch}' reset!"
171
+ end
172
+ else
173
+ if yes? "Do you want to switch to master and delete the committed branch '#{local_branch}'? [y/N] ", :green
174
+ run_command("git checkout master")
175
+ rebase
176
+ run_command("git branch -D '#{local_branch}'")
177
+ success_message "branch '#{local_branch}' deleted!"
140
178
  end
141
179
  end
142
180
  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.0.1
4
+ version: 0.1.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-10-29 00:00:00.000000000 Z
11
+ date: 2013-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler