diff --git a/bin/rbpkg b/bin/rbpkg
index 6deff23..9e4db14 100755
--- a/bin/rbpkg
+++ b/bin/rbpkg
@@ -51,6 +51,8 @@ def rbpkg(args)
Rbpkg.git_clone(args[1..])
when "clean-sources"
Rbpkg.clean_sources(args[1..])
+ when "fetch"
+ Rbpkg.fetch(args[1..])
when "info"
Rbpkg.info(args[1..])
else
diff --git a/lib/rbpkg.rb b/lib/rbpkg.rb
index c56e8ee..326bfa8 100644
--- a/lib/rbpkg.rb
+++ b/lib/rbpkg.rb
@@ -24,6 +24,12 @@ module Rbpkg
end
end
+ def self.fetch(repos)
+ repos.each do |name|
+ Repos.repo(name).fetch()
+ end
+ end
+
def self.git_clone(repos)
repos.each do |name|
Repos.repo(name).git_clone()
diff --git a/lib/rbpkg/repo.rb b/lib/rbpkg/repo.rb
index 5484800..1a47dba 100644
--- a/lib/rbpkg/repo.rb
+++ b/lib/rbpkg/repo.rb
@@ -15,6 +15,11 @@ class Rbpkg::Repo
"#{File.basename(File.dirname(git_url))}/#{name}"
end
+ def fetch
+ raise "must clone first" unless File.directory?(src_dir)
+ cmd "cd #{sh_quote(src_dir)} && git fetch"
+ end
+
def git_clone
if File.directory?(src_dir)
false