dreamcat4-braid 0.531 → 0.533
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/braid +2 -2
- data/braid.gemspec +1 -1
- data/lib/braid/command.rb +1 -1
- data/lib/braid/commands/add.rb +2 -2
- data/lib/braid/commands/update.rb +9 -4
- data/lib/braid/config.rb +14 -0
- data/lib/braid/mirror.rb +25 -15
- data/lib/braid/operations.rb +2 -2
- data/lib/braid/rspec_git.rb +4 -1
- data/lib/braid.rb +3 -1
- metadata +1 -1
data/bin/braid
CHANGED
@@ -75,11 +75,11 @@ Main {
|
|
75
75
|
. braid update local/dir
|
76
76
|
TXT
|
77
77
|
|
78
|
-
mixin :optional_path, :option_revision, :option_head, :option_verbose
|
78
|
+
mixin :optional_path, :option_branch, :option_revision, :option_head, :option_verbose
|
79
79
|
|
80
80
|
run {
|
81
81
|
Braid.verbose = verbose
|
82
|
-
Braid::Command.run(:update, path, { "revision" => revision, "head" => head })
|
82
|
+
Braid::Command.run(:update, path, { "branch" => branch, "revision" => revision, "head" => head })
|
83
83
|
}
|
84
84
|
}
|
85
85
|
|
data/braid.gemspec
CHANGED
data/lib/braid/command.rb
CHANGED
data/lib/braid/commands/add.rb
CHANGED
@@ -18,8 +18,8 @@ module Braid
|
|
18
18
|
|
19
19
|
if mirror.type == "git-clone"
|
20
20
|
gitclone.add_gitignore(mirror.path)
|
21
|
-
mirror.rspec_git.update
|
22
|
-
commit_message = "
|
21
|
+
mirror.rspec_git.update mirror.branch
|
22
|
+
commit_message = "added \'#{mirror.rspec_git.url}\' to path:\'#{mirror.path}\'"
|
23
23
|
else
|
24
24
|
mirror.fetch
|
25
25
|
|
@@ -25,7 +25,12 @@ module Braid
|
|
25
25
|
msg "Updating mirror '#{mirror.path}'#{revision_message}."
|
26
26
|
|
27
27
|
if mirror.type == "git-clone"
|
28
|
-
mirror.
|
28
|
+
mirror.branch = options["branch"] || mirror.branch
|
29
|
+
# config.update(mirror)
|
30
|
+
mirror.rspec_git.update mirror.branch
|
31
|
+
config.update(mirror)
|
32
|
+
add_config_file
|
33
|
+
commit_message = "Updated clone repository '#{mirror.path}' to #{mirror.branch}"
|
29
34
|
else
|
30
35
|
|
31
36
|
# check options for lock modification
|
@@ -88,10 +93,10 @@ module Braid
|
|
88
93
|
File.open(".git/MERGE_MSG", 'w') { |f| f.puts(commit_message) }
|
89
94
|
return
|
90
95
|
end
|
91
|
-
|
92
|
-
git.commit(commit_message)
|
93
|
-
msg commit_message
|
94
96
|
end
|
97
|
+
|
98
|
+
git.commit(commit_message)
|
99
|
+
msg commit_message
|
95
100
|
end
|
96
101
|
|
97
102
|
def generate_tree_hash(mirror, revision)
|
data/lib/braid/config.rb
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
require 'yaml/store'
|
3
3
|
|
4
|
+
class Hash
|
5
|
+
# Replacing the to_yaml function so it'll serialize hashes sorted (by their keys)
|
6
|
+
# Original function is in /usr/lib/ruby/1.8/yaml/rubytypes.rb
|
7
|
+
def to_yaml( opts = {} )
|
8
|
+
YAML::quick_emit( object_id, opts ) do |out|
|
9
|
+
out.map( taguri, to_yaml_style ) do |map|
|
10
|
+
sort.each do |k, v| # <-- here's my addition (the 'sort')
|
11
|
+
map.add( k, v )
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
4
18
|
module Braid
|
5
19
|
class Config
|
6
20
|
class PathAlreadyInUse < BraidError
|
data/lib/braid/mirror.rb
CHANGED
@@ -2,7 +2,7 @@ $:.unshift File.dirname(__FILE__)
|
|
2
2
|
require 'rspec_git.rb'
|
3
3
|
|
4
4
|
module Braid
|
5
|
-
class Mirror
|
5
|
+
class Mirror
|
6
6
|
TYPES = %w(git svn git-clone)
|
7
7
|
ATTRIBUTES = %w(url remote type branch squashed revision lock)
|
8
8
|
|
@@ -37,11 +37,11 @@ module Braid
|
|
37
37
|
|
38
38
|
branch = options["branch"] || "master"
|
39
39
|
|
40
|
-
if type = options["type"] || extract_type_from_url(url)
|
41
|
-
|
42
|
-
else
|
43
|
-
|
44
|
-
end
|
40
|
+
# if type = options["type"] || extract_type_from_url(url)
|
41
|
+
# raise UnknownType, type unless TYPES.include?(type)
|
42
|
+
# else
|
43
|
+
# raise CannotGuessType, url
|
44
|
+
# end
|
45
45
|
|
46
46
|
unless path = options["path"] || extract_path_from_url(url)
|
47
47
|
raise PathRequired
|
@@ -55,33 +55,43 @@ module Braid
|
|
55
55
|
path = "vendor/gems/#{path}"
|
56
56
|
end
|
57
57
|
|
58
|
-
if type != "git-clone"
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
58
|
+
# if type != "git-clone"
|
59
|
+
# remote = "braid/#{path}".gsub("_", '-') # stupid git svn changes all _ to ., weird
|
60
|
+
# squashed = !options["full"]
|
61
|
+
# branch = nil if type == "svn"
|
62
|
+
# end
|
63
63
|
|
64
|
-
attributes = { "url" => url, "remote" => remote, "type" => type, "branch" => branch, "squashed" => squashed }
|
64
|
+
# attributes = { "url" => url, "remote" => remote, "type" => type, "branch" => branch, "squashed" => squashed }
|
65
|
+
attributes = { "url" => url, "branch" => branch }
|
65
66
|
self.new(path, attributes)
|
66
67
|
end
|
67
|
-
|
68
|
+
|
68
69
|
def ==(comparison)
|
69
70
|
path == comparison.path && attributes == comparison.attributes
|
70
71
|
end
|
71
72
|
|
72
73
|
def type
|
73
74
|
# override Object#type
|
74
|
-
attributes["type"]
|
75
|
+
# attributes["type"]
|
76
|
+
return "git-clone"
|
75
77
|
end
|
76
78
|
|
77
79
|
def locked?
|
78
80
|
!!lock
|
79
81
|
end
|
80
82
|
|
83
|
+
# def squashed?
|
84
|
+
# !!squashed
|
85
|
+
# end
|
86
|
+
|
81
87
|
def squashed?
|
82
|
-
|
88
|
+
return true
|
83
89
|
end
|
84
90
|
|
91
|
+
def remote
|
92
|
+
return "braid/#{path}"
|
93
|
+
end
|
94
|
+
|
85
95
|
def merged?(commit)
|
86
96
|
# tip from spearce in #git:
|
87
97
|
# `test z$(git merge-base A B) = z$(git rev-parse --verify A)`
|
data/lib/braid/operations.rb
CHANGED
@@ -125,7 +125,7 @@ module Braid
|
|
125
125
|
end
|
126
126
|
|
127
127
|
def msg(str)
|
128
|
-
puts "
|
128
|
+
puts "gitnest: #{str}"
|
129
129
|
end
|
130
130
|
|
131
131
|
def log(cmd)
|
@@ -218,7 +218,7 @@ module Braid
|
|
218
218
|
def commit(message, *args)
|
219
219
|
|
220
220
|
commit_message_file = Tempfile.new("braid_commit", ".")
|
221
|
-
commit_message_file.print("
|
221
|
+
commit_message_file.print("gitnest: " + message)
|
222
222
|
commit_message_file.flush
|
223
223
|
status, out, err = exec("git commit -F #{commit_message_file.path} --no-verify #{args.join(' ')}")
|
224
224
|
commit_message_file.unlink
|
data/lib/braid/rspec_git.rb
CHANGED
@@ -31,7 +31,10 @@ module RSpec
|
|
31
31
|
end
|
32
32
|
else
|
33
33
|
msg "** Fetching #{r[:name]}"
|
34
|
-
system "git clone #{r[:url]} #{r[:path]}"
|
34
|
+
unless system "git clone #{r[:url]} #{r[:path]}"
|
35
|
+
msg "Error cloning #{r[:url]}"
|
36
|
+
exit 1
|
37
|
+
end
|
35
38
|
end
|
36
39
|
end
|
37
40
|
msg "*** all repos updated successfully ***"
|
data/lib/braid.rb
CHANGED