-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathp4_test.js
140 lines (124 loc) · 2.58 KB
/
p4_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
'use strict';
try
{
var argv = require('yargs').argv;
var args = argv._;
if (args.length !== 1) {
console.log('Usage: node p4_test <p4-local-path>');
process.exit(1);
return;
}
var repoPath = args[0]; // Example: c:\perforce\myrepo\somesubdir\...
var path = require('path');
var config = require('./p4_test_config')
var P4 = require('./p4j');
var p4 = new P4(config);
console.log('Getting latest of ' + repoPath);
p4.info()
.then(function (info) {
console.dir(info);
})
.catch(function (err) {
console.log('Error:');
console.log(err.stack);
})
.done(function () {
console.log("done");
});
p4.getLatest(repoPath, { force: true })
.then(function () {
console.log('Got latest of ' + repoPath);
})
.catch(function (err) {
console.log('Error:');
console.log(err.stack);
})
.done(function () {
console.log('done');
});
/*
p4.deleteEmptyChangeSets(repoPath)
.then(function () {
return p4.createChangeSet("Build Test");
})
.then(function (changeSetId) {
return p4.checkOut(changeSetId, )
.then(function () {
return p4.submit(changeSetId);
});
})
.catch(function (err) {
console.log('Error:');
console.log(err.stack);
})
.done(function () {
console.log('done');
});
p4.deleteEmptyChangeSets()
.catch(function (err) {
console.log('Error:');
console.log(err);
})
.done(function () {
console.log('done');
});
p4.getPendingChangeSets()
.then(function (changeSets) {
console.log(changeSets);
});
p4.findChangeSet('Build Test')
.then(function (changeSetId) {
return p4.revertAll(changeSetId, repoPath);
})
.catch(function (err) {
console.log('Error:');
console.log(err);
})
.done(function () {
console.log('done');
});
p4.createChangeSet('Build Test')
.then(function (changeSetId) {
return p4.checkOut(changeSetId, repoPath);
})
.catch(function (err) {
console.log('Error:');
console.log(err);
})
.done(function () {
console.log('done');
});
p4.createChangeSet('ding ding')
.then(function (output) {
console.log('then');
console.log(output);
return output;
})
.catch(function (err) {
console.log('Error:');
console.log(err);
})
.done(function () {
console.log('done');
});
p4.findChangeSet('Build')
.then(function (output) {
console.log('then');
console.log(output);
return output;
})
.catch(function (err) {
console.log('Error:');
console.log(err);
console.log(err.stack);
})
.done(function () {
console.log('done');
});
*/
}
catch (e)
{
console.log('Exception')
console.log(e.stack);
}