Skip to content

Commit bed7cd8

Browse files
pftgclaude
andcommitted
refactor: inline restore_git_revision into checkout_vcs
Single method, no delegation. The SVN branch is gone so checkout_vcs no longer needs to dispatch. Updated 3 callers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9294bd5 commit bed7cd8

3 files changed

Lines changed: 4 additions & 8 deletions

File tree

lib/capybara/screenshot/diff/vcs.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@ module Capybara
66
module Screenshot
77
module Diff
88
module Vcs
9-
def self.checkout_vcs(root, screenshot_path, checkout_path)
10-
restore_git_revision(screenshot_path, checkout_path, root: root)
11-
end
12-
139
SILENCE_ERRORS = Os::ON_WINDOWS ? "2>nul" : "2>/dev/null"
1410

15-
def self.restore_git_revision(screenshot_path, checkout_path = screenshot_path, root:)
11+
def self.checkout_vcs(root, screenshot_path, checkout_path)
1612
vcs_file_path = screenshot_path.relative_path_from(root)
1713
redirect_target = "#{checkout_path} #{SILENCE_ERRORS}"
1814
show_command = "git show HEAD~0:./#{vcs_file_path}"

test/system_test_case.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def rollback_comparison_runtime_files(screenshot_assert)
6565
save_annotations_for_debug(comparison)
6666

6767
screenshot_path = comparison.image_path
68-
Vcs.restore_git_revision(screenshot_path, root: Capybara::Screenshot.root)
68+
Vcs.checkout_vcs(Capybara::Screenshot.root, screenshot_path, screenshot_path)
6969

7070
if comparison.difference
7171
comparison.reporter.clean_tmp_files

test/unit/vcs_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ class VcsTest < ActiveSupport::TestCase
1919
end
2020
end
2121

22-
test "#restore_git_revision checks out and verifies the original screenshot" do
22+
test "#checkout_vcs checks out and verifies the original screenshot" do
2323
screenshot_path = file_fixture("images/a.png")
2424

2525
base_screenshot_path = Pathname.new(@base_screenshot.path)
26-
assert Vcs.restore_git_revision(screenshot_path, base_screenshot_path, root: Screenshot.root)
26+
assert Vcs.checkout_vcs(Screenshot.root, screenshot_path, base_screenshot_path)
2727

2828
assert base_screenshot_path.exist?
2929
assert_equal screenshot_path.size, base_screenshot_path.size

0 commit comments

Comments
 (0)