Example #1
0
        public override Snapshot getBranch(string branch, long limit)
        {
            Snapshot sn = null;

            /* get the last x changesets from tfs. */
            TFSDB db = TFSDB.QueryHistory(_vcs, branch, (ulong)limit, null, _cache);

            {
                string[] bs = branches();
                db.visitor.primeBranches(bs);
            }

            /* copy stuff we've already seen from the db cache into the visitor cache.
             * this only does the top-level stuff
             * any further queries we get will be passed to the cache.
             */
            foreach (Changeset cs in db.history)
            {
                Revision rev = _cache.rev(TFSDB.MakeID(cs.ChangesetId));
                if (rev != null)
                {
                    db.visitor.addRevision(rev);
                }
            }

            /* prime the merge history querying.
             * this will take out all top-level queries which have already been done.
             * already been done = exists in cache.
             *
             * this will also query tfs for the merge info.
             */
            db.queryMerges();

            /* at this point, ALL the changesets in 'history' MUST be in the visitor.
             * if not, then there's a problem with:
             *  insertQueries or the QueryProcessor.
             */

            /* this adds in the branch's history to the parent lists of the
             * appropriate changesets.
             * this will also update the cache
             */
            db.fixHistory();

            /* now dump everything in the visitor to the cache. */
            db.visitor.save(_cache);

            db = null;

            /* the full list should be in the cache now. */
            sn = _cache.getBranch(branch, (ulong)limit);

            return(sn);
        }
Example #2
0
        private void _queueOrVisit(Changeset cs, int distance, string branch)
        {
            /* check the database cache. */
            Revision rev = _cache.rev(cs.ChangesetId);

            if (rev == null)
            {
                /* ok, ok, we really don't have it...
                 * didn't find it, so do the first level query.
                 */
                if (!_handleVisit(cs, distance))
                {
                    /* manufacture a visit since this changeset
                     * has no merge actions to get branches from
                     */
                    if (branch == null)
                    {
                        /* determine a branch from the changesets's changes
                         * we're not queuing it, so we look for _all_ branches.
                         * (eg, 2nd level :[ )
                         */
                        List <string> branches =
                            megahistory.Utils.FindChangesetBranches(cs, (cng) => true);

                        foreach (string b in branches)
                        {
                            _visitor.visit(b, cs);
                        }
                    }
                    else
                    {
                        _visitor.visit(branch, cs);
                    }
                }
            }
            else
            {
                /* hah! found it in the cache,
                 * so add it to our in-memory lookup
                 * this will ensure that the merge-queries are able to see this
                 * already-looked-up item.
                 */
                _visitor.addRevision(rev);
            }
        }
Example #3
0
 public override Revision getRevision(string id)
 {
     return(_db.rev(id));
 }