@cplace/cli
Advanced tools
Comparing version 0.3.2 to 0.3.3
@@ -28,3 +28,10 @@ "use strict"; | ||
.then(() => repo.checkoutBranch(branch)) | ||
.then(() => repo.checkoutCommit(commit)) | ||
.then(() => { | ||
if (commit) { | ||
return repo.checkoutCommit(commit); | ||
} | ||
else { | ||
return repo.pullOnlyFastForward(); | ||
} | ||
}) | ||
.then(() => repo.resetHard()) | ||
@@ -31,0 +38,0 @@ .then(() => { |
@@ -18,4 +18,5 @@ /** | ||
checkoutCommit(commit: string): Promise<void>; | ||
pullOnlyFastForward(): Promise<void>; | ||
resetHard(): Promise<void>; | ||
getCurrentCommitHash(): Promise<string>; | ||
} |
@@ -120,2 +120,24 @@ "use strict"; | ||
} | ||
pullOnlyFastForward() { | ||
return this.status() | ||
.then(({ tracking }) => { | ||
const i = tracking.indexOf('/'); | ||
if (i < 0) { | ||
return Promise.reject(`cannot determine remote and branch for ${tracking}`); | ||
} | ||
const remote = tracking.substring(0, i); | ||
const branch = tracking.substr(i + 1); | ||
Global_1.Global.isVerbose() && console.log(`pulling branch ${branch} from remote ${remote}`); | ||
return new Promise((resolve, reject) => { | ||
this.git.pull(remote, branch, { '--ff-only': true }, (err) => { | ||
if (err) { | ||
reject(err); | ||
} | ||
else { | ||
resolve(); | ||
} | ||
}); | ||
}); | ||
}); | ||
} | ||
resetHard() { | ||
@@ -128,3 +150,3 @@ return new Promise((resolve, reject) => { | ||
else { | ||
Global_1.Global.isVerbose() && console.log(`repo ${this.repoName} has been resetted`); | ||
Global_1.Global.isVerbose() && console.log(`repo ${this.repoName} has been reset`); | ||
resolve(); | ||
@@ -131,0 +153,0 @@ } |
{ | ||
"name": "@cplace/cli", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
@@ -36,3 +36,9 @@ /** | ||
.then(() => repo.checkoutBranch(branch)) | ||
.then(() => repo.checkoutCommit(commit)) | ||
.then(() => { | ||
if (commit) { | ||
return repo.checkoutCommit(commit); | ||
} else { | ||
return repo.pullOnlyFastForward(); | ||
} | ||
}) | ||
.then(() => repo.resetHard()) | ||
@@ -39,0 +45,0 @@ .then(() => { |
@@ -130,2 +130,26 @@ /** | ||
public pullOnlyFastForward(): Promise<void> { | ||
return this.status() | ||
.then(({tracking}) => { | ||
const i = tracking.indexOf('/'); | ||
if (i < 0) { | ||
return Promise.reject(`cannot determine remote and branch for ${tracking}`); | ||
} | ||
const remote = tracking.substring(0, i); | ||
const branch = tracking.substr(i + 1); | ||
Global.isVerbose() && console.log(`pulling branch ${branch} from remote ${remote}`); | ||
return new Promise((resolve, reject) => { | ||
this.git.pull(remote, branch, {'--ff-only': true}, (err) => { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve(); | ||
} | ||
}); | ||
}); | ||
}); | ||
} | ||
public resetHard(): Promise<void> { | ||
@@ -137,3 +161,3 @@ return new Promise<void>((resolve, reject) => { | ||
} else { | ||
Global.isVerbose() && console.log(`repo ${this.repoName} has been resetted`); | ||
Global.isVerbose() && console.log(`repo ${this.repoName} has been reset`); | ||
resolve(); | ||
@@ -140,0 +164,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
115
2608
179646