From a8c401cf0506abf76ff27f87ce9cb050ae415f85 Mon Sep 17 00:00:00 2001 From: Justin Dalrymple Date: Mon, 24 Jul 2017 13:51:39 -0400 Subject: [PATCH] Updating submodule path --- .gitmodules | 4 ++-- .travis.yml | 6 +++--- README.md | 2 +- src/Command.js | 5 +++-- src/Hg.js | 2 +- src/HgRepo.js | 4 ++-- src/Utils.js | 3 ++- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.gitmodules b/.gitmodules index fef2013f..e3399479 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "utils/gitifyhg"] - path = utils/gitifyhg +[submodule "libs/gitifyhg"] + path = libs/gitifyhg url = https://github.com/jdalrymple/gitifyhg.git diff --git a/.travis.yml b/.travis.yml index 7c5bddda..e71a17e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,9 @@ language: node_js node_js: - "node" - - "6" - - "6.0.0" - + - "7.6" + - "7" + - "8" before_install: - sudo apt-get update - sudo apt-get install python2.7 diff --git a/README.md b/README.md index 2fb7bb24..ef3b5156 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A node js client for [Mercurial](http://mercurial.selenic.com). -Supported node version => 6.0.0 +Supported node version => 7.6.0 ## Installation diff --git a/src/Command.js b/src/Command.js index 2248e435..1e11fceb 100644 --- a/src/Command.js +++ b/src/Command.js @@ -6,11 +6,12 @@ const Promise = require('bluebird'); function run(command, directory = process.cwd(), options = []) { return new Promise((resolve, reject) => { const commandString = `${command} ${options.join(' ')}`; - console.log(commandString); + Exec(commandString, { cwd: directory }, (error, stdout, stderr) => { const output = { error, stdout, stderr }; + if (error) { - reject(output); + reject(error); return; } diff --git a/src/Hg.js b/src/Hg.js index c55bffd3..6d6add22 100644 --- a/src/Hg.js +++ b/src/Hg.js @@ -118,7 +118,7 @@ class Hg { return Utils.asCallback(repo, done); } catch (e) { - if (e.error.message.includes('not found')) { + if (e.message.includes('not found')) { throw new TypeError('Incorrect type of from parameter. Clone source not found'); } else { throw e; diff --git a/src/HgRepo.js b/src/HgRepo.js index e3b35e51..829c1789 100644 --- a/src/HgRepo.js +++ b/src/HgRepo.js @@ -17,11 +17,11 @@ async function ensureGitify(pythonPath) { class HgRepo { constructor({ url, username = '', password = '', path } = {}, pythonPath = 'python') { - this.path = path || Utils.generateRepoName(url); + this.path = path || Utils.generateRepoPath(url); this.username = username; this.password = password; this.url = url; - this.name = Path.basename(path); + this.name = Path.basename(this.path); this.pythonPath = pythonPath; Fs.ensureDirSync(this.path); diff --git a/src/Utils.js b/src/Utils.js index dfd2daba..1207d391 100644 --- a/src/Utils.js +++ b/src/Utils.js @@ -1,4 +1,5 @@ const Path = require('path'); +const { URL } = require('url'); function asCallback(args, callback) { if (callback) { @@ -12,7 +13,7 @@ function buildRepoURL(urlObject) { if (urlObject.password && urlObject.username) { const parsedURL = new URL(urlObject.url); - return `${parsedURL.host}://${urlObject.username}:${urlObject.password}@${parsedURL.host}${parsedURL.pathname}`; + return `${parsedURL.protocol}//${urlObject.username}:${urlObject.password}@${parsedURL.host}${parsedURL.pathname}`; } return urlObject.url;