Track a page's versions across renames
This commit is contained in:
+11
-1
@@ -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.
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
xœ�’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îÑÜÞh�5 *®z�XœöYx¸Å¯+6Yù;·§{‹.Yƒ’Û)YßuÉŒ޴ÄÞe%ϳÕ.žÅ_&Ú8ÑQdÌç߆=¡6ÃÞýÍ!ã%
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
�
|
||||
�
|
||||
�
|
||||
@@ -1 +1 @@
|
||||
0ed8cbe0a25235bd867e65193c7d837c66b328ef
|
||||
60f12f4254f58801b9ee7db7bca5fa8aeefaa56b
|
||||
+13
-1
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user