]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Provide api to get committed data in a hook
authorNick Harper <nharper@fb.com>
Fri, 25 May 2012 22:28:45 +0000 (15:28 -0700)
committerNick Harper <nharper@fb.com>
Fri, 25 May 2012 22:28:45 +0000 (15:28 -0700)
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
src/repository/hookapi/subversion/ArcanistSubversionHookAPI.php

index e79e5e0cfe48ed6e8ae406dc04da12626663f3e5..3696dc6697fa97902853f6346c8eecc148649847 100644 (file)
@@ -21,4 +21,5 @@
  */
 abstract class ArcanistHookAPI {
   abstract public function getCurrentFileData($path);
+  abstract public function getUpstreamFileData($path);
 }
index ca0255c42dcaf4d8b807c33cae7e72550f4f3793..da5d337faa761ea91c867c411f10409888ac1b46 100644 (file)
@@ -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);
+  }
 }