ext 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/README +1 -2
- data/bin/ext +0 -0
- data/lib/externals/ext.rb +4 -6
- data/lib/externals/project.rb +0 -4
- data/lib/externals/scms/svn_project.rb +4 -5
- data/lib/externals/test/basic_git_repository.rb +20 -4
- data/lib/externals/test/engines.rb +2 -2
- data/lib/externals/test/engines_with_branch1.rb +4 -4
- data/lib/externals/test/fake_rails_repository.rb +7 -7
- data/lib/externals/test/git_repository.rb +15 -0
- data/lib/externals/test/git_repository_from_internet.rb +4 -3
- data/lib/externals/test/rails_app_git_branches.rb +17 -8
- data/lib/externals/test/rails_app_git_repository.rb +16 -5
- data/lib/externals/test/rails_app_svn_branches.rb +2 -2
- data/lib/externals/test/rails_app_svn_repository.rb +2 -2
- data/lib/externals/test/repository.rb +4 -6
- data/lib/externals/test/simple_git_with_sub.rb +14 -4
- data/lib/externals/test_case.rb +1 -1
- data/test/test_checkout_git.rb +1 -1
- data/test/test_checkout_with_subprojects_git.rb +0 -4
- data/test/test_checkout_with_subprojects_svn.rb +2 -2
- data/test/test_freeze_to_revision.rb +73 -1
- data/test/test_init_git.rb +3 -2
- data/test/test_out_of_date_git_subproject.rb +2 -2
- metadata +44 -45
data/CHANGELOG
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
July 17, 2012 Version 1.0.7 released
|
2
|
+
- Fixes a bug that removes the branch from the .externals configuration
|
3
|
+
file when freezing a subproject managed by subversion.
|
4
|
+
|
1
5
|
October 19, 2011 Version 1.0.6 released
|
2
6
|
- Replaced some useful program output that was removed in 1.0.5
|
3
7
|
|
data/README
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
Externals is a project that allows you to use the workflow normally made
|
2
2
|
possible by svn:externals in an SCM independent manner.
|
3
3
|
|
4
|
-
Please report bugs to
|
5
|
-
http://ext.lighthouseapp.com
|
4
|
+
Please report bugs to https://github.com/azimux/externals/issues
|
6
5
|
|
7
6
|
I was inspired to create this project because I had several projects that had
|
8
7
|
a mix of plugins managed by git and by svn. Git's submodule feature is
|
data/bin/ext
CHANGED
File without changes
|
data/lib/externals/ext.rb
CHANGED
@@ -9,7 +9,7 @@ Dir.entries(File.join(File.dirname(__FILE__), 'extensions')).each do |extension|
|
|
9
9
|
end
|
10
10
|
|
11
11
|
module Externals
|
12
|
-
VERSION = '1.0.
|
12
|
+
VERSION = '1.0.7'
|
13
13
|
PROJECT_TYPES_DIRECTORY = File.join(File.dirname(__FILE__), '..', 'externals','project_types')
|
14
14
|
|
15
15
|
# Full commands operate on the main project as well as the externals
|
@@ -392,12 +392,10 @@ Please use
|
|
392
392
|
|
393
393
|
revision = args[1] || project.current_revision
|
394
394
|
|
395
|
-
branch = if project.freeze_involves_branch?
|
396
|
-
project.current_branch
|
397
|
-
end
|
398
|
-
|
399
395
|
section = configuration[project.path]
|
396
|
+
|
400
397
|
if section[:branch]
|
398
|
+
branch = project.current_branch
|
401
399
|
if branch
|
402
400
|
section[:branch] = branch
|
403
401
|
else
|
@@ -708,7 +706,7 @@ commands below if you actually wish to delete them."
|
|
708
706
|
project_class.detected?
|
709
707
|
end
|
710
708
|
|
711
|
-
raise "Could not determine this
|
709
|
+
raise "Could not determine this project's scm" if possible_project_classes.empty?
|
712
710
|
if possible_project_classes.size > 1
|
713
711
|
raise "This project appears to be managed by multiple SCMs: #{
|
714
712
|
possible_project_classes.map(&:to_s).join(',')}
|
data/lib/externals/project.rb
CHANGED
@@ -39,6 +39,7 @@ module Externals
|
|
39
39
|
if revision
|
40
40
|
Dir.chdir path do
|
41
41
|
puts `svn #{opts} up -r #{revision}`
|
42
|
+
raise unless $? == 0
|
42
43
|
end
|
43
44
|
end
|
44
45
|
end
|
@@ -64,6 +65,7 @@ module Externals
|
|
64
65
|
|
65
66
|
def switch branch_name, options = {}
|
66
67
|
require_repository
|
68
|
+
|
67
69
|
if current_branch != branch_name
|
68
70
|
Dir.chdir path do
|
69
71
|
url = [repository, branch_name].join("/")
|
@@ -149,6 +151,7 @@ module Externals
|
|
149
151
|
|
150
152
|
def current_branch
|
151
153
|
require_repository
|
154
|
+
|
152
155
|
branch = info_url.gsub(/\/+/, "/").gsub(repository.gsub(/\/+/, "/"), "")
|
153
156
|
if branch == repository
|
154
157
|
raise "Could not determine branch from URL #{info_url}.
|
@@ -177,7 +180,7 @@ module Externals
|
|
177
180
|
def require_repository
|
178
181
|
if repository.nil? || repository.empty?
|
179
182
|
url = info_url
|
180
|
-
|
183
|
+
info_url = "svn+ssh://server/path/repository" unless url
|
181
184
|
puts "to use any branching features with a subversion project, the
|
182
185
|
repository must be present in the .externals file.
|
183
186
|
|
@@ -269,9 +272,5 @@ repository = #{info_url}
|
|
269
272
|
end
|
270
273
|
end
|
271
274
|
|
272
|
-
def freeze_involves_branch?
|
273
|
-
false
|
274
|
-
end
|
275
|
-
|
276
275
|
end
|
277
276
|
end
|
@@ -1,17 +1,28 @@
|
|
1
|
-
require 'externals/test/
|
1
|
+
require 'externals/test/git_repository'
|
2
2
|
|
3
3
|
module Externals
|
4
4
|
module Test
|
5
|
-
class BasicGitRepository <
|
5
|
+
class BasicGitRepository < GitRepository
|
6
6
|
def initialize
|
7
7
|
super "basic", "git"
|
8
8
|
end
|
9
9
|
|
10
10
|
def build_here
|
11
|
-
|
11
|
+
repo_name = "#{name}.git"
|
12
12
|
|
13
|
-
|
13
|
+
mkdir repo_name
|
14
|
+
|
15
|
+
Dir.chdir("#{repo_name}") do
|
16
|
+
`git init --bare`
|
17
|
+
|
18
|
+
raise unless $? == 0
|
19
|
+
end
|
20
|
+
|
21
|
+
mkdir "#{name}.local"
|
22
|
+
|
23
|
+
Dir.chdir("#{name}.local") do
|
14
24
|
`git init`
|
25
|
+
|
15
26
|
raise unless $? == 0
|
16
27
|
|
17
28
|
open 'readme.txt', 'w' do |f|
|
@@ -33,7 +44,12 @@ module Externals
|
|
33
44
|
raise unless $? == 0
|
34
45
|
`git commit -m "added a line to readme.txt"`
|
35
46
|
raise unless $? == 0
|
47
|
+
|
48
|
+
puts `git push ../#{repo_name} HEAD:master`
|
49
|
+
raise unless $? == 0
|
36
50
|
end
|
51
|
+
|
52
|
+
rm_rf "#{name}.local"
|
37
53
|
end
|
38
54
|
|
39
55
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require 'externals/test/
|
1
|
+
require 'externals/test/git_repository_from_internet'
|
2
2
|
|
3
3
|
module Externals
|
4
4
|
module Test
|
5
5
|
class Engines < GitRepositoryFromInternet
|
6
6
|
def initialize
|
7
|
-
super "engines
|
7
|
+
super "engines", "git", "git://github.com/azimux"
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require 'externals/test/
|
1
|
+
require 'externals/test/git_repository'
|
2
2
|
require 'externals/test/engines'
|
3
3
|
|
4
4
|
module Externals
|
5
5
|
module Test
|
6
|
-
class EnginesWithBranch1 <
|
6
|
+
class EnginesWithBranch1 < GitRepository
|
7
7
|
def initialize
|
8
|
-
super "engines
|
8
|
+
super "engines", File.join("git", "with_branch1")
|
9
9
|
dependents.merge!(
|
10
10
|
:other_engines => Engines.new
|
11
11
|
)
|
@@ -15,7 +15,7 @@ module Externals
|
|
15
15
|
def build_here
|
16
16
|
rm_rf_ie name
|
17
17
|
|
18
|
-
puts `git clone --bare #{dependents[:other_engines].clean_dir} #{name}`
|
18
|
+
puts `git clone --bare #{dependents[:other_engines].clean_dir} #{name}.git`
|
19
19
|
raise unless $? == 0
|
20
20
|
|
21
21
|
rm_rf_ie "workdir"
|
@@ -1,12 +1,12 @@
|
|
1
|
-
require 'externals/test/
|
1
|
+
require 'externals/test/git_repository'
|
2
2
|
require 'find'
|
3
3
|
require 'externals/test/git_repository_from_internet'
|
4
4
|
|
5
5
|
module Externals
|
6
6
|
module Test
|
7
|
-
class FakeRailsRepository <
|
7
|
+
class FakeRailsRepository < GitRepository
|
8
8
|
def initialize
|
9
|
-
super "rails
|
9
|
+
super "rails", "fake3"
|
10
10
|
end
|
11
11
|
|
12
12
|
def build_here
|
@@ -57,7 +57,7 @@ module Externals
|
|
57
57
|
raise unless $? == 0
|
58
58
|
puts `git commit -m "rails with all but 1 file per directory deleted"`
|
59
59
|
raise unless $? == 0
|
60
|
-
puts `git push ../rails.git master`
|
60
|
+
puts `git push ../rails.git HEAD:master`
|
61
61
|
raise unless $? == 0
|
62
62
|
|
63
63
|
head1 = nil
|
@@ -73,7 +73,7 @@ module Externals
|
|
73
73
|
raise unless $? == 0
|
74
74
|
puts `git commit -m "dummy commit 1"`
|
75
75
|
raise unless $? == 0
|
76
|
-
puts `git push ../rails.git master`
|
76
|
+
puts `git push ../rails.git HEAD:master`
|
77
77
|
raise unless $? == 0
|
78
78
|
|
79
79
|
open "heads", "a" do |file|
|
@@ -87,7 +87,7 @@ module Externals
|
|
87
87
|
raise unless $? == 0
|
88
88
|
puts `git commit -m "dummy commit 2"`
|
89
89
|
raise unless $? == 0
|
90
|
-
puts `git push ../rails.git master`
|
90
|
+
puts `git push ../rails.git HEAD:master`
|
91
91
|
raise unless $? == 0
|
92
92
|
|
93
93
|
open "heads", "a" do |file|
|
@@ -101,7 +101,7 @@ module Externals
|
|
101
101
|
raise unless $? == 0
|
102
102
|
puts `git commit -m "dummy commit 3"`
|
103
103
|
raise unless $? == 0
|
104
|
-
puts `git push ../rails.git master`
|
104
|
+
puts `git push ../rails.git HEAD:master`
|
105
105
|
raise unless $? == 0
|
106
106
|
end
|
107
107
|
rm_rf "fake_rails"
|
@@ -1,9 +1,10 @@
|
|
1
|
-
require 'externals/test/
|
1
|
+
require 'externals/test/git_repository'
|
2
2
|
|
3
3
|
module Externals
|
4
4
|
module Test
|
5
|
-
class GitRepositoryFromInternet <
|
5
|
+
class GitRepositoryFromInternet < GitRepository
|
6
6
|
attr_accessor :url
|
7
|
+
|
7
8
|
def initialize name, subpath = nil, url = nil
|
8
9
|
super name, subpath || "git"
|
9
10
|
self.url = url || "git://github.com/rails"
|
@@ -11,7 +12,7 @@ module Externals
|
|
11
12
|
|
12
13
|
#builds the test repository in the current directory
|
13
14
|
def build_here
|
14
|
-
puts `git clone --bare #{url}/#{name} #{name}`
|
15
|
+
puts `git clone --bare #{url}/#{name}.git #{name}.git`
|
15
16
|
raise unless $? == 0
|
16
17
|
end
|
17
18
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'externals/test/
|
1
|
+
require 'externals/test/git_repository'
|
2
2
|
require 'externals/test/git_repository_from_internet'
|
3
3
|
require 'externals/test/svn_repository_from_dump'
|
4
4
|
require 'externals/test/engines_with_branch1'
|
@@ -7,11 +7,11 @@ require 'externals/test/rails_app_unmanaged'
|
|
7
7
|
|
8
8
|
module Externals
|
9
9
|
module Test
|
10
|
-
class RailsAppGitBranches <
|
10
|
+
class RailsAppGitBranches < GitRepository
|
11
11
|
def initialize
|
12
12
|
super "rails_app", File.join("git", "branches")
|
13
13
|
dependents.merge!(
|
14
|
-
:acts_as_list => GitRepositoryFromInternet.new("acts_as_list
|
14
|
+
:acts_as_list => GitRepositoryFromInternet.new("acts_as_list"),
|
15
15
|
:redhillonrails_core => SvnRepositoryFromDump.new("redhillonrails_core"),
|
16
16
|
:foreign_key_migrations => SvnRepositoryFromDump.new("foreign_key_migrations"),
|
17
17
|
:engines => EnginesWithBranch1.new,
|
@@ -24,9 +24,15 @@ module Externals
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def build_here
|
27
|
-
|
27
|
+
mkdir "#{name}.git"
|
28
|
+
Dir.chdir "#{name}.git" do
|
29
|
+
`git init --bare`
|
30
|
+
raise unless $? == 0
|
31
|
+
end
|
28
32
|
|
29
|
-
|
33
|
+
cp_a dependents[:rails_app_unmanaged].clean_dir, "#{name}.working"
|
34
|
+
|
35
|
+
Dir.chdir "#{name}.working" do
|
30
36
|
Ext.run "touch_emptydirs"
|
31
37
|
|
32
38
|
`git init`
|
@@ -66,6 +72,9 @@ module Externals
|
|
66
72
|
`git commit -m "created empty rails app with some subprojects"`
|
67
73
|
raise unless $? == 0
|
68
74
|
|
75
|
+
`git push ../#{name}.git HEAD:master`
|
76
|
+
raise unless $? == 0
|
77
|
+
|
69
78
|
#let's create a branch for the main project called 'new_branch' and a
|
70
79
|
#branch for the engines subproject called 'new_branch' and make sure
|
71
80
|
#that checking one out and doing "ext up" correctly changes the branch
|
@@ -88,11 +97,11 @@ module Externals
|
|
88
97
|
raise unless $? == 0
|
89
98
|
`git commit -m "changed branch on engines subproject, removed rails"`
|
90
99
|
raise unless $? == 0
|
91
|
-
|
92
|
-
#switch back to master...
|
93
|
-
`git checkout master`
|
100
|
+
`git push ../#{name}.git HEAD:new_branch`
|
94
101
|
raise unless $? == 0
|
95
102
|
end
|
103
|
+
|
104
|
+
rm_rf "#{name}.working"
|
96
105
|
end
|
97
106
|
|
98
107
|
end
|
@@ -1,15 +1,15 @@
|
|
1
|
-
require 'externals/test/
|
1
|
+
require 'externals/test/git_repository'
|
2
2
|
require 'externals/test/git_repository_from_internet'
|
3
3
|
require 'externals/test/svn_repository_from_dump'
|
4
4
|
require 'externals/test/rails_app_unmanaged'
|
5
5
|
|
6
6
|
module Externals
|
7
7
|
module Test
|
8
|
-
class RailsAppGitRepository <
|
8
|
+
class RailsAppGitRepository < GitRepository
|
9
9
|
def initialize
|
10
10
|
super "rails_app", "git"
|
11
11
|
dependents.merge!(
|
12
|
-
:acts_as_list => GitRepositoryFromInternet.new("acts_as_list
|
12
|
+
:acts_as_list => GitRepositoryFromInternet.new("acts_as_list"),
|
13
13
|
:redhillonrails_core => SvnRepositoryFromDump.new("redhillonrails_core"),
|
14
14
|
:foreign_key_migrations => SvnRepositoryFromDump.new("foreign_key_migrations"),
|
15
15
|
:rails_app_unmanaged => RailsAppUnmanaged.new
|
@@ -20,9 +20,15 @@ module Externals
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def build_here
|
23
|
-
|
23
|
+
mkdir "#{name}.git"
|
24
|
+
Dir.chdir "#{name}.git" do
|
25
|
+
`git init --bare`
|
26
|
+
raise unless $? == 0
|
27
|
+
end
|
28
|
+
|
29
|
+
cp_a dependents[:rails_app_unmanaged].clean_dir, "#{name}.working"
|
24
30
|
|
25
|
-
Dir.chdir name do
|
31
|
+
Dir.chdir "#{name}.working" do
|
26
32
|
Ext.run "touch_emptydirs"
|
27
33
|
|
28
34
|
`git init`
|
@@ -47,7 +53,12 @@ module Externals
|
|
47
53
|
GitProject.add_all
|
48
54
|
`git commit -m "created empty rails app with some subprojects"`
|
49
55
|
raise unless $? == 0
|
56
|
+
|
57
|
+
`git push ../#{name}.git HEAD:master`
|
58
|
+
raise unless $? == 0
|
50
59
|
end
|
60
|
+
|
61
|
+
rm_rf "#{name}.working"
|
51
62
|
end
|
52
63
|
|
53
64
|
end
|
@@ -15,8 +15,8 @@ module Externals
|
|
15
15
|
def initialize
|
16
16
|
super "rails_app_svn_branches", "svn"
|
17
17
|
dependents.merge!(
|
18
|
-
:acts_as_list => GitRepositoryFromInternet.new("acts_as_list
|
19
|
-
:ssl_requirement => GitRepositoryFromInternet.new("ssl_requirement
|
18
|
+
:acts_as_list => GitRepositoryFromInternet.new("acts_as_list"),
|
19
|
+
:ssl_requirement => GitRepositoryFromInternet.new("ssl_requirement"),
|
20
20
|
:engines => EnginesWithBranch1.new,
|
21
21
|
:redhillonrails_core => SvnRepositoryFromDump.new("redhillonrails_core"),
|
22
22
|
:empty_plugin => SvnRepositoryFromDump.new("empty_plugin"),
|
@@ -15,8 +15,8 @@ module Externals
|
|
15
15
|
def initialize
|
16
16
|
super "rails_app", "svn2"
|
17
17
|
dependents.merge!(
|
18
|
-
:acts_as_list => GitRepositoryFromInternet.new("acts_as_list
|
19
|
-
:ssl_requirement => GitRepositoryFromInternet.new("ssl_requirement
|
18
|
+
:acts_as_list => GitRepositoryFromInternet.new("acts_as_list"),
|
19
|
+
:ssl_requirement => GitRepositoryFromInternet.new("ssl_requirement"),
|
20
20
|
:engines => Engines.new,
|
21
21
|
:redhillonrails_core => SvnRepositoryFromDump.new("redhillonrails_core"),
|
22
22
|
:empty_plugin => SvnRepositoryFromDump.new("empty_plugin"),
|
@@ -129,15 +129,13 @@ module Externals
|
|
129
129
|
end
|
130
130
|
|
131
131
|
def delete_clean_dir
|
132
|
-
|
133
|
-
|
134
|
-
end
|
132
|
+
raise "hmmm... too scared to delete #{clean_dir}" unless clean_dir =~ /[\/\\]test[\/\\]tmp[\/\\]/
|
133
|
+
rm_rf_ie clean_dir
|
135
134
|
end
|
136
135
|
|
137
136
|
def delete_pristine_dir
|
138
|
-
|
139
|
-
|
140
|
-
end
|
137
|
+
raise "hmmm... too scared to delete #{pristine_dir}" unless clean_dir =~ /[\/\\]test[\/\\]tmp[\/\\]/
|
138
|
+
rm_rf_ie pristine_dir
|
141
139
|
end
|
142
140
|
|
143
141
|
def dirty?
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require 'externals/test/
|
1
|
+
require 'externals/test/git_repository'
|
2
2
|
require 'externals/test/basic_git_repository'
|
3
3
|
|
4
4
|
module Externals
|
5
5
|
module Test
|
6
|
-
class SimpleGitWithSub <
|
6
|
+
class SimpleGitWithSub < GitRepository
|
7
7
|
def initialize
|
8
8
|
super "simple_wth_sub", File.join("git", "5")
|
9
9
|
dependents.merge!(
|
@@ -12,9 +12,15 @@ module Externals
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def build_here
|
15
|
-
mkdir name
|
15
|
+
mkdir "#{name}.git"
|
16
|
+
Dir.chdir "#{name}.git" do
|
17
|
+
`git init --bare`
|
18
|
+
raise unless $? == 0
|
19
|
+
end
|
20
|
+
|
21
|
+
mkdir "#{name}.working"
|
16
22
|
|
17
|
-
Dir.chdir("#{name}") do
|
23
|
+
Dir.chdir("#{name}.working") do
|
18
24
|
`git init`
|
19
25
|
raise unless $? == 0
|
20
26
|
|
@@ -54,7 +60,11 @@ module Externals
|
|
54
60
|
raise unless $? == 0
|
55
61
|
`git commit -m "added basic subproject under subs"`
|
56
62
|
raise unless $? == 0
|
63
|
+
`git push ../#{name}.git HEAD:master`
|
64
|
+
raise unless $? == 0
|
57
65
|
end
|
66
|
+
|
67
|
+
rm_rf "#{name}.working"
|
58
68
|
end
|
59
69
|
|
60
70
|
end
|
data/lib/externals/test_case.rb
CHANGED
data/test/test_checkout_git.rb
CHANGED
@@ -12,7 +12,7 @@ module Externals
|
|
12
12
|
repository = BasicGitRepository.new
|
13
13
|
repository.prepare
|
14
14
|
|
15
|
-
assert File.exists?(
|
15
|
+
assert File.exists?(repository.clean_dir)
|
16
16
|
|
17
17
|
workdir = File.join(root_dir, 'test', "tmp", "workdir")
|
18
18
|
mkdir_p workdir
|
@@ -12,8 +12,6 @@ module Externals
|
|
12
12
|
repository = RailsAppGitBranches.new
|
13
13
|
repository.prepare
|
14
14
|
|
15
|
-
assert File.exists?(File.join(repository.clean_dir, "db"))
|
16
|
-
|
17
15
|
workdir = File.join(root_dir, 'test', "tmp", "workdir", "branches", "git")
|
18
16
|
mkdir_p workdir
|
19
17
|
|
@@ -128,8 +126,6 @@ module Externals
|
|
128
126
|
repository = RailsAppGitBranches.new
|
129
127
|
repository.prepare
|
130
128
|
|
131
|
-
assert File.exists?(File.join(repository.clean_dir, "db"))
|
132
|
-
|
133
129
|
workdir = File.join(root_dir, 'test', "tmp", "workdir", "branches", "uninstall", "git")
|
134
130
|
mkdir_p workdir
|
135
131
|
|
@@ -98,7 +98,7 @@ module Externals
|
|
98
98
|
|
99
99
|
Dir.chdir "rails_app" do
|
100
100
|
#install a new project
|
101
|
-
subproject = GitRepositoryFromInternet.new("ssl_requirement
|
101
|
+
subproject = GitRepositoryFromInternet.new("ssl_requirement")
|
102
102
|
Ext.run "install", subproject.clean_dir
|
103
103
|
|
104
104
|
SvnProject.add_all
|
@@ -121,7 +121,7 @@ module Externals
|
|
121
121
|
def test_update_with_missing_subproject_by_revision_git
|
122
122
|
repository = RailsAppSvnRepository.new
|
123
123
|
repository.prepare
|
124
|
-
subproject = GitRepositoryFromInternet.new("ssl_requirement
|
124
|
+
subproject = GitRepositoryFromInternet.new("ssl_requirement")
|
125
125
|
subproject.prepare
|
126
126
|
revision = "aa2dded823f8a9b378c22ba0159971508918928a"
|
127
127
|
subproject_name = subproject.name.gsub(".git", "")
|
@@ -2,6 +2,8 @@ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') if $0 == __FILE__
|
|
2
2
|
require 'externals/test_case'
|
3
3
|
require 'externals/ext'
|
4
4
|
require 'externals/test/rails_app_git_repository'
|
5
|
+
require 'externals/test/basic_git_repository'
|
6
|
+
require 'externals/test/modules_svn_branches_repository'
|
5
7
|
|
6
8
|
module Externals
|
7
9
|
module Test
|
@@ -12,7 +14,7 @@ module Externals
|
|
12
14
|
repository = RailsAppGitRepository.new
|
13
15
|
repository.prepare
|
14
16
|
|
15
|
-
assert File.exists?(
|
17
|
+
assert File.exists?(repository.clean_dir)
|
16
18
|
|
17
19
|
workdir = File.join(root_dir, 'test', "tmp", "workdir", "checkout", "git")
|
18
20
|
mkdir_p workdir
|
@@ -67,6 +69,76 @@ module Externals
|
|
67
69
|
end
|
68
70
|
end
|
69
71
|
|
72
|
+
def test_svn_freeze_with_branch
|
73
|
+
repository = BasicGitRepository.new
|
74
|
+
repository.prepare
|
75
|
+
|
76
|
+
sub_repository = ModulesSvnBranchesRepository.new
|
77
|
+
sub_repository.prepare
|
78
|
+
|
79
|
+
assert File.exists?(repository.clean_dir)
|
80
|
+
|
81
|
+
workdir = File.join(root_dir, 'test', "tmp", "workdir", "checkout", "git")
|
82
|
+
mkdir_p workdir
|
83
|
+
|
84
|
+
Dir.chdir workdir do
|
85
|
+
rm_r repository.name if File.exists? repository.name
|
86
|
+
source = repository.clean_dir
|
87
|
+
|
88
|
+
puts "About to checkout #{source}"
|
89
|
+
`git clone #{source}`
|
90
|
+
raise unless $? == 0
|
91
|
+
|
92
|
+
|
93
|
+
Dir.chdir repository.name do
|
94
|
+
Ext.run "init"
|
95
|
+
|
96
|
+
sub_source = sub_repository.clean_url
|
97
|
+
Ext.run "install", "--svn", sub_source, "-b", "branches/branch2", "modules"
|
98
|
+
|
99
|
+
ext = Ext.new
|
100
|
+
subproject = ext.subproject_by_name_or_path("modules")
|
101
|
+
|
102
|
+
assert_equal subproject.current_branch, "branches/branch2"
|
103
|
+
assert_equal subproject.current_revision, "4"
|
104
|
+
|
105
|
+
# let's freeze the revision to 3
|
106
|
+
Ext.run "freeze", "modules", "3"
|
107
|
+
assert_equal subproject.current_revision, "3"
|
108
|
+
|
109
|
+
# let's check this stuff in to test checking it out...
|
110
|
+
`git add .gitignore .externals`
|
111
|
+
raise unless $? == 0
|
112
|
+
|
113
|
+
repository.mark_dirty
|
114
|
+
|
115
|
+
`git commit -m 'froze modules to revision 3'`
|
116
|
+
raise unless $? == 0
|
117
|
+
`git push`
|
118
|
+
raise unless $? == 0
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
rm_rf workdir
|
123
|
+
mkdir_p workdir
|
124
|
+
|
125
|
+
Dir.chdir workdir do
|
126
|
+
rm_r repository.name if File.exists? repository.name
|
127
|
+
source = repository.clean_dir
|
128
|
+
|
129
|
+
puts "About to checkout #{source}"
|
130
|
+
Ext.run "checkout", "--git", source
|
131
|
+
|
132
|
+
Dir.chdir repository.name do
|
133
|
+
ext = Ext.new
|
134
|
+
subproject = ext.subproject_by_name_or_path("modules")
|
135
|
+
|
136
|
+
assert_equal subproject.current_branch, "branches/branch2"
|
137
|
+
assert_equal subproject.current_revision, "3"
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
70
142
|
end
|
71
143
|
end
|
72
144
|
end
|
data/test/test_init_git.rb
CHANGED
@@ -12,7 +12,7 @@ module Externals
|
|
12
12
|
repository = BasicGitRepository.new
|
13
13
|
repository.prepare
|
14
14
|
|
15
|
-
assert File.exists?(
|
15
|
+
assert File.exists?(repository.clean_dir)
|
16
16
|
|
17
17
|
workdir = File.join(root_dir, 'test', "tmp", "workdir")
|
18
18
|
mkdir_p workdir
|
@@ -20,7 +20,8 @@ module Externals
|
|
20
20
|
Dir.chdir workdir do
|
21
21
|
delete_if_dirty(repository.name)
|
22
22
|
if !File.exists?(repository.name)
|
23
|
-
|
23
|
+
`git clone #{repository.clean_dir} #{repository.name}`
|
24
|
+
raise unless $? == 0
|
24
25
|
end
|
25
26
|
|
26
27
|
mark_dirty(repository.name)
|
@@ -12,14 +12,14 @@ module Externals
|
|
12
12
|
repository = SimpleGitWithSub.new
|
13
13
|
repository.prepare
|
14
14
|
|
15
|
-
assert File.exists?(
|
15
|
+
assert File.exists?(repository.clean_dir)
|
16
16
|
|
17
17
|
workdir = File.join(root_dir, 'test', "tmp", "workdir")
|
18
18
|
mkdir_p workdir
|
19
19
|
|
20
20
|
Dir.chdir workdir do
|
21
21
|
if File.exists?(repository.name)
|
22
|
-
|
22
|
+
rm_rf repository.name
|
23
23
|
end
|
24
24
|
|
25
25
|
Ext.run "checkout", "--git", repository.clean_dir
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 25
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 7
|
10
|
+
version: 1.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Miles Georgi
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
19
|
-
default_executable: ext
|
18
|
+
date: 2012-07-18 00:00:00 Z
|
20
19
|
dependencies: []
|
21
20
|
|
22
21
|
description: |-
|
@@ -59,52 +58,52 @@ files:
|
|
59
58
|
- README
|
60
59
|
- MIT_LICENSE.txt
|
61
60
|
- CHANGELOG
|
62
|
-
- lib/externals/
|
63
|
-
- lib/externals/
|
64
|
-
- lib/externals/ext.rb
|
61
|
+
- lib/externals/project_types/rails.rb
|
62
|
+
- lib/externals/extensions/symbol.rb
|
65
63
|
- lib/externals/extensions/file_utils.rb
|
66
64
|
- lib/externals/extensions/string.rb
|
67
|
-
- lib/externals/extensions/symbol.rb
|
68
65
|
- lib/externals/project.rb
|
69
|
-
- lib/externals/
|
70
|
-
- lib/externals/
|
66
|
+
- lib/externals/configuration/configuration.rb
|
67
|
+
- lib/externals/ext.rb
|
71
68
|
- lib/externals/scms/svn_project.rb
|
72
|
-
- lib/externals/
|
73
|
-
- lib/externals/
|
74
|
-
- lib/externals/test/engines_with_branch1.rb
|
75
|
-
- lib/externals/test/fake_rails_repository.rb
|
76
|
-
- lib/externals/test/git_repository_from_internet.rb
|
77
|
-
- lib/externals/test/modules_svn_branches_repository.rb
|
69
|
+
- lib/externals/scms/git_project.rb
|
70
|
+
- lib/externals/command.rb
|
78
71
|
- lib/externals/test/modules_svn_repository.rb
|
79
|
-
- lib/externals/test/rails_app_git_branches.rb
|
80
|
-
- lib/externals/test/rails_app_git_repository.rb
|
81
|
-
- lib/externals/test/rails_app_svn_branches.rb
|
82
|
-
- lib/externals/test/rails_app_svn_repository.rb
|
83
72
|
- lib/externals/test/rails_app_unmanaged.rb
|
84
|
-
- lib/externals/test/
|
73
|
+
- lib/externals/test/rails_app_git_branches.rb
|
85
74
|
- lib/externals/test/simple_git_with_sub.rb
|
75
|
+
- lib/externals/test/modules_svn_branches_repository.rb
|
86
76
|
- lib/externals/test/svn_repository_from_dump.rb
|
77
|
+
- lib/externals/test/repository.rb
|
78
|
+
- lib/externals/test/engines.rb
|
79
|
+
- lib/externals/test/rails_app_git_repository.rb
|
80
|
+
- lib/externals/test/rails_app_svn_repository.rb
|
81
|
+
- lib/externals/test/rails_app_svn_branches.rb
|
87
82
|
- lib/externals/test/svn_repository_helper.rb
|
83
|
+
- lib/externals/test/basic_git_repository.rb
|
84
|
+
- lib/externals/test/git_repository_from_internet.rb
|
85
|
+
- lib/externals/test/fake_rails_repository.rb
|
86
|
+
- lib/externals/test/engines_with_branch1.rb
|
87
|
+
- lib/externals/test/git_repository.rb
|
88
88
|
- lib/externals/test_case.rb
|
89
|
-
- test/
|
90
|
-
- test/
|
91
|
-
- test/test_checkout_with_subprojects_svn.rb
|
92
|
-
- test/test_file_utils_extensions.rb
|
93
|
-
- test/test_freeze_to_revision.rb
|
94
|
-
- test/test_git_project_extract_name.rb
|
89
|
+
- test/test_string_extensions.rb
|
90
|
+
- test/test_rails_detection.rb
|
95
91
|
- test/test_init_git.rb
|
96
|
-
- test/test_out_of_date_git_subproject.rb
|
97
92
|
- test/test_projects.rb
|
98
|
-
- test/
|
99
|
-
- test/test_string_extensions.rb
|
93
|
+
- test/test_checkout_git.rb
|
100
94
|
- test/test_svn_branches.rb
|
95
|
+
- test/test_git_project_extract_name.rb
|
101
96
|
- test/test_touch_emptydirs.rb
|
97
|
+
- test/test_out_of_date_git_subproject.rb
|
102
98
|
- test/test_version.rb
|
99
|
+
- test/test_checkout_with_subprojects_git.rb
|
100
|
+
- test/test_checkout_with_subprojects_svn.rb
|
101
|
+
- test/test_freeze_to_revision.rb
|
102
|
+
- test/test_file_utils_extensions.rb
|
103
103
|
- test/setup/empty_plugin.svn.gz
|
104
|
-
- test/setup/foreign_key_migrations.svn.gz
|
105
104
|
- test/setup/redhillonrails_core.svn.gz
|
105
|
+
- test/setup/foreign_key_migrations.svn.gz
|
106
106
|
- bin/ext
|
107
|
-
has_rdoc: true
|
108
107
|
homepage: http://nopugs.com/ext-tutorial
|
109
108
|
licenses: []
|
110
109
|
|
@@ -134,25 +133,25 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
133
|
requirements: []
|
135
134
|
|
136
135
|
rubyforge_project: ext
|
137
|
-
rubygems_version: 1.
|
136
|
+
rubygems_version: 1.8.24
|
138
137
|
signing_key:
|
139
138
|
specification_version: 3
|
140
139
|
summary: Provides an SCM agnostic way to manage subprojects with a workflow similar to the svn:externals feature of subversion. It's particularly useful for rails projects that have some plugins managed by svn and some managed by git.
|
141
140
|
test_files:
|
142
|
-
- test/
|
143
|
-
- test/
|
144
|
-
- test/test_checkout_with_subprojects_svn.rb
|
145
|
-
- test/test_file_utils_extensions.rb
|
146
|
-
- test/test_freeze_to_revision.rb
|
147
|
-
- test/test_git_project_extract_name.rb
|
141
|
+
- test/test_string_extensions.rb
|
142
|
+
- test/test_rails_detection.rb
|
148
143
|
- test/test_init_git.rb
|
149
|
-
- test/test_out_of_date_git_subproject.rb
|
150
144
|
- test/test_projects.rb
|
151
|
-
- test/
|
152
|
-
- test/test_string_extensions.rb
|
145
|
+
- test/test_checkout_git.rb
|
153
146
|
- test/test_svn_branches.rb
|
147
|
+
- test/test_git_project_extract_name.rb
|
154
148
|
- test/test_touch_emptydirs.rb
|
149
|
+
- test/test_out_of_date_git_subproject.rb
|
155
150
|
- test/test_version.rb
|
151
|
+
- test/test_checkout_with_subprojects_git.rb
|
152
|
+
- test/test_checkout_with_subprojects_svn.rb
|
153
|
+
- test/test_freeze_to_revision.rb
|
154
|
+
- test/test_file_utils_extensions.rb
|
156
155
|
- test/setup/empty_plugin.svn.gz
|
157
|
-
- test/setup/foreign_key_migrations.svn.gz
|
158
156
|
- test/setup/redhillonrails_core.svn.gz
|
157
|
+
- test/setup/foreign_key_migrations.svn.gz
|