public
Description: The Git TextMate Bundle
Homepage: http://tim.theenchanter.com/
Clone URL: git://github.com/timcharper/git-tmbundle.git
auto update submodules on pull or merge
timcharper (author)
Thu Apr 24 12:07:01 -0700 2008
commit  ec7c30181dc2be60a716b3f3af78f401d8671cb6
tree    b31e3d49ac4ab7a16facee6440a88dc2ef20cee6
parent  1ad3c623a2dbfbc8c9b223113e3123f9accf835b
...
2
3
4
 
 
 
5
6
7
...
75
76
77
 
78
79
80
...
157
158
159
160
161
162
163
164
 
165
166
167
168
 
 
169
170
...
2
3
4
5
6
7
8
9
10
...
78
79
80
81
82
83
84
...
161
162
163
 
 
 
 
 
164
165
166
 
167
168
169
170
171
0
@@ -2,6 +2,9 @@ require LIB_ROOT + '/ui.rb'
0
 
0
 class BranchController < ApplicationController
0
   layout "application", :except => [:create, :delete]
0
+
0
+ include SubmoduleHelper::Update
0
+
0
   def switch
0
     current_name = git.branch.current_name
0
     items = (git.branch.names(:local) + git.branch.names(:remote)).compact.with_this_at_front(current_name)
0
@@ -75,6 +78,7 @@ class BranchController < ApplicationController
0
     flush
0
     @result = git.merge(@merge_from_branch)
0
     render "merge"
0
+ update_submodules_si_hay
0
     rescan_project
0
   end
0
     
0
@@ -157,13 +161,10 @@ class BranchController < ApplicationController
0
       else
0
         puts htmlize(output)
0
         output_show_html
0
-
0
- unless git.submodule.all.empty?
0
- puts "<br /><br /><h3>Updating submodules</h3>"
0
- puts htmlize(git.submodule.init_and_update)
0
- end
0
+ update_submodules_si_hay
0
         rescan_project
0
       end
0
-
0
     end
0
+
0
+
0
 end
0
\ No newline at end of file
...
3
4
5
 
 
6
7
8
...
51
52
53
 
 
54
55
56
...
3
4
5
6
7
8
9
10
...
53
54
55
56
57
58
59
60
0
@@ -3,6 +3,8 @@ require ENV['TM_SUPPORT_PATH'] + '/lib/ui.rb'
0
 class RemoteController < ApplicationController
0
   ALL_REMOTES = "...all remotes..."
0
   
0
+ include SubmoduleHelper::Update
0
+
0
   before_filter :set_script_at_top
0
   def set_script_at_top
0
     @script_at_top = true
0
@@ -51,6 +53,8 @@ class RemoteController < ApplicationController
0
       if ! output[:pulls].empty?
0
         puts("<h2>Log of changes pulled</h2>")
0
         output_branch_logs(output[:pulls])
0
+
0
+ update_submodules_si_hay
0
       elsif output[:nothing_to_pull]
0
         puts "Nothing to pull"
0
       end
...
22
23
24
25
 
26
27
28
...
22
23
24
 
25
26
27
28
0
@@ -22,7 +22,7 @@ class SubmoduleController < ApplicationController
0
       stream.pipe_to(STDOUT)
0
     puts "</pre>"
0
     
0
- puts git.submodule.init_and_update
0
+ puts htmlize(git.submodule.init_and_update)
0
     
0
     puts <<-EOF
0
 <p>Done.</p>
...
129
130
131
 
132
133
 
 
 
134
135
136
137
138
139
140
141
142
143
144
 
 
 
 
 
145
146
 
147
148
149
...
129
130
131
132
133
134
135
136
137
138
139
140
 
 
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
0
@@ -129,21 +129,29 @@ EOF
0
     describe "when merging" do
0
       before(:each) do
0
         @git = Git.singleton_new
0
+ @controller = BranchController.singleton_new
0
         @git.branch.stub!(:current_name).and_return("master")
0
         @git.branch.stub!(:list_names).and_return(["master", "release", "old_skool"])
0
+
0
+ TextMate::UI.should_receive(:request_item).with(:title => "Merge", :prompt => "Merge which branch into 'master':", :items => ["release", "old_skool"], :force_pick => true).and_return("release")
0
+ @git.should_receive(:merge).with("release").and_return({:text => "Success!", :conflicts => [] })
0
       end
0
       
0
       it "should merge a branch" do
0
- TextMate::UI.should_receive(:request_item).with(:title => "Merge", :prompt => "Merge which branch into 'master':", :items => ["release", "old_skool"], :force_pick => true).and_return("release")
0
- @git.should_receive(:merge).with("release").and_return({:text => "Success!", :conflicts => [] })
0
         output = capture_output do
0
           dispatch(:controller => "branch", :action => "merge")
0
         end
0
         
0
         output.should include("Success!")
0
       end
0
+
0
+ it "should update_submodules_si_hay" do
0
+ @controller.should_receive(:update_submodules_si_hay)
0
+ capture_output { dispatch(:controller => "branch", :action => "merge") }
0
+ end
0
     end
0
   end
0
+
0
   describe "when deleting branches" do
0
     before(:each) do
0
       @set_branch_to_choose = lambda { |response|
...
41
42
43
 
44
45
46
...
54
55
56
57
58
59
60
61
62
63
 
 
 
 
64
65
66
67
 
 
 
 
 
68
69
70
...
41
42
43
44
45
46
47
...
55
56
57
 
 
 
 
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
0
@@ -41,6 +41,7 @@ describe RemoteController do
0
   describe "pulling" do
0
     before(:each) do
0
       # query the sources
0
+ @controller = RemoteController.singleton_new
0
       Git.command_response["branch"] = "* master\n"
0
       Git.command_response["branch", "-r"] = " origin/master\n origin/release\n"
0
       @git.config.stub!(:[]).with("remote.origin.fetch").and_return("+refs/heads/*:refs/remotes/origin/*")
0
@@ -54,17 +55,22 @@ describe RemoteController do
0
       Git.command_response["log", "-p", "791a587..4bfc230", "."] = fixture_file("log_with_diffs.txt")
0
       Git.command_response["log", "-p", "dc29d3d..05f9ad9", "."] = fixture_file("log_with_diffs.txt")
0
       Git.command_response["pull", "origin"] = fixture_file("pull_1_5_4_3_output.txt")
0
-
0
- @output = capture_output do
0
- dispatch :controller => "remote", :action => "pull"
0
- end
0
     end
0
     
0
     it "should output log of changes pulled" do
0
+ @output = capture_output do
0
+ dispatch :controller => "remote", :action => "pull"
0
+ end
0
+
0
       @output.should include("Log of changes pulled")
0
       @output.should include("Branch 'master': 791a587..4bfc230")
0
       @output.should include("Branch 'asdf': dc29d3d..05f9ad9")
0
     end
0
+
0
+ it "should update_submodules_si_hay" do
0
+ @controller.should_receive(:update_submodules_si_hay)
0
+ capture_output { dispatch :controller => "remote", :action => "pull" }
0
+ end
0
   end
0
   
0
   describe "pushing" do

Comments

    No one has commented yet.