@@ -185,28 +185,29 @@ std::unique_ptr<TestResult> P4API::TestConnection(const int retries)
185185std::unique_ptr<ChangesResult> P4API::ShortChanges (const std::string& path)
186186{
187187 std::unique_ptr<ChangesResult> changes = Run<ChangesResult>(" changes" , {
188- " -s " , " submitted " , // Only include submitted CLs
189- path // Depot path to get CLs from
190- });
191- changes-> reverse ( );
188+ " -r " , // Get CLs from earliest to latest
189+ " -s " , " submitted " , // Only include submitted CLs
190+ path // Depot path to get CLs from
191+ } );
192192 return changes;
193193}
194194
195195std::unique_ptr<ChangesResult> P4API::Changes (const std::string& path)
196196{
197197 MTR_SCOPE (" P4" , __func__);
198198 return Run<ChangesResult>(" changes" , {
199- " -l" , // Get full descriptions instead of sending cut-short ones
200- " -s" , " submitted" , // Only include submitted CLs
201- path // Depot path to get CLs from
202- });
199+ " -l" , // Get full descriptions instead of sending cut-short ones
200+ " -s" , " submitted" , // Only include submitted CLs
201+ path // Depot path to get CLs from
202+ });
203203}
204204
205205std::unique_ptr<ChangesResult> P4API::Changes (const std::string& path, const std::string& from, int32_t maxCount)
206206{
207207 std::vector<std::string> args = {
208208 " -l" , // Get full descriptions instead of sending cut-short ones
209209 " -s" , " submitted" , // Only include submitted CLs
210+ " -r" // Send CLs in chronological order
210211 };
211212
212213 // This needs to be declared outside the if scope below to
@@ -233,55 +234,54 @@ std::unique_ptr<ChangesResult> P4API::Changes(const std::string& path, const std
233234 args.push_back (path + pathAddition);
234235
235236 std::unique_ptr<ChangesResult> result = Run<ChangesResult>(" changes" , args);
236- result->reverse ();
237237 return result;
238238}
239239
240240std::unique_ptr<ChangesResult> P4API::ChangesFromTo (const std::string& path, const std::string& from, const std::string& to)
241241{
242242 std::string pathArg = path + " @" + from + " ," + to;
243243 return Run<ChangesResult>(" changes" , {
244- " -s" , " submitted" , // Only include submitted CLs
245- pathArg // Depot path to get CLs from
246- });
244+ " -s" , " submitted" , // Only include submitted CLs
245+ pathArg // Depot path to get CLs from
246+ });
247247}
248248
249249std::unique_ptr<ChangesResult> P4API::LatestChange (const std::string& path)
250250{
251251 MTR_SCOPE (" P4" , __func__);
252252 return Run<ChangesResult>(" changes" , {
253- " -s" , " submitted" , // Only include submitted CLs,
254- " -m" , " 1" , // Get top-most change
255- path // Depot path to get CLs from
256- });
253+ " -s" , " submitted" , // Only include submitted CLs,
254+ " -m" , " 1" , // Get top-most change
255+ path // Depot path to get CLs from
256+ });
257257}
258258
259259std::unique_ptr<ChangesResult> P4API::OldestChange (const std::string& path)
260260{
261261 std::unique_ptr<ChangesResult> changes = Run<ChangesResult>(" changes" , {
262- " -s " , " submitted " , // Only include submitted CLs,
263- " -m " , " 1 " , // Get top-most change
264- path // Depot path to get CLs from
265- });
266- changes-> reverse ( );
262+ " -r " , // List from earliest to latest
263+ " -s " , " submitted " , // Only include submitted CLs,
264+ " -m " , " 1 " , // Get top-most change
265+ path // Depot path to get CLs from
266+ } );
267267 return changes;
268268}
269269
270270std::unique_ptr<DescribeResult> P4API::Describe (const std::string& cl)
271271{
272272 MTR_SCOPE (" P4" , __func__);
273273 return Run<DescribeResult>(" describe" , { " -s" , // Omit the diffs
274- cl });
274+ cl });
275275}
276276
277277std::unique_ptr<FileLogResult> P4API::FileLog (const std::string& changelist)
278278{
279279 return Run<FileLogResult>(" filelog" , {
280- " -c" , // restrict output to a single changelist
281- changelist,
282- " -m1" , // don't get the full history, just the first entry.
283- " //..." // rather than require the path to be passed in, just list all files.
284- });
280+ " -c" , // restrict output to a single changelist
281+ changelist,
282+ " -m1" , // don't get the full history, just the first entry.
283+ " //..." // rather than require the path to be passed in, just list all files.
284+ });
285285}
286286
287287std::unique_ptr<SizesResult> P4API::Size (const std::string& file)
@@ -298,16 +298,16 @@ std::unique_ptr<SyncResult> P4API::GetFilesToSyncAtCL(const std::string& path, c
298298{
299299 std::string clCommand = " @" + cl;
300300 return Run<SyncResult>(" sync" , {
301- " -n" , // Only preview the files to sync. Don't send file contents...yet
302- clCommand,
303- });
301+ " -n" , // Only preview the files to sync. Don't send file contents...yet
302+ clCommand,
303+ });
304304}
305305
306306std::unique_ptr<PrintResult> P4API::PrintFile (const std::string& filePathRevision)
307307{
308308 return Run<PrintResult>(" print" , {
309- filePathRevision,
310- });
309+ filePathRevision,
310+ });
311311}
312312
313313std::unique_ptr<PrintResult> P4API::PrintFiles (const std::vector<std::string>& fileRevisions)
@@ -325,15 +325,15 @@ std::unique_ptr<PrintResult> P4API::PrintFiles(const std::vector<std::string>& f
325325std::unique_ptr<Result> P4API::Sync (const std::string& path)
326326{
327327 return Run<Result>(" sync" , {
328- path // Sync a particular depot path
329- });
328+ path // Sync a particular depot path
329+ });
330330}
331331
332332std::unique_ptr<UsersResult> P4API::Users ()
333333{
334334 return Run<UsersResult>(" users" , {
335- " -a" // Include service accounts
336- });
335+ " -a" // Include service accounts
336+ });
337337}
338338
339339std::unique_ptr<InfoResult> P4API::Info ()
0 commit comments