Page MenuHomePhabricator

D8107.id.diff
No OneTemporary

D8107.id.diff

Index: src/applications/repository/engine/PhabricatorRepositoryMirrorEngine.php
===================================================================
--- src/applications/repository/engine/PhabricatorRepositoryMirrorEngine.php
+++ src/applications/repository/engine/PhabricatorRepositoryMirrorEngine.php
@@ -55,9 +55,17 @@
$this->log(pht('Pushing to remote "%s"...', $mirror->getRemoteURI()));
- if (!$proxy->isGit()) {
+ if ($proxy->isGit()) {
+ $this->pushToGitRepository($proxy);
+ } else if ($proxy->isHg()) {
+ $this->pushToHgRepository($proxy);
+ } else {
throw new Exception(pht('Unsupported VCS!'));
}
+ }
+
+ private function pushToGitRepository(
+ PhabricatorRepository $proxy) {
$future = $proxy->getRemoteCommandFuture(
'push --verbose --mirror -- %P',
@@ -68,4 +76,24 @@
->resolvex();
}
+ private function pushToHgRepository(
+ PhabricatorRepository $proxy) {
+
+ $future = $proxy->getRemoteCommandFuture(
+ 'push --verbose --rev tip -- %P',
+ $proxy->getRemoteURIEnvelope());
+
+ try {
+ $future
+ ->setCWD($proxy->getLocalPath())
+ ->resolvex();
+ } catch (CommandException $ex) {
+ if (preg_match('/no changes found/', $ex->getStdOut())) {
+ // mercurial says nothing changed, but that's good
+ } else {
+ throw $ex;
+ }
+ }
+ }
+
}
Index: src/applications/repository/storage/PhabricatorRepository.php
===================================================================
--- src/applications/repository/storage/PhabricatorRepository.php
+++ src/applications/repository/storage/PhabricatorRepository.php
@@ -1038,7 +1038,7 @@
}
public function canMirror() {
- if ($this->isGit()) {
+ if ($this->isGit() || $this->isHg()) {
return true;
}

File Metadata

Mime Type
text/plain
Expires
May 15 2024, 12:08 PM (5 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6296331
Default Alt Text
D8107.id.diff (1 KB)

Event Timeline