Changeset View
Changeset View
Standalone View
Standalone View
src/repository/state/ArcanistMercurialLocalState.php
Show First 20 Lines • Show All 154 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); | ||||
} | } | ||||
} | } |