Changeset View
Changeset View
Standalone View
Standalone View
src/repository/state/ArcanistMercurialLocalState.php
| <?php | <?php | ||||
| final class ArcanistMercurialLocalState | final class ArcanistMercurialLocalState | ||||
| extends ArcanistRepositoryLocalState { | extends ArcanistRepositoryLocalState { | ||||
| private $localCommit; | private $localCommit; | ||||
| private $localRef; | private $localBranch; | ||||
| public function getLocalRef() { | |||||
| return $this->localRef; | |||||
| } | |||||
| public function getLocalPath() { | |||||
| return $this->localPath; | |||||
| } | |||||
| protected function executeSaveLocalState() { | protected function executeSaveLocalState() { | ||||
| $api = $this->getRepositoryAPI(); | $api = $this->getRepositoryAPI(); | ||||
| $log = $this->getWorkflow()->getLogEngine(); | |||||
| // TODO: Both of these can be pulled from "hg arc-ls-markers" more | |||||
Lint: TODO Comment: This comment has a TODO. | |||||
| // efficiently. | |||||
| $this->localCommit = $api->getCanonicalRevisionName('.'); | |||||
| // TODO: We need to save the position of "." and the current active | list($branch) = $api->execxLocal('branch'); | ||||
| // branch, which may be any symbol at all. Both of these can be pulled | $this->localBranch = trim($branch); | ||||
| // from "hg arc-ls-markers". | |||||
| $log->writeTrace( | |||||
| pht('SAVE STATE'), | |||||
| pht( | |||||
| 'Saving local state (at "%s" on branch "%s").', | |||||
| $this->getDisplayHash($this->localCommit), | |||||
| $this->localBranch)); | |||||
| } | } | ||||
| protected function executeRestoreLocalState() { | protected function executeRestoreLocalState() { | ||||
| $api = $this->getRepositoryAPI(); | $api = $this->getRepositoryAPI(); | ||||
| $log = $this->getWorkflow()->getLogEngine(); | |||||
| // TODO: In Mercurial, we may want to discard commits we've created. | $log->writeStatus( | ||||
| // $repository_api->execxLocal( | pht('LOAD STATE'), | ||||
| // '--config extensions.mq= strip %s', | pht( | ||||
| // $this->onto); | 'Restoring local state (at "%s" on branch "%s").', | ||||
| $this->getDisplayHash($this->localCommit), | |||||
| $this->localBranch)); | |||||
| $api->execxLocal('update -- %s', $this->localCommit); | |||||
| $api->execxLocal('branch --force -- %s', $this->localBranch); | |||||
| } | } | ||||
| protected function executeDiscardLocalState() { | protected function executeDiscardLocalState() { | ||||
| // TODO: Fix this. | return; | ||||
| } | } | ||||
| protected function canStashChanges() { | protected function canStashChanges() { | ||||
| $api = $this->getRepositoryAPI(); | $api = $this->getRepositoryAPI(); | ||||
| return $api->getMercurialFeature('shelve'); | return $api->getMercurialFeature('shelve'); | ||||
| } | } | ||||
| protected function getIgnoreHints() { | protected function getIgnoreHints() { | ||||
| return array( | return array( | ||||
| pht( | pht( | ||||
| 'To configure Mercurial to ignore certain files in the working '. | 'To configure Mercurial to ignore certain files in the working '. | ||||
| 'copy, add them to ".hgignore".'), | 'copy, add them to ".hgignore".'), | ||||
| ); | ); | ||||
| } | } | ||||
| protected function newRestoreCommandsForDisplay() { | protected function newRestoreCommandsForDisplay() { | ||||
| // TODO: Provide this. | $commands = array(); | ||||
| return array(); | |||||
| $commands[] = csprintf( | |||||
| 'hg update -- %s', | |||||
| $this->getDisplayHash($this->localCommit)); | |||||
| $commands[] = csprintf( | |||||
| 'hg branch --force -- %s', | |||||
| $this->localBranch); | |||||
| return $commands; | |||||
| } | } | ||||
| protected function saveStash() { | protected function saveStash() { | ||||
| $api = $this->getRepositoryAPI(); | $api = $this->getRepositoryAPI(); | ||||
| $log = $this->getWorkflow()->getLogEngine(); | $log = $this->getWorkflow()->getLogEngine(); | ||||
| $stash_ref = sprintf( | $stash_ref = sprintf( | ||||
| 'arc-%s', | 'arc-%s', | ||||
| Show All 35 Lines | |||||
This comment has a TODO.