svn_branch 0.2.1 → 0.3.1
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/History.txt +10 -0
- data/Manifest.txt +4 -2
- data/lib/svn_branch/version.rb +1 -1
- data/lib/tasks/{create.rake → rails/create.rake} +3 -1
- data/lib/tasks/{merge.rake → rails/merge.rake} +0 -0
- data/lib/tasks/rubygems/create.rake +44 -0
- data/lib/tasks/rubygems/merge.rake +31 -0
- data/website/index.html +2 -2
- metadata +7 -5
data/History.txt
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
== 0.3.1 2007-10-29
|
2
|
+
|
3
|
+
* When determining project/app_name, use reverse repos root path parts (not just last) and
|
4
|
+
ignore 'repos' or 'trunk' etc.
|
5
|
+
|
6
|
+
== 0.3.0 2007-06-24
|
7
|
+
|
8
|
+
* RubyGem support via svn:gems:create
|
9
|
+
* Includes svn copy -m message
|
10
|
+
|
1
11
|
== 0.2.1 2007-06-17
|
2
12
|
|
3
13
|
* Fixed up svn:branch:merge_to_trunk
|
data/Manifest.txt
CHANGED
@@ -4,8 +4,10 @@ README.txt
|
|
4
4
|
Rakefile
|
5
5
|
lib/svn_branch.rb
|
6
6
|
lib/svn_branch/version.rb
|
7
|
-
lib/tasks/create.rake
|
8
|
-
lib/tasks/merge.rake
|
7
|
+
lib/tasks/rails/create.rake
|
8
|
+
lib/tasks/rails/merge.rake
|
9
|
+
lib/tasks/rubygems/create.rake
|
10
|
+
lib/tasks/rubygems/merge.rake
|
9
11
|
scripts/txt2html
|
10
12
|
setup.rb
|
11
13
|
test/test_helper.rb
|
data/lib/svn_branch/version.rb
CHANGED
@@ -19,7 +19,9 @@ namespace :svn do
|
|
19
19
|
puts "ERROR: only perform this operation from the trunk checkout" and next if repo_curr.sub(repo_root, '') != '/trunk'
|
20
20
|
|
21
21
|
app_name = ENV['APP_NAME']
|
22
|
-
app_name ||= repo_root.split('/').
|
22
|
+
app_name ||= repo_root.split('/').reverse.find do |path_part|
|
23
|
+
!%w[trunk repos].include?(path_part)
|
24
|
+
end
|
23
25
|
|
24
26
|
curr_path = Dir.pwd
|
25
27
|
target_path = File.join(curr_path, '..', "#{app_name}_#{name}")
|
File without changes
|
@@ -0,0 +1,44 @@
|
|
1
|
+
namespace :svn do
|
2
|
+
namespace :gems do
|
3
|
+
desc 'Creates a new branch using NAME=branch_name'
|
4
|
+
task :create do
|
5
|
+
require 'highline'
|
6
|
+
|
7
|
+
|
8
|
+
puts "Usage: NAME=branch_name" and next unless name = ENV['NAME']
|
9
|
+
|
10
|
+
svn_info = `svn info`
|
11
|
+
puts "Not under svn; ignoring request" and next unless svn_info
|
12
|
+
repo_root = (svn_info.match(/^Repository Root:\s(.*)$/) || [nil,nil])[1]
|
13
|
+
repo_curr = (svn_info.match(/^URL:\s(.*)$/) || [nil,nil])[1]
|
14
|
+
puts "ERROR: cannot find Repository Root via `svn info`" and next unless repo_root
|
15
|
+
puts "ERROR: cannot find URL via `svn info`" and next unless repo_curr
|
16
|
+
puts "Repository Root: #{repo_root}"
|
17
|
+
puts "Checkout URL: #{repo_curr}"
|
18
|
+
puts "ERROR: svn project is not setup for branching (needs trunk,branches,tags subfolders)" and next if repo_root == repo_curr
|
19
|
+
puts "ERROR: only perform this operation from the trunk checkout" and next if repo_curr.sub(repo_root, '') != '/trunk'
|
20
|
+
|
21
|
+
app_name = ENV['APP_NAME']
|
22
|
+
app_name ||= repo_root.split('/').reverse.find do |path_part|
|
23
|
+
!%w[trunk repos].include?(path_part)
|
24
|
+
end
|
25
|
+
|
26
|
+
curr_path = Dir.pwd
|
27
|
+
target_path = File.expand_path(File.join(curr_path, '..', "#{app_name}_#{name}"))
|
28
|
+
repo_branch = File.join(repo_root, 'branches', name)
|
29
|
+
puts "Current path: #{curr_path}"
|
30
|
+
puts "*Branch path: #{target_path}"
|
31
|
+
|
32
|
+
puts "*Repos branch: #{repo_branch}"
|
33
|
+
|
34
|
+
question = HighLine.new
|
35
|
+
puts "Quitting." and next unless question.agree("Create branch? [y/N]", true)
|
36
|
+
|
37
|
+
repo_from = repo_curr # TODO allow task to be called from non-trunk to clone branches
|
38
|
+
repo_to = repo_branch
|
39
|
+
puts `svn copy #{repo_curr} #{repo_to} -m "Branching trunk to #{app_name}"`
|
40
|
+
puts `svn co #{repo_to} #{target_path}`
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
namespace :svn do
|
2
|
+
namespace :gems do
|
3
|
+
namespace :merge do
|
4
|
+
desc 'Merge branch back into trunk; run from trunk'
|
5
|
+
task :to_trunk do
|
6
|
+
puts "Usage [from trunk dir]: NAME=branch_name" and next unless name = ENV['NAME']
|
7
|
+
|
8
|
+
svn_info = `svn info`
|
9
|
+
puts "Not under svn; ignoring request" and next unless svn_info
|
10
|
+
repo_root = (svn_info.match(/^Repository Root:\s(.*)$/) || [nil,nil])[1]
|
11
|
+
repo_curr = (svn_info.match(/^URL:\s(.*)$/) || [nil,nil])[1]
|
12
|
+
branch_name = repo_curr.split('/').last
|
13
|
+
repo_branch = "#{repo_root}/branches/#{name}"
|
14
|
+
|
15
|
+
# get the last r(\d+) number
|
16
|
+
svn_log = `svn log --verbose --stop-on-copy #{repo_branch}`
|
17
|
+
branch_rev = svn_log.scan(/^r(\d+)\s/).last
|
18
|
+
# merge branch_rev:HEAD
|
19
|
+
puts merge = "svn merge -r #{branch_rev}:HEAD #{repo_branch}"
|
20
|
+
puts `#{merge}`
|
21
|
+
|
22
|
+
# fix conflicts
|
23
|
+
|
24
|
+
post_merge = ["Now fix up any 'C' conflicts and remove the temporary files",
|
25
|
+
"rake test",
|
26
|
+
"svn commit -m \"Merged branch changes from #{branch_name}; r#{branch_rev}:HEAD\""]
|
27
|
+
post_merge.each_with_index { |help,i| puts "#{i+1}) #{help}" }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>svn_branch</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/svn_branch"; return false'>
|
35
35
|
Get Version
|
36
|
-
<a href="http://rubyforge.org/projects/svn_branch" class="numbers">0.
|
36
|
+
<a href="http://rubyforge.org/projects/svn_branch" class="numbers">0.3.1</a>
|
37
37
|
</div>
|
38
38
|
<h1>→ rake svn:branch:create <span class="caps">NAME</span>=branchname</h1>
|
39
39
|
|
@@ -87,7 +87,7 @@ $ rake gems:link GEM=svn_branch</pre>
|
|
87
87
|
|
88
88
|
<p>Comments are welcome. Send an email to <a href="mailto:drnicwilliams@gmail.com">Dr Nic Williams</a>.</p>
|
89
89
|
<p class="coda">
|
90
|
-
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>,
|
90
|
+
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 10th May 2007<br>
|
91
91
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
92
92
|
</p>
|
93
93
|
</div>
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.4.
|
2
|
+
rubygems_version: 0.9.4.3
|
3
3
|
specification_version: 1
|
4
4
|
name: svn_branch
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.3.1
|
7
|
+
date: 2007-10-29 00:00:00 +10:00
|
8
8
|
summary: A collection of rake tasks to automate the svn functions within a project, with special support for rails projects. For example, the creation of new branch, plus for rails apps, a new database.yml and new databases for development and test, for the branch.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -35,8 +35,10 @@ files:
|
|
35
35
|
- Rakefile
|
36
36
|
- lib/svn_branch.rb
|
37
37
|
- lib/svn_branch/version.rb
|
38
|
-
- lib/tasks/create.rake
|
39
|
-
- lib/tasks/merge.rake
|
38
|
+
- lib/tasks/rails/create.rake
|
39
|
+
- lib/tasks/rails/merge.rake
|
40
|
+
- lib/tasks/rubygems/create.rake
|
41
|
+
- lib/tasks/rubygems/merge.rake
|
40
42
|
- scripts/txt2html
|
41
43
|
- setup.rb
|
42
44
|
- test/test_helper.rb
|