Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Quickly added a 'list' command to list mirrors and whether there are …

…updates available.
  • Loading branch information...
commit 8c5ef06ae17ba2c93bf100b18dd5e39353e6f75c 1 parent d7170c2
@mlightner mlightner authored ttilley committed
Showing with 40 additions and 0 deletions.
  1. +8 −0 bin/braid
  2. +32 −0 lib/braid/commands/list.rb
View
8 bin/braid
@@ -153,6 +153,14 @@ Main {
}
}
+ mode(:list) {
+ description 'Show all tracked mirrors (and if updates are available).'
+
+ run {
+ Braid::Command.run(:list)
+ }
+ }
+
mixin(:argument_path) {
argument(:path) {
attr
View
32 lib/braid/commands/list.rb
@@ -0,0 +1,32 @@
+module Braid
+ module Commands
+ class List < Command
+ def run(path = nil, options = {})
+ with_reset_on_error do
+ path ? list_one(path, options) : list_all(options)
+ end
+ end
+
+ protected
+ def list_all(options = {})
+ options.reject! { |k,v| %w(revision head).include?(k) }
+ print "\n"
+ msg "Listing all mirrors.\n=======================================================\n"
+ config.mirrors.each_with_index do |path, i|
+ mirror = config.get!(path)
+ print " #{i + 1}) #{path.to_s}"
+ print " [LOCKED]" if mirror.locked?
+ setup_remote(mirror)
+ msg "Fetching new commits for '#{mirror.path}'." if verbose?
+ mirror.fetch
+ new_revision = validate_new_revision(mirror, options["revision"])
+ target_revision = determine_target_revision(mirror, new_revision)
+ print " !!! UPDATE AVAILABLE !!!" if new_revision.to_s != mirror.base_revision.to_s
+ print "\n"
+ end
+ print "\n"
+ end
+
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.