mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 16:22:42 +01:00
Tighten up "arc land"
Summary: Make sure on failure (restoreBranch()) we call `git submodule update --init --recursive` to handle all those purdy submodules. For the pushing step, wrap the push commands in the try / catch block so everything gets cleaned up nice if there's failure. BONUS - add --recursive to arc patch workflow to so nested submodules work correctly. (Crazy git users) Fixes T3407, T2945. Test Plan: I wasn't sure how to simulate a good "push" failure but I think this should work. Reviewers: epriestley Reviewed By: epriestley CC: Korvin, aran Maniphest Tasks: T2945, T3407 Differential Revision: https://secure.phabricator.com/D6885
This commit is contained in:
parent
db3581b8fa
commit
67061480f9
2 changed files with 21 additions and 17 deletions
|
@ -858,23 +858,23 @@ EOTEXT
|
|||
private function push() {
|
||||
$repository_api = $this->getRepositoryAPI();
|
||||
|
||||
if ($this->isGit) {
|
||||
$repository_api->execxLocal(
|
||||
'commit -F %s',
|
||||
$this->messageFile);
|
||||
} else if ($this->isHg) {
|
||||
// hg rebase produces a commit earlier as part of rebase
|
||||
if (!$this->useSquash) {
|
||||
$repository_api->execxLocal(
|
||||
'commit --logfile %s',
|
||||
$this->messageFile);
|
||||
}
|
||||
}
|
||||
|
||||
// We dispatch this event so we can run checks on the merged revision, right
|
||||
// before it gets pushed out. It's easier to do this in arc land than to
|
||||
// try to hook into git/hg.
|
||||
// these commands can fail legitimately (e.g. commit hooks)
|
||||
try {
|
||||
if ($this->isGit) {
|
||||
$repository_api->execxLocal(
|
||||
'commit -F %s',
|
||||
$this->messageFile);
|
||||
} else if ($this->isHg) {
|
||||
// hg rebase produces a commit earlier as part of rebase
|
||||
if (!$this->useSquash) {
|
||||
$repository_api->execxLocal(
|
||||
'commit --logfile %s',
|
||||
$this->messageFile);
|
||||
}
|
||||
}
|
||||
// We dispatch this event so we can run checks on the merged revision,
|
||||
// right before it gets pushed out. It's easier to do this in arc land
|
||||
// than to try to hook into git/hg.
|
||||
$this->dispatchEvent(
|
||||
ArcanistEventType::TYPE_LAND_WILLPUSHREVISION,
|
||||
array());
|
||||
|
@ -1064,6 +1064,10 @@ EOTEXT
|
|||
$repository_api->execxLocal(
|
||||
'checkout %s',
|
||||
$this->oldBranch);
|
||||
if ($this->isGit) {
|
||||
$repository_api->execxLocal(
|
||||
'submodule update --init --recursive');
|
||||
}
|
||||
echo phutil_console_format(
|
||||
"Switched back to {$this->branchType} **%s**.\n",
|
||||
$this->oldBranch);
|
||||
|
|
|
@ -694,7 +694,7 @@ EOTEXT
|
|||
|
||||
// in case there were any submodule changes involved
|
||||
$repository_api->execpassthru(
|
||||
'submodule update --init');
|
||||
'submodule update --init --recursive');
|
||||
|
||||
if ($this->shouldCommit()) {
|
||||
if ($bundle->getFullAuthor()) {
|
||||
|
|
Loading…
Reference in a new issue