Permalink
Browse files

Merge pull request #9 from iteleport/to_contribute

braid push branches bugfix, add -f/--force to braid setup, add -v/--verbose to braid list
  • Loading branch information...
2 parents 7d8df39 + 2fa29f7 commit 2dfb78b45d255a299fc593b4d4a9badb3e99985c @ttilley ttilley committed Jul 9, 2011
Showing with 34 additions and 5 deletions.
  1. +13 −1 bin/braid
  2. +8 −0 lib/braid.rb
  3. +4 −0 lib/braid/command.rb
  4. +1 −1 lib/braid/commands/push.rb
  5. +7 −2 lib/braid/commands/setup.rb
  6. +1 −1 lib/braid/version.rb
View
@@ -137,10 +137,11 @@ Main {
Set up git and git-svn remotes.
TXT
- mixin :optional_path, :option_verbose
+ mixin :optional_path, :option_verbose, :option_force
run {
Braid.verbose = verbose
+ Braid.force = force
Braid::Command.run(:setup, path)
}
}
@@ -156,7 +157,10 @@ Main {
mode(:list) {
description 'Show all tracked mirrors (and if updates are available).'
+ mixin :option_verbose
+
run {
+ Braid.verbose = verbose
Braid::Command.run(:list)
}
}
@@ -239,6 +243,14 @@ Main {
}
}
+ mixin(:option_force) {
+ option(:force, :f) {
+ optional
+ desc 'force'
+ attr
+ }
+ }
+
mixin(:option_keep_remote) {
option(:keep) {
optional
View
@@ -13,6 +13,14 @@ def self.verbose=(new_value)
@verbose = !!new_value
end
+ def self.force
+ @force || false
+ end
+
+ def self.force=(new_value)
+ @force = !!new_value
+ end
+
def self.use_local_cache
[nil, "true", "1"].include?(ENV["BRAID_USE_LOCAL_CACHE"])
end
@@ -38,6 +38,10 @@ def verbose?
Braid.verbose
end
+ def force?
+ Braid.force
+ end
+
private
def setup_remote(mirror)
@@ -34,7 +34,7 @@ def run(path, options = {})
msg "Cloning mirror with local changes."
git.init
git.fetch(source_dir)
- git.fetch(remote_url)
+ git.fetch(remote_url, "+refs/heads/#{mirror.branch}")
git.checkout(base_revision)
git.apply(diff)
system("git commit -v")
@@ -18,8 +18,13 @@ def setup_one(path)
mirror = config.get!(path)
if git.remote_url(mirror.remote)
- msg "Setup: Mirror '#{mirror.path}' already has a remote. Reusing it." if verbose?
- return
+ if force?
+ msg "Setup: Mirror '#{mirror.path}' already has a remote. Replacing it (force)" if verbose?
+ git.remote_rm(mirror.remote)
+ else
+ msg "Setup: Mirror '#{mirror.path}' already has a remote. Reusing it." if verbose?
+ return
+ end
end
msg "Setup: Creating remote for '#{mirror.path}'."
@@ -1,3 +1,3 @@
module Braid
- VERSION = "0.6.2.2"
+ VERSION = "0.7.0"
end

0 comments on commit 2dfb78b

Please sign in to comment.