1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-21 21:10:56 +01:00

PhabricatorRepository: temporarily change the localPath

Summary:
I'm on a host where I have the PhabricatorRepositoryPullLocalDaemons
tracking a remote repo.  In my case, these end up as local git repos in
/var/repo/$name.

I'm working on another daemon that is going to automatically make
changes and commit them back upstream.  I figured it would be best to do
this in a new local repo.  I'll put these in /var/repo-clones/$name.

It's nice to use the exec*() functions in PhabricatorRepository, so the
approach I thought of was to load the PhabricatorRepository object from
the database, then change its localPath to point at the
/var/repo-clones/$name directory instead.

I didn't really want to change the local-path detail with setDetail(),
as that risks committing the change upstream.  It's nice to use the
repo's execLocalCommand() methods though, hence wanting to change the
local path.

Test Plan: None yet.

Reviewers: epriestley

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1821
This commit is contained in:
Edward Speyer 2012-03-07 19:48:25 -08:00
parent 89dac1cf19
commit 579941b866

View file

@ -33,6 +33,7 @@ class PhabricatorRepository extends PhabricatorRepositoryDAO {
protected $details = array();
private $sshKeyfile;
private $actualLocalPath;
public function getConfiguration() {
return array(
@ -117,7 +118,15 @@ class PhabricatorRepository extends PhabricatorRepositoryDAO {
}
public function getLocalPath() {
return $this->getDetail('local-path');
if (!$this->actualLocalPath) {
$this->actualLocalPath = $this->getDetail('local-path');
}
return $this->actualLocalPath;
}
// Lets you move the local-path for this instance
public function setLocalPath($path) {
$this->actualLocalPath = $path;
}
public function execRemoteCommand($pattern /*, $arg, ... */) {