autobuild 1.9.0.b1 → 1.9.0.b2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 89ad5685bb460bc80765d7677953c83335bad861
4
- data.tar.gz: 74b187763b5789e40f6f0dd7aae2d58cfca004cf
3
+ metadata.gz: 0a17e6033c3c9c0a0bf7ff4e8eeccbfcc777a914
4
+ data.tar.gz: ee6480b0e089711f67ba08a4361a1bd283f7992b
5
5
  SHA512:
6
- metadata.gz: b3cf9d6af419fa355ec32fdde8c0c83ce8f41beb287eb9717a32f94b107fe7cbb9adc58e8bbce8bacbfb5b023ea087728b3af4b9889ad2d8e3bdd7337075d22b
7
- data.tar.gz: f0445a03f3aff872a12e5b739388d37b5afcb87dddaf43ec5b658cc7aa9b580147c4d4c08101f0ed59f7b7b3e45e757cf2dfba71735fa843c2fa1c14eebb7eac
6
+ metadata.gz: cdbfc5c964b12cc5be90c9f18f8abc9264fa8a07296b75f323c751d3f2a1400bf0a98357f43eeaaed59a0d42313c3098926524adc32fc2d5ee852a2ddf143b7f
7
+ data.tar.gz: 247a8bbc07a21967916caf4c74b5daba7abfdbc797617b6f842f3d5be16be6fb09321d7883cb5469333fa3434f725d7592e2a72b1bfc532876de803e3d0744b1
@@ -520,7 +520,10 @@ module Autobuild
520
520
  end
521
521
  end
522
522
 
523
- def rev_parse(package, name)
523
+ def rev_parse(package, name, object_type = "commit")
524
+ if object_type
525
+ name = "#{name}^{#{object_type}}"
526
+ end
524
527
  run_git_bare(package, 'rev-parse', name).first
525
528
  rescue Autobuild::SubcommandFailed
526
529
  raise PackageException.new(package, 'import'), "failed to resolve #{name}. Are you sure this commit, branch or tag exists ?"
@@ -540,12 +543,15 @@ module Autobuild
540
543
  # 'commit' is present in the history of 'reference'
541
544
  #
542
545
  # @return [Boolean]
543
- def commit_present_in?(package, commit, reference)
544
- merge_base = run_git_bare(package, 'merge-base', commit, reference).first
545
- merge_base == commit
546
-
547
- rescue Exception
548
- raise PackageException.new(package, 'import'), "failed to find the merge-base between #{commit} and #{reference}. Are you sure these commits exist ?"
546
+ def commit_present_in?(package, rev, reference)
547
+ commit = rev_parse(package, rev)
548
+ begin
549
+ merge_base = run_git_bare(package, 'merge-base', commit, reference).first
550
+ merge_base == commit
551
+
552
+ rescue Exception => e
553
+ raise PackageException.new(package, 'import'), "failed to find the merge-base between #{rev} and #{reference}. Are you sure these commits exist ?"
554
+ end
549
555
  end
550
556
 
551
557
  # Computes the update status to update a branch whose tip is at
@@ -740,7 +746,7 @@ module Autobuild
740
746
  Autobuild.tool('git'), 'clone', '-o', remote_name, *clone_options, repository, package.importdir, retry: true)
741
747
 
742
748
  update_remotes_configuration(package)
743
- update(package, only_local: true)
749
+ update(package, only_local: true, reset: true)
744
750
  end
745
751
 
746
752
  # Changes the repository this importer is pointing to
@@ -1,5 +1,5 @@
1
1
  module Autobuild
2
- VERSION = "1.9.0.b1" unless defined? Autobuild::VERSION
2
+ VERSION = "1.9.0.b2" unless defined? Autobuild::VERSION
3
3
  end
4
4
 
5
5
 
Binary file
@@ -72,7 +72,7 @@ describe Autobuild::Git do
72
72
  assert !importer.has_commit?(pkg, 'blabla')
73
73
  end
74
74
  it "returns false if the specified commit is not present locally" do
75
- assert !importer.has_commit?(pkg, '1ddb20665622279700770be09f9a291b37c9b631')
75
+ assert !importer.has_commit?(pkg, 'c8cf0798b1d53931314a86bdb3e2ad874eb8deb5')
76
76
  end
77
77
  it "raises for any other error" do
78
78
  flexmock(Autobuild::Subprocess).should_receive(:run).
@@ -205,9 +205,35 @@ describe Autobuild::Git do
205
205
  end
206
206
  end
207
207
 
208
+ describe "#commit_present_in?" do
209
+ attr_reader :commits
210
+ before do
211
+ importer.import(pkg)
212
+ @commits = [
213
+ importer.rev_parse(pkg, 'HEAD'),
214
+ importer.rev_parse(pkg, 'HEAD~1')]
215
+ end
216
+
217
+ it "returns true if the revision is in the provided branch" do
218
+ assert importer.commit_present_in?(pkg, 'HEAD', 'master')
219
+ assert importer.commit_present_in?(pkg, commits[0], 'master')
220
+ assert importer.commit_present_in?(pkg, 'HEAD~1', 'master')
221
+ assert importer.commit_present_in?(pkg, commits[1], 'master')
222
+ end
223
+ it "returns false if the revision is not in the provided branch" do
224
+ importer.run_git(pkg, 'branch', 'fork', 'autobuild/fork')
225
+ assert !importer.commit_present_in?(pkg, commits[0], "refs/heads/fork")
226
+ end
227
+ # git rev-parse return the tag ID for annotated tags instead of the
228
+ # commit ID. This was in turn breaking commit_present_in?
229
+ it "handles annotated tags properly" do
230
+ importer.run_git(pkg, 'tag', '-a', '-m', 'tag0', "tag0", "HEAD~1")
231
+ assert importer.commit_present_in?(pkg, 'tag0', 'master')
232
+ end
233
+ end
234
+
208
235
  describe "update" do
209
236
  def self.common_commit_and_tag_behaviour
210
-
211
237
  it "does not access the repository if the target is already merged and reset is false" do
212
238
  importer.import(pkg)
213
239
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autobuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0.b1
4
+ version: 1.9.0.b2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-10 00:00:00.000000000 Z
11
+ date: 2015-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -178,5 +178,4 @@ rubygems_version: 2.2.2
178
178
  signing_key:
179
179
  specification_version: 4
180
180
  summary: Library to handle build systems and import mechanisms
181
- test_files:
182
- - test/suite.rb
181
+ test_files: []