implement version-specific page find

This commit is contained in:
Tom Preston-Werner
2010-04-11 12:40:29 -06:00
parent 14b29135a8
commit 769bf89587
4 changed files with 14 additions and 8 deletions
+4 -3
View File
@@ -83,11 +83,12 @@ module Gollum
# Find a page in the given Gollum repo.
#
# name - The human or canonical String page name to find.
# name - The human or canonical String page name to find.
# version - The String version ID to find.
#
# Returns a Gollum::Page or nil if the page could not be found.
def find(name)
commit = self.wiki.repo.commits.first
def find(name, version)
commit = self.wiki.repo.commit(version)
if page = find_page_in_tree(commit.tree, name)
page.version = commit
page
+4 -3
View File
@@ -14,11 +14,12 @@ module Gollum
# Get the formatted page for a given page name.
#
# name - The human or canonical String page name of the wiki page.
# name - The human or canonical String page name of the wiki page.
# version - The String version ID to find (default: "master").
#
# Returns a Gollum::Page or nil if no matching page was found.
def page(name)
Page.new(self).find(name)
def page(name, version = 'master')
Page.new(self).find(name, version)
end
end
end