Changeset View
Changeset View
Standalone View
Standalone View
src/repository/state/ArcanistMercurialLocalState.php
Show First 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | if ($this->localBookmark !== null) { | ||||
$commands[] = csprintf( | $commands[] = csprintf( | ||||
'hg bookmark --force -- %s', | 'hg bookmark --force -- %s', | ||||
$this->localBookmark); | $this->localBookmark); | ||||
} | } | ||||
return $commands; | return $commands; | ||||
} | } | ||||
protected function saveStash() { | public function saveStash() { | ||||
$api = $this->getRepositoryAPI(); | $api = $this->getRepositoryAPI(); | ||||
$log = $this->getWorkflow()->getLogEngine(); | $log = $this->getWorkflow()->getLogEngine(); | ||||
cspeckmim: The changes in this file are only here momentarily so I could test out the approach. I haven't… | |||||
$stash_ref = sprintf( | $stash_ref = sprintf( | ||||
'arc-%s', | 'arc-%s', | ||||
Filesystem::readRandomCharacters(12)); | Filesystem::readRandomCharacters(12)); | ||||
$api->execxLocal( | $api->execxLocal( | ||||
'--config extensions.shelve= shelve --unknown --name %s --', | '--config extensions.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) { | public 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->execxLocal( | ||||
Show All 13 Lines |
The changes in this file are only here momentarily so I could test out the approach. I haven't thought through what a well-designed solution might be. I didn't want to pass through the workflow into the amendCommit() function but that is one way that it can create the state and give it a valid workflow. As for the public/protected I'm not sure what a good solution is -- aside from making new functions in ArcanistRepositoryLocalState to directly expose these ones.