summaryrefslogtreecommitdiffstats
path: root/lib/git/base.rb
diff options
context:
space:
mode:
authorscott Chacon <schacon@agadorsparticus.(none)>2007-11-11 16:01:23 -0800
committerscott Chacon <schacon@agadorsparticus.(none)>2007-11-11 16:01:23 -0800
commit907b03949bab53e2f7d55094100a71abd22f23e7 (patch)
tree51b7fca355ac7007957d966cbebbcbf331c57d7d /lib/git/base.rb
parentb81ee9305f418209ba0d77fbb7b47b23d4b121ca (diff)
downloadthird_party-ruby-git-907b03949bab53e2f7d55094100a71abd22f23e7.tar.gz
third_party-ruby-git-907b03949bab53e2f7d55094100a71abd22f23e7.tar.xz
third_party-ruby-git-907b03949bab53e2f7d55094100a71abd22f23e7.zip
added tagging
Diffstat (limited to 'lib/git/base.rb')
-rw-r--r--lib/git/base.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/git/base.rb b/lib/git/base.rb
index 0b837cb..ffd8a2b 100644
--- a/lib/git/base.rb
+++ b/lib/git/base.rb
@@ -84,6 +84,11 @@ module Git
@index
end
+ def chdir
+ Dir.chdir(dir.path) do
+ yield dir.path
+ end
+ end
#g.config('user.name', 'Scott Chacon') # sets value
#g.config('user.email', 'email@email.com') # sets value
@@ -128,6 +133,10 @@ module Git
Git::Branch.new(self, branch_name)
end
+ def remote(remote_name = 'origin')
+ Git::Remote.new(self, remote_name)
+ end
+
def lib
Git::Lib.new(self)
@@ -172,11 +181,46 @@ module Git
self.lib.checkout(branch, opts)
end
+ def fetch(remote = 'origin')
+ self.lib.fetch(remote)
+ end
+
def merge(branch, message = 'merge')
self.lib.merge(branch, message)
end
+ def pull(remote = 'origin', branch = 'master', message = 'origin pull')
+ fetch(remote)
+ merge(branch, message)
+ end
+
+ def remotes
+ self.lib.remotes.map { |r| Git::Remote.new(self, r) }
+ end
+
+ def add_remote(name, url, opts = {})
+ if url.is_a?(Git::Base)
+ url = url.repo.path
+ end
+ self.lib.remote_add(name, url, opts)
+ Git::Remote.new(self, name)
+ end
+
+ def tags
+ self.lib.tags.map { |r| tag(r) }
+ end
+
+ def tag(tag_name)
+ Git::Object.new(self, tag_name, true)
+ end
+
+ def add_tag(tag_name)
+ self.lib.tag(tag_name)
+ tag(tag_name)
+ end
+
# convenience methods
+
def revparse(objectish)
self.lib.revparse(objectish)