From c51590dc1ec12ffeae94638670dbbcfb73988645 Mon Sep 17 00:00:00 2001 From: Nick Harper Date: Fri, 25 May 2012 15:28:45 -0700 Subject: [PATCH] Provide api to get committed data in a hook Summary: We have a linter that needs to read data from the repo that isn't in the commit, so that data isn't part of the svn transaction, thus not available in svnlook cat --transaction. This change provides a method to get data from a committed file. Test Plan: Successfully ran arc svn-hook-pre-commit with a linter that needs something not in the transaction. Reviewers: epriestley, jungejason, vrana Reviewed By: epriestley CC: aran, Koolvin Differential Revision: https://secure.phabricator.com/D2582 --- src/repository/hookapi/base/ArcanistHookAPI.php | 1 + .../hookapi/subversion/ArcanistSubversionHookAPI.php | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/repository/hookapi/base/ArcanistHookAPI.php b/src/repository/hookapi/base/ArcanistHookAPI.php index e79e5e0c..3696dc66 100644 --- a/src/repository/hookapi/base/ArcanistHookAPI.php +++ b/src/repository/hookapi/base/ArcanistHookAPI.php @@ -21,4 +21,5 @@ */ abstract class ArcanistHookAPI { abstract public function getCurrentFileData($path); + abstract public function getUpstreamFileData($path); } diff --git a/src/repository/hookapi/subversion/ArcanistSubversionHookAPI.php b/src/repository/hookapi/subversion/ArcanistSubversionHookAPI.php index ca0255c4..da5d337f 100644 --- a/src/repository/hookapi/subversion/ArcanistSubversionHookAPI.php +++ b/src/repository/hookapi/subversion/ArcanistSubversionHookAPI.php @@ -40,4 +40,12 @@ final class ArcanistSubversionHookAPI extends ArcanistHookAPI { return ($err? null : $file); } + + public function getUpstreamFileData($path) { + list($err, $file) = exec_manual( + 'svnlook cat %s %s', + $this->repository, + $this->root."/$path"); + return ($err ? null : $file); + } }