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 $localBranch; | private $localBranch; | ||||
private $localBookmark; | private $localBookmark; | ||||
public function getLocalCommit() { | |||||
return $this->localCommit; | |||||
} | |||||
public function getLocalBookmark() { | |||||
return $this->localBookmark; | |||||
} | |||||
protected function executeSaveLocalState() { | protected function executeSaveLocalState() { | ||||
$api = $this->getRepositoryAPI(); | $api = $this->getRepositoryAPI(); | ||||
$log = $this->getWorkflow()->getLogEngine(); | $log = $this->getWorkflow()->getLogEngine(); | ||||
$markers = $api->newMarkerRefQuery() | $markers = $api->newMarkerRefQuery() | ||||
->execute(); | ->execute(); | ||||
$local_commit = null; | $local_commit = null; | ||||
▲ Show 20 Lines • Show All 129 Lines • ▼ Show 20 Lines | final class ArcanistMercurialLocalState | ||||
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', | ||||
Filesystem::readRandomCharacters(12)); | Filesystem::readRandomCharacters(12)); | ||||
$api->execxLocal( | $api->execxLocalWithExtension( | ||||
'--config extensions.shelve= shelve --unknown --name %s --', | 'shelve', | ||||
'shelve --unknown --name %s --', | |||||
$stash_ref); | $stash_ref); | ||||
$log->writeStatus( | $log->writeStatus( | ||||
pht('SHELVE'), | pht('SHELVE'), | ||||
pht('Shelving uncommitted changes from working copy.')); | pht('Shelving uncommitted changes from working copy.')); | ||||
return $stash_ref; | return $stash_ref; | ||||
} | } | ||||
protected function restoreStash($stash_ref) { | protected function restoreStash($stash_ref) { | ||||
$api = $this->getRepositoryAPI(); | $api = $this->getRepositoryAPI(); | ||||
$log = $this->getWorkflow()->getLogEngine(); | $log = $this->getWorkflow()->getLogEngine(); | ||||
$log->writeStatus( | $log->writeStatus( | ||||
pht('UNSHELVE'), | pht('UNSHELVE'), | ||||
pht('Restoring uncommitted changes to working copy.')); | pht('Restoring uncommitted changes to working copy.')); | ||||
$api->execxLocal( | $api->execxLocalWithExtension( | ||||
'--config extensions.shelve= unshelve --keep --name %s --', | 'shelve', | ||||
'unshelve --keep --name %s --', | |||||
$stash_ref); | $stash_ref); | ||||
} | } | ||||
protected function discardStash($stash_ref) { | protected function discardStash($stash_ref) { | ||||
$api = $this->getRepositoryAPI(); | $api = $this->getRepositoryAPI(); | ||||
$api->execxLocal( | $api->execxLocalWithExtension( | ||||
'--config extensions.shelve= shelve --delete %s --', | 'shelve', | ||||
'shelve --delete %s --', | |||||
$stash_ref); | $stash_ref); | ||||
} | } | ||||
} | } |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0