gollum-rugged_adapter 0.2b → 0.3b

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YWUyNjcxMGEzMTk5YWRhNDA3YWNmYjA3NzU1NmY5NWRhNDJjMmNjZQ==
5
- data.tar.gz: !binary |-
6
- YjY1MjA3YzEwMTlmY2ZlYmI0ZDQ0MWZlNDkwZjc4ZTg2MzljYjQ3MA==
2
+ SHA1:
3
+ metadata.gz: 681f1982e090a6564d149a492bcca52a729f2847
4
+ data.tar.gz: ad1568ee08b703c30c9f9f79415fade9da9b81d4
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ZjEyMjRlMjYzMzRjOGQzN2I4ZDc4MGY5MmRiODk3ZDVhMTk0MTY0M2E2ZDdk
10
- NWExOTQyOWViMzk1ZWY4YmZlMTIzODFiZGYzYjA1NjAyOWU5ZTNjYTJiZTk3
11
- NGQwYWRmNWIzZjE3Yzg1ZjIzZTY4MGM5YmZhOWI0YjY2MTA2Y2Q=
12
- data.tar.gz: !binary |-
13
- NWFjZjBjYTgyYjA1MDk4MTVjMjc5YmQ3MjIwYjQ1MmE1MzFhMDQzM2M5NTBk
14
- NTg4ZTBmYzRkYmU5YTk0ODExMmMzNmZlNmViZTM2MmEyM2I1ODc3ZDc4NzY0
15
- YjRkYTU5OTAyNzk3ZTM1MGJjNzg5MWNiZWFkNTVlMGI5M2Y0OTI=
6
+ metadata.gz: 4390808d02e57389b0c86b324030487bf6646fe0d6fb4be975a54edd49183b59736863d765537b9e14adb2ba9d0038011a7a1d7e42fa60248f21022fbcba06ac
7
+ data.tar.gz: 2b4cf0f1f2f8dc83a1c8461befee408233c436f43c3aca90ac89c47bcdf9a47d236ea743e81ec9323273c6a994837f509f1faa6ffafa492520267d16cb1dd751
@@ -273,6 +273,34 @@ module Gollum
273
273
  sha_or_commit_from_ref(ref, :commit)
274
274
  end
275
275
 
276
+ def push(remote, branches = nil, options = {})
277
+ branches = [branches].flatten.map {|branch| "refs/heads/#{branch}" unless branch =~ /^refs\/heads\//}
278
+ @repo.push(remote, branches, options)
279
+ end
280
+
281
+ def pull(remote, branches = nil, options = {})
282
+ branches = [branches].flatten.map {|branch| "refs/heads/#{branch}" unless branch =~ /^refs\/heads\//}
283
+ r = @repo.remotes[remote]
284
+ r.fetch(branches, options)
285
+ r.save
286
+ branches.each do |branch|
287
+ branch_name = branch.match(/^refs\/heads\/(.*)/)[1]
288
+ remote_name = remote.match(/^(refs\/heads\/)?(.*)/)[2]
289
+ remote_ref = @repo.branches["#{remote_name}/#{branch_name}"].target
290
+ local_ref = @repo.branches[branch].target
291
+ index = @repo.merge_commits(local_ref, remote_ref)
292
+ options = { author: Actor.default_actor.to_h,
293
+ committer: Actor.default_actor.to_h,
294
+ message: "Merged branch #{branch} of #{remote}.",
295
+ parents: [local_ref, remote_ref],
296
+ tree: index.write_tree(@repo),
297
+ update_ref: branch
298
+ }
299
+ Rugged::Commit.create @repo, options
300
+ @repo.checkout(@repo.head.name, :strategy => :force) if !@repo.bare? && branch == @repo.head.name
301
+ end
302
+ end
303
+
276
304
  private
277
305
 
278
306
  def sha?(str)
@@ -1,7 +1,7 @@
1
1
  module Gollum
2
2
  module Lib
3
3
  module Git
4
- VERSION = '0.2b'
4
+ VERSION = '0.3b'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gollum-rugged_adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2b
4
+ version: 0.3b
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bart Kamphorst, Dawa Ometto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-20 00:00:00.000000000 Z
11
+ date: 2015-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged
@@ -17,7 +17,7 @@ dependencies:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.21.3
20
- - - ! '>='
20
+ - - '>='
21
21
  - !ruby/object:Gem::Version
22
22
  version: 0.21.3
23
23
  type: :runtime
@@ -27,7 +27,7 @@ dependencies:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: 0.21.3
30
- - - ! '>='
30
+ - - '>='
31
31
  - !ruby/object:Gem::Version
32
32
  version: 0.21.3
33
33
  - !ruby/object:Gem::Dependency
@@ -66,17 +66,17 @@ require_paths:
66
66
  - lib
67
67
  required_ruby_version: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - ! '>='
69
+ - - '>='
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
72
  required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ! '>'
74
+ - - '>'
75
75
  - !ruby/object:Gem::Version
76
76
  version: 1.3.1
77
77
  requirements: []
78
78
  rubyforge_project:
79
- rubygems_version: 2.4.1
79
+ rubygems_version: 2.2.2
80
80
  signing_key:
81
81
  specification_version: 4
82
82
  summary: Adapter for Gollum to use Rugged (libgit2) at the backend.