build-tool 0.5.7 → 0.6.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.rvmrc +1 -0
- data/.yardopts +1 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +56 -0
- data/History.txt +64 -0
- data/README.txt +0 -7
- data/Rakefile +8 -56
- data/bin/build-tool +4 -1
- data/build-tool.gemspec +62 -0
- data/db/migrations/20110703074000_add_command_logs.rb +17 -0
- data/db/migrations/20110703075000_add_module_logs.rb +20 -0
- data/db/migrations/20110815170000_add_features.rb +17 -0
- data/db/migrations/20120103204700_add_modules.rb +17 -0
- data/db/migrations/20120106181200_add_settings.rb +18 -0
- data/lib/build-tool.rb +3 -4
- data/lib/build-tool/application.rb +127 -37
- data/lib/build-tool/build-system/autoconf.rb +2 -8
- data/lib/build-tool/build-system/base.rb +12 -4
- data/lib/build-tool/build-system/cmake.rb +2 -0
- data/lib/build-tool/build-system/custom.rb +2 -0
- data/lib/build-tool/build-system/kdel10n.rb +2 -0
- data/lib/build-tool/build-system/make.rb +2 -0
- data/lib/build-tool/build-system/none.rb +2 -0
- data/lib/build-tool/build-system/qmake.rb +2 -0
- data/lib/build-tool/build-system/qt.rb +4 -0
- data/lib/build-tool/cfg/lexer.rex +40 -8
- data/lib/build-tool/cfg/lexer_base.rb +3 -1
- data/lib/build-tool/cfg/node.rb +17 -1
- data/lib/build-tool/cfg/parser.y +92 -10
- data/lib/build-tool/cfg/visitor.rb +202 -78
- data/lib/build-tool/command_actions.rb +26 -10
- data/lib/build-tool/commands.rb +289 -197
- data/lib/build-tool/commands/build.rb +13 -9
- data/lib/build-tool/commands/configuration.rb +25 -0
- data/lib/build-tool/commands/configuration/edit.rb +42 -0
- data/lib/build-tool/commands/configuration/list.rb +48 -0
- data/lib/build-tool/commands/configure.rb +9 -5
- data/lib/build-tool/commands/ctags.rb +8 -3
- data/lib/build-tool/commands/environments.rb +2 -4
- data/lib/build-tool/commands/environments/list.rb +13 -10
- data/lib/build-tool/commands/environments/set.rb +5 -1
- data/lib/build-tool/commands/features.rb +24 -0
- data/lib/build-tool/commands/features/disable.rb +70 -0
- data/lib/build-tool/commands/features/enable.rb +66 -0
- data/lib/build-tool/commands/features/list.rb +92 -0
- data/lib/build-tool/commands/fetch.rb +9 -3
- data/lib/build-tool/commands/files.rb +9 -5
- data/lib/build-tool/commands/gc.rb +48 -15
- data/lib/build-tool/commands/history.rb +21 -16
- data/lib/build-tool/commands/info.rb +16 -13
- data/lib/build-tool/commands/install.rb +8 -4
- data/lib/build-tool/commands/modules.rb +2 -4
- data/lib/build-tool/commands/modules/cleanup.rb +52 -0
- data/lib/build-tool/commands/modules/disable.rb +95 -0
- data/lib/build-tool/commands/modules/enable.rb +52 -0
- data/lib/build-tool/commands/modules/info.rb +44 -35
- data/lib/build-tool/commands/modules/list.rb +67 -15
- data/lib/build-tool/commands/modules/shell.rb +8 -2
- data/lib/build-tool/commands/rebase.rb +15 -7
- data/lib/build-tool/commands/recipes.rb +2 -4
- data/lib/build-tool/commands/recipes/add.rb +16 -2
- data/lib/build-tool/commands/recipes/edit.rb +72 -0
- data/lib/build-tool/commands/recipes/incoming.rb +11 -7
- data/lib/build-tool/commands/recipes/info.rb +12 -8
- data/lib/build-tool/commands/recipes/install.rb +37 -42
- data/lib/build-tool/commands/recipes/list.rb +6 -2
- data/lib/build-tool/configuration.rb +88 -3
- data/lib/build-tool/environment.rb +2 -0
- data/lib/build-tool/errors.rb +5 -0
- data/lib/build-tool/history.rb +3 -181
- data/lib/build-tool/model/command_log.rb +93 -0
- data/lib/build-tool/model/feature.rb +80 -0
- data/lib/build-tool/{module.rb → model/module.rb} +110 -29
- data/lib/build-tool/model/module_log.rb +64 -0
- data/lib/build-tool/model/setting.rb +84 -0
- data/lib/build-tool/recipe.rb +40 -18
- data/lib/build-tool/repository.rb +39 -33
- data/lib/build-tool/server.rb +27 -3
- data/lib/build-tool/singleton.rb +2 -0
- data/lib/build-tool/sshkey.rb +2 -0
- data/lib/build-tool/state_helper.rb +64 -0
- data/lib/build-tool/vcs/archive.rb +3 -1
- data/lib/build-tool/vcs/base.rb +13 -0
- data/lib/build-tool/vcs/git-svn.rb +36 -14
- data/lib/build-tool/vcs/git.rb +180 -44
- data/lib/build-tool/vcs/mercurial.rb +25 -13
- data/lib/build-tool/vcs/svn.rb +20 -15
- data/lib/build-tool/version.rb +30 -0
- data/lib/mj/error.rb +2 -0
- data/lib/mj/logging.rb +2 -0
- data/lib/mj/mixins/inherited_attributes.rb +73 -0
- data/lib/mj/tools/editor.rb +34 -0
- data/lib/mj/tools/ssh.rb +2 -0
- data/lib/mj/tools/subprocess.rb +2 -1
- data/lib/mj/vcs/git.rb +14 -2
- data/lib/mj/visitor.rb +22 -0
- data/tasks/db.rake +36 -0
- data/tasks/racc.rake +14 -0
- data/tasks/rdoc.rake +8 -0
- data/tasks/rexical.rake +14 -0
- data/tasks/test.rake +21 -0
- data/test/integration/history_test.rb +88 -0
- data/test/integration/parser_configuration.rb +36 -0
- data/test/integration/parser_environment_parser.rb +156 -0
- data/test/integration/parser_feature_test.rb +75 -0
- data/test/integration/parser_git-svn_test.rb +92 -0
- data/test/integration/parser_git_test.rb +97 -0
- data/test/integration/parser_mercurial_test.rb +77 -0
- data/test/integration/parser_module_test.rb +103 -0
- data/test/integration/parser_svn_test.rb +92 -0
- data/test/integration/parser_test.rb +73 -0
- data/test/test_helper.rb +61 -0
- data/test/unit/configuration_test.rb +36 -0
- data/test/unit/git_configuration_test.rb +163 -0
- data/test/unit/git_svn_configuration_test.rb +240 -0
- data/test/unit/mercurial_configuration_test.rb +64 -0
- data/test/unit/model/command_log_test.rb +103 -0
- data/test/unit/model/feature_test.rb +29 -0
- data/test/unit/model/module_log_test.rb +70 -0
- data/test/unit/model/module_test.rb +32 -0
- data/test/unit/repository_test.rb +110 -0
- data/test/unit/server_test.rb +66 -0
- data/test/unit/svn_configuration_test.rb +90 -0
- metadata +134 -93
- data/Manifest.txt +0 -80
- data/db/migrations/001_command_histories.rb +0 -20
- data/db/migrations/002_module_events.rb +0 -24
- data/db/migrations/003_command_histories_add_logfile.rb +0 -19
- data/lib/build-tool/GUI.rb +0 -360
- data/lib/build-tool/commands/help.rb +0 -22
- data/lib/build-tool/commands/lsfeatures.rb +0 -76
- data/lib/build-tool/feature.rb +0 -47
data/lib/build-tool/vcs/git.rb
CHANGED
@@ -1,7 +1,36 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
|
3
|
+
require 'mj/mixins/inherited_attributes'
|
1
4
|
require 'build-tool/vcs/base'
|
2
5
|
require 'build-tool/errors'
|
3
6
|
require 'grit'
|
4
7
|
|
8
|
+
# :TODO: Push these changes to grit.
|
9
|
+
module Grit
|
10
|
+
class RepoConfig < Config
|
11
|
+
def delete(key)
|
12
|
+
@repo.git.config({:file => "#{@repo.path}/config", :unset => true }, key) if @repo
|
13
|
+
end
|
14
|
+
protected
|
15
|
+
def config_lines
|
16
|
+
@repo.git.config({:file => "#{@repo.path}/config", :list => true}).split( /\n/ ) if @repo
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class UserConfig < Config
|
21
|
+
def []=(key, value)
|
22
|
+
@repo.git.config({:global => true}, key, value)
|
23
|
+
end
|
24
|
+
def delete(key)
|
25
|
+
@repo.git.config({:global => true, :unset => true }, key)
|
26
|
+
end
|
27
|
+
protected
|
28
|
+
def config_lines
|
29
|
+
@repo.git.config({:list => true, :global => true}).split( /\n/ ) if @repo
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
5
34
|
module BuildTool; module VCS
|
6
35
|
|
7
36
|
class GitError < BuildTool::Error; end
|
@@ -82,19 +111,58 @@ def push_url
|
|
82
111
|
end
|
83
112
|
|
84
113
|
|
85
|
-
|
114
|
+
# Configuration options for the git vcs.
|
115
|
+
#
|
116
|
+
# @attr_reader [String] name returns the name of the vcs.
|
86
117
|
class GitConfiguration < BaseConfiguration
|
87
118
|
|
119
|
+
include MJ::Mixins::InheritedAttributes
|
120
|
+
|
88
121
|
def name
|
89
122
|
"git"
|
90
123
|
end
|
91
124
|
|
125
|
+
class << self
|
126
|
+
|
127
|
+
# The global configuration object
|
128
|
+
attr_accessor :global_config
|
129
|
+
|
130
|
+
# Was the global configuration ($HOME/.gitconfig) already checked?
|
131
|
+
attr_accessor :global_config_checked
|
132
|
+
end
|
133
|
+
|
92
134
|
attr_accessor :remote
|
135
|
+
def merged_remote
|
136
|
+
return parent.merged_remote.merge( @remote ) if @parent
|
137
|
+
return @remote
|
138
|
+
end
|
139
|
+
|
140
|
+
|
141
|
+
attr_accessor :options
|
142
|
+
def merged_options
|
143
|
+
return @options if self == GitConfiguration.global_config # This is the global configuration.
|
144
|
+
return parent.merged_options.merge( @options ) if @parent # We have a parent. Merge with it
|
145
|
+
return GitConfiguration.global_config.options.merge( @options ) if GitConfiguration.global_config # No parent. Merge with global
|
146
|
+
return @options # No parent, no global. Just us
|
147
|
+
end
|
148
|
+
|
149
|
+
# @return [Hash<String,String>] the configured global options.
|
150
|
+
attr_accessor :global_options
|
151
|
+
|
152
|
+
def merged_global_options
|
153
|
+
return @global_options if self == GitConfiguration.global_config
|
154
|
+
return @global_options.merge( GitConfiguration.global_config.instance_variable_get( "@global_options" ) ) if GitConfiguration.global_config
|
155
|
+
return @global_options
|
156
|
+
end
|
93
157
|
|
94
158
|
def initialize
|
95
159
|
super
|
96
160
|
@remote = {}
|
97
|
-
@track =
|
161
|
+
@track = nil
|
162
|
+
@options = {}
|
163
|
+
@global_options = {}
|
164
|
+
@already_checked_config = false
|
165
|
+
@already_checked_user_config = false
|
98
166
|
end
|
99
167
|
|
100
168
|
def vcs( mod )
|
@@ -103,9 +171,18 @@ def vcs( mod )
|
|
103
171
|
Git.new( self )
|
104
172
|
end
|
105
173
|
|
106
|
-
# The branch to track
|
107
|
-
|
174
|
+
# The remote branch to track.
|
175
|
+
# @return [String] the remote branch.
|
176
|
+
attr_writer :track
|
177
|
+
def track
|
178
|
+
return @track if @track # Our track
|
179
|
+
return parent.track if @parent # Out parents track
|
180
|
+
"origin/master" # The default
|
181
|
+
end
|
108
182
|
|
183
|
+
# The remote part of #remote.
|
184
|
+
# @see GitConfiguration#remote
|
185
|
+
# @return [String] the remote.
|
109
186
|
def track_remote
|
110
187
|
rc = track.split('/')
|
111
188
|
# If there is only one string we assume it is the branch name from
|
@@ -114,6 +191,9 @@ def track_remote
|
|
114
191
|
return rc[0]
|
115
192
|
end
|
116
193
|
|
194
|
+
# The branch part of #remote
|
195
|
+
# @see #remote
|
196
|
+
# @return [String] the branch.
|
117
197
|
def track_branch
|
118
198
|
rc = track.split('/')
|
119
199
|
# If there is only one string we assume it is the branch name from
|
@@ -127,6 +207,13 @@ def copy_configuration( other )
|
|
127
207
|
@remote = {} # Do not copy the remotes
|
128
208
|
end
|
129
209
|
|
210
|
+
#######
|
211
|
+
private
|
212
|
+
#######
|
213
|
+
|
214
|
+
@global_config = nil
|
215
|
+
@global_config_checked = false
|
216
|
+
|
130
217
|
end
|
131
218
|
|
132
219
|
#
|
@@ -142,15 +229,6 @@ def initialize( config )
|
|
142
229
|
|
143
230
|
class << self
|
144
231
|
|
145
|
-
git_available = nil
|
146
|
-
|
147
|
-
# Is the git executable available?
|
148
|
-
def git_available
|
149
|
-
return @git_available unless @git_available.nil?
|
150
|
-
%x( git --version 2>&1 )
|
151
|
-
@git_available = $?.success?
|
152
|
-
return @git_available
|
153
|
-
end
|
154
232
|
|
155
233
|
end
|
156
234
|
|
@@ -197,14 +275,7 @@ def clone
|
|
197
275
|
raise GitError, "Error while initializing the repo `git init #{local_path}'`: #{$?}"
|
198
276
|
end
|
199
277
|
|
200
|
-
|
201
|
-
if git( "remote add #{name} #{val.url}" ) != 0
|
202
|
-
raise GitError, "Error while initializing the repo `git remote add #{name} #{val.url}`: #{$?}"
|
203
|
-
end
|
204
|
-
if val.push_url and git( "remote set-url --push #{name} #{val.push_url}" ) != 0
|
205
|
-
raise GitError, "Error while initializing the repo `git remote add #{name} #{val.url}`: #{$?}"
|
206
|
-
end
|
207
|
-
end
|
278
|
+
check_config
|
208
279
|
|
209
280
|
logger.info <<-EOS
|
210
281
|
The following command sometimes fails when issued from this script. Reason unknown. The
|
@@ -232,6 +303,9 @@ def gc
|
|
232
303
|
def fetch()
|
233
304
|
if !checkedout? and !$noop
|
234
305
|
clone
|
306
|
+
else
|
307
|
+
# clone() calls those methods.
|
308
|
+
check_config
|
235
309
|
end
|
236
310
|
cmd = "fetch -q --prune #{config.track_remote}"
|
237
311
|
if ( rc = git( cmd ) ) != 0
|
@@ -245,48 +319,101 @@ def git( command, wd = local_path, &block )
|
|
245
319
|
|
246
320
|
def prepare_for_fetch
|
247
321
|
# If our server has an associated ssh-key, add it to the ssh-agent.
|
248
|
-
return check_for_sshkey( config.
|
322
|
+
return check_for_sshkey( config.merged_remote[ config.track_remote ].server.sshkey )
|
249
323
|
end
|
250
324
|
|
251
|
-
|
252
|
-
|
253
|
-
|
325
|
+
def check_user_config
|
326
|
+
return if @already_checked_user_config
|
327
|
+
# :FIXME: It would make sense to do this even if the repo is not existing but grit cannot
|
328
|
+
# handle that
|
254
329
|
if checkedout?
|
330
|
+
# Check that the options are the same as configured.
|
331
|
+
if ! GitConfiguration.global_config_checked
|
332
|
+
gitconfig = Grit::UserConfig.new(repo)
|
333
|
+
config.merged_global_options.each do |name, val|
|
334
|
+
if val != gitconfig[name]
|
335
|
+
if val.empty?
|
336
|
+
next if gitconfig[name].nil?
|
337
|
+
logger.info "repo: git-config: Removing #{name}"
|
338
|
+
gitconfig.delete name if !$noop
|
339
|
+
else
|
340
|
+
logger.info "repo: git-config: Setting #{name} to #{val}"
|
341
|
+
gitconfig[name] = val if !$noop
|
342
|
+
end
|
343
|
+
end
|
344
|
+
end
|
345
|
+
GitConfiguration.global_config_checked = true
|
346
|
+
end
|
347
|
+
end
|
348
|
+
@already_checked_user_config = true
|
349
|
+
end
|
255
350
|
|
351
|
+
def check_config
|
352
|
+
return if @already_checked_config
|
353
|
+
if checkedout?
|
256
354
|
# Check that the remotes are the same as configured.
|
257
|
-
gitconfig = repo
|
258
|
-
config.
|
259
|
-
if val.url
|
260
|
-
|
261
|
-
|
355
|
+
gitconfig = Grit::RepoConfig.new(repo)
|
356
|
+
config.merged_remote.each do |name, val|
|
357
|
+
if val.url
|
358
|
+
if gitconfig["remote.#{name}.url"].nil?
|
359
|
+
if git( "remote add #{name} #{val.url}" ) != 0
|
360
|
+
raise GitError, "Error while initializing the repo `git remote add #{name} #{val.url}`: #{$?}"
|
361
|
+
end
|
362
|
+
elsif val.url != gitconfig["remote.#{name}.url"]
|
363
|
+
logger.info "repo: Setting remote.origin.url to #{val.url}"
|
364
|
+
gitconfig["remote.#{name}.url"] = val.url
|
365
|
+
end
|
366
|
+
end
|
367
|
+
|
368
|
+
if val.push_server and val.push_url
|
369
|
+
if val.push_url != gitconfig["remote.#{name}.pushurl"].nil?
|
370
|
+
if git( "remote set-url --push #{name} #{val.push_url}" ) != 0
|
371
|
+
raise GitError, "Error while initializing the repo `git remote add #{name} #{val.url}`: #{$?}"
|
372
|
+
end
|
373
|
+
elsif val.push_url != gitconfig["remote.#{name}.pushurl"]
|
374
|
+
logger.info "repo: Setting remote.origin.pushurl to #{val.push_url}"
|
375
|
+
gitconfig["remote.#{name}.pushurl"] = val.push_url
|
376
|
+
end
|
262
377
|
end
|
263
|
-
|
264
|
-
|
265
|
-
|
378
|
+
end
|
379
|
+
|
380
|
+
# Check that the options are the same as configured.
|
381
|
+
config.merged_options.each do |name, val|
|
382
|
+
if val != gitconfig[name]
|
383
|
+
if val.empty?
|
384
|
+
next if gitconfig[name].nil?
|
385
|
+
logger.info "repo: git-config: Removing #{name}"
|
386
|
+
gitconfig.delete name if !$noop
|
387
|
+
else
|
388
|
+
logger.info "repo: git-config: Setting #{name} to #{val}"
|
389
|
+
gitconfig[name] = val if !$noop
|
390
|
+
end
|
266
391
|
end
|
267
392
|
end
|
268
393
|
|
269
394
|
# Check if there is a commit template. If yes add it.
|
270
|
-
if ( not gitconfig["commit.template"] )
|
395
|
+
if ( not gitconfig["commit.template"] and not config.merged_options["commit.template"] ) and Pathname.new( local_path ).join( '.commit-template' ).exist?
|
271
396
|
logger.info "#{config.module.name}: git-config: Setting commit.template to .commit-template"
|
272
|
-
gitconfig["commit.template"] = ".commit-template"
|
273
|
-
end
|
397
|
+
gitconfig["commit.template"] = ".commit-template" if !$noop
|
274
398
|
|
399
|
+
end
|
400
|
+
@already_checked_config = true
|
275
401
|
end
|
276
402
|
end
|
277
403
|
|
278
404
|
def ready_for_fetch
|
279
|
-
if not Git.git_available
|
280
|
-
logger.
|
405
|
+
if not MJ::VCS::Git.git_available?
|
406
|
+
logger.error( "#{config.module.name}: Calling `git` failed!" )
|
407
|
+
return false
|
281
408
|
end
|
282
|
-
|
409
|
+
|
410
|
+
return true
|
283
411
|
end
|
284
412
|
|
285
413
|
# Check if the module is ready for a rebase.
|
286
414
|
def ready_for_rebase
|
287
|
-
|
415
|
+
check_user_config
|
288
416
|
if checkedout?
|
289
|
-
|
290
417
|
# Check if the index is dirty.
|
291
418
|
if git( "diff --exit-code" ) != 0
|
292
419
|
logger.info( "#{config.module.name}: A dirty index will prevent the rebase." )
|
@@ -307,9 +434,18 @@ def ready_for_rebase
|
|
307
434
|
true
|
308
435
|
end
|
309
436
|
|
310
|
-
def rebase
|
311
|
-
|
312
|
-
|
437
|
+
def rebase( verbose = false )
|
438
|
+
check_config
|
439
|
+
remote_branch = "#{config.track_remote}/#{config.track_branch}"
|
440
|
+
|
441
|
+
if verbose
|
442
|
+
git('log --first-parent HEAD..%s' % remote_branch ) do |line|
|
443
|
+
logger.info( line )
|
444
|
+
end
|
445
|
+
end
|
446
|
+
|
447
|
+
if 0 != ( git "rebase #{remote_branch}" )
|
448
|
+
raise GitError, "Error while rebasing the repo with `#{remote_branch}': #{$?}"
|
313
449
|
end
|
314
450
|
end
|
315
451
|
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
|
3
|
+
require 'mj/mixins/inherited_attributes'
|
1
4
|
require 'build-tool/vcs/base'
|
2
5
|
require 'build-tool/errors'
|
3
6
|
|
@@ -7,15 +10,16 @@ class MercurialError < BuildTool::Error; end
|
|
7
10
|
|
8
11
|
class MercurialConfiguration < BaseConfiguration
|
9
12
|
|
13
|
+
include MJ::Mixins::InheritedAttributes
|
14
|
+
|
10
15
|
def name
|
11
16
|
"mercurial"
|
12
17
|
end
|
13
18
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
@remote = {}
|
19
|
+
def initialize
|
20
|
+
super
|
21
|
+
@url = nil
|
22
|
+
@track = nil
|
19
23
|
end
|
20
24
|
|
21
25
|
def vcs( mod )
|
@@ -24,13 +28,17 @@ def vcs( mod )
|
|
24
28
|
Mercurial.new( self )
|
25
29
|
end
|
26
30
|
|
27
|
-
|
28
|
-
|
31
|
+
attr_writer :track
|
32
|
+
def track
|
33
|
+
return @track if @track
|
34
|
+
return parent.track if @parent
|
35
|
+
return 'default'
|
29
36
|
end
|
30
37
|
|
38
|
+
inherited_attr_accessor :url
|
39
|
+
|
31
40
|
def copy_configuration( other )
|
32
41
|
super
|
33
|
-
@remote = {} # Do not copy the remote
|
34
42
|
end
|
35
43
|
end
|
36
44
|
|
@@ -41,7 +49,6 @@ class Mercurial < Base
|
|
41
49
|
|
42
50
|
def initialize( config )
|
43
51
|
super( config )
|
44
|
-
@remote = {}
|
45
52
|
@vcs = nil
|
46
53
|
end
|
47
54
|
|
@@ -77,7 +84,7 @@ def clone
|
|
77
84
|
FileUtils.mkdir_p Pathname.new( local_path ).dirname if ! $noop
|
78
85
|
|
79
86
|
# Initialize the repository
|
80
|
-
if hg( "clone #{
|
87
|
+
if hg( "clone #{config.url} #{local_path}", Pathname.new( local_path ).dirname) != 0
|
81
88
|
raise MercurialError, "Error while initializing the repo `hg init #{local_path}'`: #{$?}"
|
82
89
|
end
|
83
90
|
|
@@ -92,7 +99,7 @@ def fetch()
|
|
92
99
|
if !checkedout? and !$noop
|
93
100
|
clone
|
94
101
|
end
|
95
|
-
cmd = "pull #{
|
102
|
+
cmd = "pull #{config.url}"
|
96
103
|
if ( rc = hg( cmd ) ) != 0
|
97
104
|
raise MercurialError, "Error while fetching: #{rc}"
|
98
105
|
end
|
@@ -106,8 +113,13 @@ def hg( command, wd = local_path, &block )
|
|
106
113
|
rc
|
107
114
|
end
|
108
115
|
|
109
|
-
def rebase
|
110
|
-
|
116
|
+
def rebase( verbose = false )
|
117
|
+
|
118
|
+
if verbose
|
119
|
+
logger.info( 'Verbose rebase not yet implemented for mercurial.' )
|
120
|
+
end
|
121
|
+
|
122
|
+
if 0 != ( hg "update #{config.track}" )
|
111
123
|
raise MercurialSvnError, "Error while rebasing the repo with `hg update: #{$?}"
|
112
124
|
end
|
113
125
|
end
|
data/lib/build-tool/vcs/svn.rb
CHANGED
@@ -1,9 +1,15 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
|
1
3
|
require 'build-tool/vcs/base'
|
2
4
|
|
5
|
+
require 'mj/mixins/inherited_attributes'
|
6
|
+
|
3
7
|
module BuildTool; module VCS
|
4
8
|
|
5
9
|
class SvnConfiguration < BaseConfiguration
|
6
10
|
|
11
|
+
include MJ::Mixins::InheritedAttributes
|
12
|
+
|
7
13
|
def initialize
|
8
14
|
super
|
9
15
|
@only = nil
|
@@ -18,14 +24,10 @@ def name
|
|
18
24
|
def vcs( mod )
|
19
25
|
raise StandardError if @module and ! mod.equal?( @module )
|
20
26
|
@module = mod
|
21
|
-
Svn.new( self )
|
27
|
+
Svn.new( self )
|
22
28
|
end
|
23
29
|
|
24
|
-
|
25
|
-
def only=( list )
|
26
|
-
@only = list
|
27
|
-
puts @only.inspect
|
28
|
-
end
|
30
|
+
inherited_attr_accessor :only
|
29
31
|
|
30
32
|
def copy_configuration( other )
|
31
33
|
super
|
@@ -34,18 +36,16 @@ def copy_configuration( other )
|
|
34
36
|
|
35
37
|
attr_writer :repository
|
36
38
|
def repository
|
37
|
-
if @repository
|
38
|
-
|
39
|
-
|
40
|
-
@repository
|
39
|
+
return @repository if @repository # Our repository
|
40
|
+
return parent.repository if @parent # Our parents repository
|
41
|
+
raise ConfigurationError, "No repository configured for module #{self.module ? self.module.name : 'unknown' }."
|
41
42
|
end
|
42
43
|
|
43
44
|
attr_writer :remote_path
|
44
45
|
def remote_path
|
45
|
-
if @remote_path
|
46
|
-
|
47
|
-
|
48
|
-
@remote_path
|
46
|
+
return @remote_path if @remote_path
|
47
|
+
return parent.remote_path if @parent
|
48
|
+
return @module.name
|
49
49
|
end
|
50
50
|
|
51
51
|
end
|
@@ -180,7 +180,12 @@ def self.svn( command, wd, &block )
|
|
180
180
|
rc
|
181
181
|
end
|
182
182
|
|
183
|
-
def rebase
|
183
|
+
def rebase( verbose = false )
|
184
|
+
|
185
|
+
if verbose
|
186
|
+
logger.info( 'Verbose rebase not yet implemented for subversion.' )
|
187
|
+
end
|
188
|
+
|
184
189
|
# Rebasing is not supported
|
185
190
|
0
|
186
191
|
end
|