Skip to content

Commit a2fb9be

Browse files
committed
Merge branch 'updating'
2 parents ef64f30 + 3cebb92 commit a2fb9be

9 files changed

+167
-57
lines changed

.codeclimate.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
engines:
2+
eslint:
3+
enabled: true
4+
duplication:
5+
enabled: true
6+
config:
7+
languages:
8+
javascript:
9+
mass_threshold: 65
10+
shellcheck:
11+
enabled: true
12+
checks:
13+
method-count:
14+
enabled: false
15+
ratings:
16+
paths:
17+
- "**.js"

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ node_js:
44
- "7.6"
55
- "7"
66
- "8"
7+
- "9"
78
before_install:
89
- sudo apt-get update
910
- sudo apt-get install python2.7

LICENCE.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
The MIT License
2+
===============
3+
4+
Copyright (c)
5+
**2017 Justin Dalrymple**
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
of this software and associated documentation files (the "Software"), to deal
9+
in the Software without restriction, including without limitation the rights
10+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
copies of the Software, and to permit persons to whom the Software is
12+
furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in
15+
all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
THE SOFTWARE.

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
[![Coverage Status](https://coveralls.io/repos/github/jdalrymple/node-hg-plus/badge.svg?branch=master)](https://coveralls.io/github/jdalrymple/node-hg-plus?branch=master) [![Build Status](https://travis-ci.org/jdalrymple/node-hg-plus.svg?branch=master)](https://travis-ci.org/jdalrymple/node-hg-plus) [![Dependency Status](https://david-dm.org/jdalrymple/node-hg-plus/status.svg)](https://david-dm.org/jdalrymple/node-test#info=dependencies) [![devDependency Status](https://david-dm.org/jdalrymple/node-hg-plus/dev-status.svg)](https://david-dm.org/jdalrymple/node-test#info=devDependencies)
1+
[![Coverage Status](https://coveralls.io/repos/github/jdalrymple/node-hg-plus/badge.svg?branch=master)](https://coveralls.io/github/jdalrymple/node-hg-plus?branch=master) [![Build Status](https://travis-ci.org/jdalrymple/node-hg-plus.svg?branch=master)](https://travis-ci.org/jdalrymple/node-hg-plus) [![Dependency Status](https://david-dm.org/jdalrymple/node-hg-plus/status.svg)](https://david-dm.org/jdalrymple/node-test#info=dependencies) [![devDependency Status](https://david-dm.org/jdalrymple/node-hg-plus/dev-status.svg)](https://david-dm.org/jdalrymple/node-test#info=devDependencies)[![Code Climate](https://codeclimate.com/github/jdalrymple/node-hg-plus/badges/gpa.svg)](https://codeclimate.com/github/jdalrymple/node-hg-plus)[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
2+
23

34
# node-hg-plus
45

package.json

+12-14
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,24 @@
2020
"coverall": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
2121
},
2222
"devDependencies": {
23-
"babel-eslint": "^7.1.1",
24-
"babel-preset-latest": "^6.16.0",
25-
"coveralls": "^2.11.15",
26-
"eslint": "^4.3.0",
27-
"eslint-config-airbnb": "^15.1.0",
28-
"eslint-plugin-import": "^2.7.0",
29-
"eslint-plugin-jsx-a11y": "^5.1.1",
30-
"eslint-plugin-react": "^7.1.0",
31-
"nyc": "^11.0.3",
32-
"tape": "^4.6.3"
23+
"coveralls": "^3.0.0",
24+
"eslint": "^4.19.1",
25+
"eslint-config-airbnb": "^16.1.0",
26+
"eslint-plugin-import": "^2.11.0",
27+
"eslint-plugin-jsx-a11y": "^6.0.3",
28+
"eslint-plugin-react": "^7.7.0",
29+
"nyc": "^11.7.1",
30+
"tape": "^4.9.0"
3331
},
3432
"dependencies": {
3533
"blue-tape": "^1.0.0",
3634
"bluebird": "^3.5.1",
3735
"dir-compare": "^1.4.0",
38-
"fs-extra": "^4.0.2",
39-
"globby": "^6.1.0",
36+
"fs-extra": "^5.0.0",
37+
"globby": "^8.0.1",
4038
"is-there": "^4.4.3",
4139
"shortid": "^2.2.8",
42-
"tempy": "^0.1.0",
43-
"winston": "^2.4.0"
40+
"tempy": "^0.2.1",
41+
"winston": "^2.4.2"
4442
}
4543
}

src/Command.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use-strict';
2-
31
const Exec = require('child_process').exec;
42
const Promise = require('bluebird');
53
const Utils = require('./Utils');
@@ -21,7 +19,7 @@ function run(command, directory = process.cwd(), options = []) {
2119
});
2220
}
2321

24-
async function runWithHandling(command, directory = process.cwd(), options = [], done){
22+
async function runWithHandling(command, directory = process.cwd(), options = [], done) {
2523
try {
2624
const output = await run(command, directory, options);
2725

@@ -30,6 +28,7 @@ async function runWithHandling(command, directory = process.cwd(), options = [],
3028
return Utils.asCallback(output.error, output.stdout, done);
3129
}
3230
}
31+
3332
module.exports = {
3433
run,
3534
runWithHandling,

src/Hg.js

+33-17
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ async function getSourceInfo(source, pythonPath) {
1414
let sourceURL = null;
1515

1616
if (source.constructor !== String && source.constructor !== Object) {
17-
throw new TypeError('Incorrect type of from parameter. Clone source in the array is an invalid type. Must be an String or an Object');
17+
throw new TypeError(
18+
'Incorrect type of from parameter. Clone source in the array is an invalid type. Must be an String or an Object',
19+
);
1820
}
1921

2022
if (source.constructor === Object) sourceURL = source.url;
@@ -29,7 +31,11 @@ async function getSourceInfo(source, pythonPath) {
2931

3032
await cloneSingle(source, { path: sourceRepoPath, url: sourceURL }, pythonPath);
3133
} catch (error) {
32-
if (error.code !== 'ERR_INVALID_URL' && !(error.message && error.message.includes('Invalid URL'))) throw error;
34+
if (
35+
error.code !== 'ERR_INVALID_URL' &&
36+
!(error.message && error.message.includes('Invalid URL'))
37+
)
38+
throw error;
3339

3440
sourceRepoPath = source;
3541
sourceRepoName = Path.basename(source);
@@ -43,22 +49,27 @@ async function cloneSingle(from, to, pythonPath) {
4349
let url;
4450

4551
if (from.constructor === Object) {
46-
repo = new HgRepo(to || {
47-
url: from.url,
48-
password: from.password,
49-
username: from.username,
50-
}, pythonPath);
52+
repo = new HgRepo(
53+
to || {
54+
url: from.url,
55+
password: from.password,
56+
username: from.username,
57+
},
58+
pythonPath,
59+
);
5160

5261
url = Utils.buildRepoURL(from);
5362
} else {
54-
repo = new HgRepo(to || {
55-
url: from,
56-
}, pythonPath);
63+
repo = new HgRepo(
64+
to || {
65+
url: from,
66+
},
67+
pythonPath,
68+
);
5769
url = from;
5870
}
5971

6072
await Utils.ensureRepoPath(repo.path);
61-
6273
await Command.run('hg clone', repo.path, [url, repo.path]);
6374

6475
return repo;
@@ -69,10 +80,9 @@ async function cloneMultipleAndMerge(from, to, pythonPath) {
6980
const combinedRepo = new HgRepo(to, pythonPath);
7081

7182
await Utils.ensureRepoPath(combinedRepo.path);
72-
7383
await combinedRepo.init();
7484

75-
await Promise.each(from, async (repo) => {
85+
await Promise.each(from, async repo => {
7686
const [repoName, repoPath] = await getSourceInfo(repo, pythonPath);
7787
let repoDir = repoName;
7888

@@ -83,7 +93,11 @@ async function cloneMultipleAndMerge(from, to, pythonPath) {
8393
await combinedRepo.pull({ source: repoPath, force: true });
8494
await combinedRepo.update({ clean: true, revision: 'default' });
8595

86-
const files = await Globby(['*', '!.hg'], { dot: true, cwd: combinedRepo.path });
96+
const files = await Globby(['*', '!.hg'], {
97+
onlyFiles: false,
98+
dot: true,
99+
cwd: combinedRepo.path,
100+
});
87101
const subDirectory = Path.join(combinedRepo.path, repoDir);
88102

89103
await Utils.moveFiles(combinedRepo.path, subDirectory, files);
@@ -106,8 +120,10 @@ async function cloneMultipleAndMerge(from, to, pythonPath) {
106120
try {
107121
await combinedRepo.commit(`Merging ${repoName} into combined`);
108122
} catch (error) {
109-
if (!error.message.includes('nothing to merge') &&
110-
!error.message.includes('merging with a working directory ancestor')) {
123+
if (
124+
!error.message.includes('nothing to merge') &&
125+
!error.message.includes('merging with a working directory ancestor')
126+
) {
111127
throw error;
112128
}
113129
}
@@ -117,7 +133,7 @@ async function cloneMultipleAndMerge(from, to, pythonPath) {
117133
}
118134

119135
class Hg {
120-
constructor({ path = 'python' } = { path: 'python' }) {
136+
constructor({ path = 'python' } = {}) {
121137
this.pythonPath = path;
122138
}
123139

0 commit comments

Comments
 (0)