~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/ngit/NGit/NGit.Revwalk/RevCommitList.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
394
394
                        }
395
395
                }
396
396
 
 
397
                /// <summary>Ensures all commits until the given commit are loaded.</summary>
 
398
                /// <remarks>
 
399
                /// Ensures all commits until the given commit are loaded. The revision
 
400
                /// walker specified by
 
401
                /// <see cref="RevCommitList{E}.Source(RevWalk)">RevCommitList&lt;E&gt;.Source(RevWalk)
 
402
                ///     </see>
 
403
                /// is pumped until the
 
404
                /// specified commit is loaded. Callers can test the final size of the list
 
405
                /// by
 
406
                /// <see cref="RevObjectList{E}.Count()">RevObjectList&lt;E&gt;.Count()</see>
 
407
                /// to determine if the high water mark specified was met.
 
408
                /// <p/>
 
409
                /// </remarks>
 
410
                /// <param name="commitToLoad">
 
411
                /// commit the caller wants this list to contain when the fill
 
412
                /// operation is complete.
 
413
                /// </param>
 
414
                /// <param name="highMark">
 
415
                /// maximum number of commits the caller wants this list to
 
416
                /// contain when the fill operation is complete. If highMark is 0
 
417
                /// the walk is pumped until the specified commit or the end of
 
418
                /// the walk is reached.
 
419
                /// </param>
 
420
                /// <exception cref="System.IO.IOException">
 
421
                /// see
 
422
                /// <see cref="RevWalk.Next()">RevWalk.Next()</see>
 
423
                /// </exception>
 
424
                /// <exception cref="NGit.Errors.IncorrectObjectTypeException">
 
425
                /// see
 
426
                /// <see cref="RevWalk.Next()">RevWalk.Next()</see>
 
427
                /// </exception>
 
428
                /// <exception cref="NGit.Errors.MissingObjectException">
 
429
                /// see
 
430
                /// <see cref="RevWalk.Next()">RevWalk.Next()</see>
 
431
                /// </exception>
 
432
                public virtual void FillTo(RevCommit commitToLoad, int highMark)
 
433
                {
 
434
                        if (walker == null || commitToLoad == null || (highMark > 0 && size > highMark))
 
435
                        {
 
436
                                return;
 
437
                        }
 
438
                        RevCommit c = walker.Next();
 
439
                        if (c == null)
 
440
                        {
 
441
                                walker = null;
 
442
                                return;
 
443
                        }
 
444
                        Enter(size, (E)c);
 
445
                        AddItem((E)c);
 
446
                        while ((highMark == 0 || size <= highMark) && !c.Equals(commitToLoad))
 
447
                        {
 
448
                                int index = size;
 
449
                                RevObjectListBlock s = contents;
 
450
                                while (index >> s.shift >= BLOCK_SIZE)
 
451
                                {
 
452
                                        s = new RevObjectListBlock(s.shift + BLOCK_SHIFT);
 
453
                                        s.contents[0] = contents;
 
454
                                        contents = s;
 
455
                                }
 
456
                                while (s.shift > 0)
 
457
                                {
 
458
                                        int i = index >> s.shift;
 
459
                                        index -= i << s.shift;
 
460
                                        if (s.contents[i] == null)
 
461
                                        {
 
462
                                                s.contents[i] = new RevObjectListBlock(s.shift - BLOCK_SHIFT);
 
463
                                        }
 
464
                                        s = (RevObjectListBlock)s.contents[i];
 
465
                                }
 
466
                                object[] dst = s.contents;
 
467
                                while ((highMark == 0 || size <= highMark) && index < BLOCK_SIZE && !c.Equals(commitToLoad
 
468
                                        ))
 
469
                                {
 
470
                                        c = walker.Next();
 
471
                                        if (c == null)
 
472
                                        {
 
473
                                                walker = null;
 
474
                                                return;
 
475
                                        }
 
476
                                        Enter(size++, (E)c);
 
477
                                        dst[index++] = c;
 
478
                                }
 
479
                        }
 
480
                }
 
481
 
397
482
                /// <summary>Optional callback invoked when commits enter the list by fillTo.</summary>
398
483
                /// <remarks>
399
484
                /// Optional callback invoked when commits enter the list by fillTo.