autobuild 1.2.14 → 1.2.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ == Version 1.2.15
2
+ * fix branch switching in the git importer: the build will not fail anymore if
3
+ autobuild has to switch to an already existing branch
4
+
1
5
  == Version 1.2.14
2
6
  * fix git importer's handling of branch names: the importer now always works on
3
7
  a local branch that has the same name than the remote branch.
@@ -3,6 +3,6 @@ require 'autobuild/reporting'
3
3
  require 'autobuild/package'
4
4
 
5
5
  module Autobuild
6
- VERSION = "1.2.14" unless defined? Autobuild::VERSION
6
+ VERSION = "1.2.15" unless defined? Autobuild::VERSION
7
7
  end
8
8
 
@@ -44,23 +44,29 @@ module Autobuild
44
44
  # create it from FETCH_HEAD
45
45
  current_branch = `git symbolic-ref HEAD`.chomp
46
46
  if current_branch != "refs/heads/#{branch}"
47
- Subprocess.run(package.name, :import, Autobuild.tool('git'), 'checkout', '-b', branch, "FETCH_HEAD")
48
- else
49
- # Otherwise, check that the merge is a fast-forward
50
- fetch_commit = File.readlines( File.join('.git', 'FETCH_HEAD') ).
51
- delete_if { |l| l =~ /not-for-merge/ }
52
- return if fetch_commit.empty?
53
- fetch_commit = fetch_commit.first.split(/\s+/).first
47
+ # Check if the target branch already exists. If it is the
48
+ # case, check it out. Otherwise, create it.
49
+ if File.file?(File.join(".git", "refs", "heads", branch))
50
+ Subprocess.run(package.name, :import, Autobuild.tool('git'), 'checkout', branch)
51
+ else
52
+ Subprocess.run(package.name, :import, Autobuild.tool('git'), 'checkout', '-b', branch, "FETCH_HEAD")
53
+ end
54
+ end
55
+
56
+ # Now that we are on the right branch, update it
57
+ fetch_commit = File.readlines( File.join('.git', 'FETCH_HEAD') ).
58
+ delete_if { |l| l =~ /not-for-merge/ }
59
+ return if fetch_commit.empty?
60
+ fetch_commit = fetch_commit.first.split(/\s+/).first
54
61
 
55
- common_commit = `git merge-base HEAD #{fetch_commit}`.chomp
56
- head_commit = `git rev-parse #{current_branch}`.chomp
62
+ common_commit = `git merge-base HEAD #{fetch_commit}`.chomp
63
+ head_commit = `git rev-parse #{branch}`.chomp
57
64
 
58
- if common_commit != fetch_commit
59
- if merge? || common_commit == head_commit
60
- Subprocess.run(package.name, :import, Autobuild.tool('git'), 'merge', fetch_commit)
61
- else
62
- raise "importing the current version would lead to a non fast-forward"
63
- end
65
+ if common_commit != fetch_commit
66
+ if merge? || common_commit == head_commit
67
+ Subprocess.run(package.name, :import, Autobuild.tool('git'), 'merge', fetch_commit)
68
+ else
69
+ raise "importing the current version would lead to a non fast-forward"
64
70
  end
65
71
  end
66
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autobuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.14
4
+ version: 1.2.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-08 00:00:00 +02:00
12
+ date: 2009-09-11 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: 1.12.2
53
+ version: 2.3.3
54
54
  version:
55
55
  description: |-
56
56
  This work is licensed under the GPLv2 license. See License.txt for details
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  requirements: []
143
143
 
144
144
  rubyforge_project: autobuild
145
- rubygems_version: 1.3.3
145
+ rubygems_version: 1.3.5
146
146
  signing_key:
147
147
  specification_version: 3
148
148
  summary: Rake-based utility to build and install multiple packages with dependencies