Track a page's versions across renames

This commit is contained in:
rick
2010-08-04 15:57:08 -07:00
parent 207b0ccddd
commit 1e96ce6e1e
13 changed files with 33 additions and 4 deletions
+11 -1
View File
@@ -150,10 +150,20 @@ module Gollum
# options - The options Hash:
# :page - The Integer page number (default: 1).
# :per_page - The Integer max count of items to return.
# :follow - Follow's a file across renames, but falls back
# to a slower Grit native call. (default: true)
#
# Returns an Array of Grit::Commit.
def versions(options = {})
@wiki.repo.log('master', @path, log_pagination_options(options))
options[:follow] = true if !options.key?(:follow)
options = log_pagination_options(options)
if options[:follow]
options[:pretty] = 'raw'
log = @wiki.repo.git.native "log", options, "master", "--", @path
Grit::Commit.list_from_string(@wiki.repo, log)
else
@wiki.repo.log('master', @path, options)
end
end
# Public: The footer Page.
@@ -0,0 +1,4 @@
’AÔ0 …9çWXÚÀ4Û‘8ìã ‹àÀ0ˆCU­ÜÖm­¦qåd¶šÓÙ‚ö†ÔKûù{/­½ÔðððþÍÙ×Gì{ѹWGài ˜Uö8&ÎV*Ë/Rלª
0´€>
L8R„އóL¨«pXG¾‰¶y<+ž8ôqi­2‰‰/äýýd ¹\–_ 8åÏÅL¡ªv: ãå”eŠU=&ÑëFwc3Lµž—f'ƒ:¥$¾…Ne2Ü–»Ž”B‚™4ÎÔ$~¦ ±>8'ÒUõÇ…n|RªE­Åý
[,µpFO±pîÑÜÞh5 *®zXœöYx¸ ů+6Yù;·­§{‹.Yƒ’Û)YßuÉŒ޴ÄÞe%ϳ­Õ.žÅ_&Ú8ÑQdÌç߆=¡6ÃÞýÍ!ã%
@@ -0,0 +1,3 @@
+1 -1
View File
@@ -1 +1 @@
0ed8cbe0a25235bd867e65193c7d837c66b328ef
60f12f4254f58801b9ee7db7bca5fa8aeefaa56b
+13 -1
View File
@@ -36,6 +36,18 @@ context "Page" do
page.versions.map { |v| v.id }
end
test "page versions across renames" do
page = @wiki.page 'My-Precious'
assert_equal ['60f12f4254f58801b9ee7db7bca5fa8aeefaa56b', '94523d7ae48aeba575099dd12926420d8fd0425d'],
page.versions.map { |v| v.id }
end
test "page versions without renames" do
page = @wiki.page 'My-Precious'
assert_equal ['60f12f4254f58801b9ee7db7bca5fa8aeefaa56b'],
page.versions(:follow => false).map { |v| v.id }
end
test "specific page version" do
page = @wiki.page('Bilbo Baggins', 'fbabba862dfa7ac35b39042dd4ad780c9f67b8cb')
assert_equal 'fbabba862dfa7ac35b39042dd4ad780c9f67b8cb', page.version.id
@@ -67,7 +79,7 @@ context "Page" do
end
test "title from filename with html contents" do
page = @wiki.page('My <b>Precious')
page = @wiki.page('My <b>Precious', '0ed8cbe0a25235bd867e65193c7d837c66b328ef')
assert_equal 'My Precious', page.title
end
+1 -1
View File
@@ -35,7 +35,7 @@ context "Wiki" do
test "list pages" do
pages = @wiki.pages
assert_equal \
%w(Bilbo-Baggins.md Eye-Of-Sauron.md Home.textile My-<b>Precious.md),
%w(Bilbo-Baggins.md Eye-Of-Sauron.md Home.textile My-Precious.md),
pages.map { |p| p.filename }.sort
end
end