Skip to content

Commit

Permalink
ImportCommand: don't destructure ChildProcessUtilities import
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Stockman committed Mar 14, 2017
1 parent 4ecff4b commit b252fa1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/commands/ImportCommand.js
Expand Up @@ -3,7 +3,7 @@ import async from "async";
import Command from "../Command";
import progressBar from "../progressBar";
import PromptUtilities from "../PromptUtilities";
import {execSync, exec} from "../ChildProcessUtilities";
import ChildProcessUtilities from "../ChildProcessUtilities";
import FileSystemUtilities from "../FileSystemUtilities";

export default class ImportCommand extends Command {
Expand Down Expand Up @@ -55,9 +55,9 @@ export default class ImportCommand extends Command {
}

// Stash the repo's pre-import head away in case something goes wrong.
this.preImportHead = execSync("git log --format=\"%h\" -1").split("\n")[0];
this.preImportHead = ChildProcessUtilities.execSync("git log --format=\"%h\" -1").split("\n")[0];

if (execSync("git diff " + this.preImportHead)) {
if (ChildProcessUtilities.execSync("git diff " + this.preImportHead)) {
return callback(new Error("Local repository has un-committed changes"));
}

Expand All @@ -78,7 +78,7 @@ export default class ImportCommand extends Command {
}

externalExecSync(command) {
return execSync(command, this.externalExecOpts).trim();
return ChildProcessUtilities.execSync(command, this.externalExecOpts).trim();
}

execute(callback) {
Expand All @@ -103,16 +103,16 @@ export default class ImportCommand extends Command {
//
// Fall back to three-way merge, which can help with duplicate commits
// due to merge history.
exec("git am -3", {}, (err) => {
ChildProcessUtilities.exec("git am -3", {}, (err) => {
if (err) {

// Give some context for the error message.
err = `Failed to apply commit ${sha}.\n${err}\n` +
`Rolling back to previous HEAD (commit ${this.preImportHead}).`;

// Abort the failed `git am` and roll back to previous HEAD.
execSync("git am --abort");
execSync("git reset --hard " + this.preImportHead);
ChildProcessUtilities.execSync("git am --abort");
ChildProcessUtilities.execSync("git reset --hard " + this.preImportHead);
}
done(err);
}).stdin.end(patch);
Expand Down

0 comments on commit b252fa1

Please sign in to comment.