@@ -14,7 +14,9 @@ async function getSourceInfo(source, pythonPath) {
14
14
let sourceURL = null ;
15
15
16
16
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
+ ) ;
18
20
}
19
21
20
22
if ( source . constructor === Object ) sourceURL = source . url ;
@@ -29,7 +31,11 @@ async function getSourceInfo(source, pythonPath) {
29
31
30
32
await cloneSingle ( source , { path : sourceRepoPath , url : sourceURL } , pythonPath ) ;
31
33
} 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 ;
33
39
34
40
sourceRepoPath = source ;
35
41
sourceRepoName = Path . basename ( source ) ;
@@ -43,22 +49,27 @@ async function cloneSingle(from, to, pythonPath) {
43
49
let url ;
44
50
45
51
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
+ ) ;
51
60
52
61
url = Utils . buildRepoURL ( from ) ;
53
62
} else {
54
- repo = new HgRepo ( to || {
55
- url : from ,
56
- } , pythonPath ) ;
63
+ repo = new HgRepo (
64
+ to || {
65
+ url : from ,
66
+ } ,
67
+ pythonPath ,
68
+ ) ;
57
69
url = from ;
58
70
}
59
71
60
72
await Utils . ensureRepoPath ( repo . path ) ;
61
-
62
73
await Command . run ( 'hg clone' , repo . path , [ url , repo . path ] ) ;
63
74
64
75
return repo ;
@@ -69,10 +80,9 @@ async function cloneMultipleAndMerge(from, to, pythonPath) {
69
80
const combinedRepo = new HgRepo ( to , pythonPath ) ;
70
81
71
82
await Utils . ensureRepoPath ( combinedRepo . path ) ;
72
-
73
83
await combinedRepo . init ( ) ;
74
84
75
- await Promise . each ( from , async ( repo ) => {
85
+ await Promise . each ( from , async repo => {
76
86
const [ repoName , repoPath ] = await getSourceInfo ( repo , pythonPath ) ;
77
87
let repoDir = repoName ;
78
88
@@ -83,7 +93,11 @@ async function cloneMultipleAndMerge(from, to, pythonPath) {
83
93
await combinedRepo . pull ( { source : repoPath , force : true } ) ;
84
94
await combinedRepo . update ( { clean : true , revision : 'default' } ) ;
85
95
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
+ } ) ;
87
101
const subDirectory = Path . join ( combinedRepo . path , repoDir ) ;
88
102
89
103
await Utils . moveFiles ( combinedRepo . path , subDirectory , files ) ;
@@ -106,8 +120,10 @@ async function cloneMultipleAndMerge(from, to, pythonPath) {
106
120
try {
107
121
await combinedRepo . commit ( `Merging ${ repoName } into combined` ) ;
108
122
} 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
+ ) {
111
127
throw error ;
112
128
}
113
129
}
@@ -117,7 +133,7 @@ async function cloneMultipleAndMerge(from, to, pythonPath) {
117
133
}
118
134
119
135
class Hg {
120
- constructor ( { path = 'python' } = { path : 'python' } ) {
136
+ constructor ( { path = 'python' } = { } ) {
121
137
this . pythonPath = path ;
122
138
}
123
139
0 commit comments