77#include " p4_api.h"
88
99#include < csignal>
10+ #include < memory>
1011
1112#include " commands/stream_result.h"
1213#include " utils/std_helpers.h"
@@ -166,32 +167,32 @@ void P4API::UpdateClientSpec()
166167 Run<Result>(" client" , {});
167168}
168169
169- ClientResult P4API::Client ()
170+ std::unique_ptr< ClientResult> P4API::Client ()
170171{
171172 return Run<ClientResult>(" client" , { " -o" });
172173}
173174
174- StreamResult P4API::Stream (const std::string& path)
175+ std::unique_ptr< StreamResult> P4API::Stream (const std::string& path)
175176{
176177 return Run<StreamResult>(" stream" , { " -o" , path });
177178}
178179
179- TestResult P4API::TestConnection (const int retries)
180+ std::unique_ptr< TestResult> P4API::TestConnection (const int retries)
180181{
181182 return RunEx<TestResult>(" changes" , { " -m" , " 1" , " //..." }, retries);
182183}
183184
184- ChangesResult P4API::ShortChanges (const std::string& path)
185+ std::unique_ptr< ChangesResult> P4API::ShortChanges (const std::string& path)
185186{
186- ChangesResult changes = Run<ChangesResult>(" changes" , {
187+ std::unique_ptr< ChangesResult> changes = Run<ChangesResult>(" changes" , {
187188 " -s" , " submitted" , // Only include submitted CLs
188189 path // Depot path to get CLs from
189190 });
190- changes. reverse ();
191+ changes-> reverse ();
191192 return changes;
192193}
193194
194- ChangesResult P4API::Changes (const std::string& path)
195+ std::unique_ptr< ChangesResult> P4API::Changes (const std::string& path)
195196{
196197 MTR_SCOPE (" P4" , __func__);
197198 return Run<ChangesResult>(" changes" , {
@@ -201,7 +202,7 @@ ChangesResult P4API::Changes(const std::string& path)
201202 });
202203}
203204
204- ChangesResult P4API::Changes (const std::string& path, const std::string& from, int32_t maxCount)
205+ std::unique_ptr< ChangesResult> P4API::Changes (const std::string& path, const std::string& from, int32_t maxCount)
205206{
206207 std::vector<std::string> args = {
207208 " -l" , // Get full descriptions instead of sending cut-short ones
@@ -231,12 +232,12 @@ ChangesResult P4API::Changes(const std::string& path, const std::string& from, i
231232
232233 args.push_back (path + pathAddition);
233234
234- ChangesResult result = Run<ChangesResult>(" changes" , args);
235- result. reverse ();
235+ std::unique_ptr< ChangesResult> result = Run<ChangesResult>(" changes" , args);
236+ result-> reverse ();
236237 return result;
237238}
238239
239- ChangesResult P4API::ChangesFromTo (const std::string& path, const std::string& from, const std::string& to)
240+ std::unique_ptr< ChangesResult> P4API::ChangesFromTo (const std::string& path, const std::string& from, const std::string& to)
240241{
241242 std::string pathArg = path + " @" + from + " ," + to;
242243 return Run<ChangesResult>(" changes" , {
@@ -245,7 +246,7 @@ ChangesResult P4API::ChangesFromTo(const std::string& path, const std::string& f
245246 });
246247}
247248
248- ChangesResult P4API::LatestChange (const std::string& path)
249+ std::unique_ptr< ChangesResult> P4API::LatestChange (const std::string& path)
249250{
250251 MTR_SCOPE (" P4" , __func__);
251252 return Run<ChangesResult>(" changes" , {
@@ -255,25 +256,25 @@ ChangesResult P4API::LatestChange(const std::string& path)
255256 });
256257}
257258
258- ChangesResult P4API::OldestChange (const std::string& path)
259+ std::unique_ptr< ChangesResult> P4API::OldestChange (const std::string& path)
259260{
260- ChangesResult changes = Run<ChangesResult>(" changes" , {
261+ std::unique_ptr< ChangesResult> changes = Run<ChangesResult>(" changes" , {
261262 " -s" , " submitted" , // Only include submitted CLs,
262263 " -m" , " 1" , // Get top-most change
263264 path // Depot path to get CLs from
264265 });
265- changes. reverse ();
266+ changes-> reverse ();
266267 return changes;
267268}
268269
269- DescribeResult P4API::Describe (const std::string& cl)
270+ std::unique_ptr< DescribeResult> P4API::Describe (const std::string& cl)
270271{
271272 MTR_SCOPE (" P4" , __func__);
272273 return Run<DescribeResult>(" describe" , { " -s" , // Omit the diffs
273274 cl });
274275}
275276
276- FileLogResult P4API::FileLog (const std::string& changelist)
277+ std::unique_ptr< FileLogResult> P4API::FileLog (const std::string& changelist)
277278{
278279 return Run<FileLogResult>(" filelog" , {
279280 " -c" , // restrict output to a single changelist
@@ -283,17 +284,17 @@ FileLogResult P4API::FileLog(const std::string& changelist)
283284 });
284285}
285286
286- SizesResult P4API::Size (const std::string& file)
287+ std::unique_ptr< SizesResult> P4API::Size (const std::string& file)
287288{
288289 return Run<SizesResult>(" sizes" , { " -a" , " -s" , file });
289290}
290291
291- Result P4API::Sync ()
292+ std::unique_ptr< Result> P4API::Sync ()
292293{
293294 return Run<Result>(" sync" , {});
294295}
295296
296- SyncResult P4API::GetFilesToSyncAtCL (const std::string& path, const std::string& cl)
297+ std::unique_ptr< SyncResult> P4API::GetFilesToSyncAtCL (const std::string& path, const std::string& cl)
297298{
298299 std::string clCommand = " @" + cl;
299300 return Run<SyncResult>(" sync" , {
@@ -302,40 +303,40 @@ SyncResult P4API::GetFilesToSyncAtCL(const std::string& path, const std::string&
302303 });
303304}
304305
305- PrintResult P4API::PrintFile (const std::string& filePathRevision)
306+ std::unique_ptr< PrintResult> P4API::PrintFile (const std::string& filePathRevision)
306307{
307308 return Run<PrintResult>(" print" , {
308309 filePathRevision,
309310 });
310311}
311312
312- PrintResult P4API::PrintFiles (const std::vector<std::string>& fileRevisions)
313+ std::unique_ptr< PrintResult> P4API::PrintFiles (const std::vector<std::string>& fileRevisions)
313314{
314315 MTR_SCOPE (" P4" , __func__);
315316
316317 if (fileRevisions.empty ())
317318 {
318- return PrintResult ( );
319+ return std::unique_ptr< PrintResult>( new PrintResult () );
319320 }
320321
321322 return Run<PrintResult>(" print" , fileRevisions);
322323}
323324
324- Result P4API::Sync (const std::string& path)
325+ std::unique_ptr< Result> P4API::Sync (const std::string& path)
325326{
326327 return Run<Result>(" sync" , {
327328 path // Sync a particular depot path
328329 });
329330}
330331
331- UsersResult P4API::Users ()
332+ std::unique_ptr< UsersResult> P4API::Users ()
332333{
333334 return Run<UsersResult>(" users" , {
334335 " -a" // Include service accounts
335336 });
336337}
337338
338- InfoResult P4API::Info ()
339+ std::unique_ptr< InfoResult> P4API::Info ()
339340{
340341 return Run<InfoResult>(" info" , {});
341342}
0 commit comments