@lerna/git-utils
Advanced tools
Comparing version 3.0.0-beta.3 to 3.0.0-beta.9
@@ -6,2 +6,14 @@ # Change Log | ||
<a name="3.0.0-beta.9"></a> | ||
# [3.0.0-beta.9](https://github.com/lerna/lerna/compare/v3.0.0-beta.8...v3.0.0-beta.9) (2018-03-24) | ||
### Bug Fixes | ||
* **git-utils:** Remove unused methods, stop mocking tests ([3e00d7a](https://github.com/lerna/lerna/commit/3e00d7a)) | ||
<a name="3.0.0-beta.3"></a> | ||
@@ -8,0 +20,0 @@ # [3.0.0-beta.3](https://github.com/lerna/lerna/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2018-03-15) |
57
index.js
@@ -89,12 +89,2 @@ "use strict"; | ||
function getLastTaggedCommitInBranch(opts) { | ||
log.silly("getLastTaggedCommitInBranch"); | ||
const tagName = exports.getLastTag(opts); | ||
const commitInBranch = ChildProcessUtilities.execSync("git", ["rev-list", "-n", "1", tagName], opts); | ||
log.verbose("getLastTaggedCommitInBranch", commitInBranch); | ||
return commitInBranch; | ||
} | ||
function getFirstCommit(opts) { | ||
@@ -128,11 +118,2 @@ log.silly("getFirstCommit"); | ||
function describeTag(ref, opts) { | ||
log.silly("describeTag", ref); | ||
const description = ChildProcessUtilities.execSync("git", ["describe", "--tags", ref], opts); | ||
log.silly("describeTag", description); | ||
return description; | ||
} | ||
function diffSinceIn(committish, location, opts) { | ||
@@ -216,36 +197,22 @@ const args = ["diff", "--name-only", committish]; | ||
function fetchGitRemote(opts) { | ||
log.silly("fetchGitRemote"); | ||
ChildProcessUtilities.execSync("git", ["remote", "update"], opts); | ||
} | ||
function isBehindUpstream(gitRemote, opts) { | ||
log.silly("isBehindUpstream"); | ||
exports.fetchGitRemote(opts); | ||
const status = exports.aheadBehindCount(gitRemote, opts); | ||
const behind = status.behind >= 1; | ||
// git fetch, but for everything | ||
ChildProcessUtilities.execSync("git", ["remote", "update"], opts); | ||
log.verbose("isBehindUpstream", behind); | ||
return behind; | ||
} | ||
function aheadBehindCount(gitRemote, opts) { | ||
const branchName = exports.getCurrentBranch(opts); | ||
const branchComparator = `${gitRemote}/${branchName}...${branchName}`; | ||
const rawAheadBehind = ChildProcessUtilities.execSync( | ||
const branch = exports.getCurrentBranch(opts); | ||
const countLeftRight = ChildProcessUtilities.execSync( | ||
"git", | ||
["rev-list", "--left-right", "--count", branchComparator], | ||
["rev-list", "--left-right", "--count", `${gitRemote}/${branch}...${branch}`], | ||
opts | ||
); | ||
const [behind, ahead] = countLeftRight.split("\t").map(val => parseInt(val, 10)); | ||
const aheadBehind = rawAheadBehind.split("\t"); | ||
const behind = parseInt(aheadBehind[0], 10); | ||
const ahead = parseInt(aheadBehind[1], 10); | ||
log.silly( | ||
"aheadBehindCount", | ||
`behind ${gitRemote}/${branchName} by ${behind} commits; ${branchName} is ahead by ${ahead} commits` | ||
"isBehindUpstream", | ||
`${branch} is behind ${gitRemote}/${branch} by ${behind} commit(s) and ahead by ${ahead}` | ||
); | ||
return { ahead, behind }; | ||
return Boolean(behind); | ||
} | ||
@@ -260,7 +227,5 @@ | ||
exports.getLastTaggedCommit = getLastTaggedCommit; | ||
exports.getLastTaggedCommitInBranch = getLastTaggedCommitInBranch; | ||
exports.getFirstCommit = getFirstCommit; | ||
exports.pushWithTags = pushWithTags; | ||
exports.getLastTag = getLastTag; | ||
exports.describeTag = describeTag; | ||
exports.diffSinceIn = diffSinceIn; | ||
@@ -274,4 +239,2 @@ exports.getWorkspaceRoot = getWorkspaceRoot; | ||
exports.hasCommit = hasCommit; | ||
exports.fetchGitRemote = fetchGitRemote; | ||
exports.isBehindUpstream = isBehindUpstream; | ||
exports.aheadBehindCount = aheadBehindCount; |
{ | ||
"name": "@lerna/git-utils", | ||
"version": "3.0.0-beta.3", | ||
"version": "3.0.0-beta.9", | ||
"description": "TODO", | ||
@@ -38,3 +38,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "1ee15326adf778c32e4b136bbfb27e1c899716a1" | ||
"gitHead": "70528f23cad0186fdf7529fe32148cc1eff21272" | ||
} |
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
8033
180