Ejemplo n.º 1
0
        private void _queueOrVisit(QueryProcessor qp,
                                   Changeset cs, int distance, string branch)
        {
            Revision rev = _results.getRevision(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(qp, 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 =
                            tfsinterface.Utils.FindChangesetBranches(cs, (cng) => true);

                        foreach (string b in branches)
                        {
                            _results.construct(b, cs);
                        }
                    }
                    else
                    {
                        Logger.logger.DebugFormat("building {0}", cs.ChangesetId);
                        _results.construct(branch, cs);
                    }
                }
            }
            else
            {
                /* woo, got nothing left to do! */
            }
        }
Ejemplo n.º 2
0
    private void _print(System.IO.TextWriter wr, int csID)
    {
        /* print out a descending order changeset.
         * first we print ourselves.
         * then we print our parents, in descending order, recursively.
         */

        Revision r = _results.getRevision(csID);

        if (r != null)
        {
            /* print out us. */
            _print(wr, r);

            /* then print out our parents, in descending order. */
            PrimaryIDsCont desc     = new PrimaryIDsCont();
            PrimaryIDsCont mybranch = new PrimaryIDsCont();

            /* separate merge parents from regular history */
            foreach (int pID in r.Parents)
            {
                Revision pr = _results.getRevision(pID);

                if (pr != null)
                {
                    /* separate changesets into 2 piles:
                     * my branch parents,
                     * not my branch parents.
                     */
                    if (pr.Branch == r.Branch)
                    {
                        mybranch.insert(pID);
                    }
                    else
                    {
                        desc.insert(pID);
                    }
                }
            }

            if (!desc.empty())
            {
                /* print all of my parents not in my branch.
                 * this would be changesets merged into my branch
                 * by this changeset.
                 */
                foreach (int pID in desc)
                {
                    _print(wr, pID);
                }
            }

            if (!mybranch.empty())
            {
                /* now print all of my parents in my branch.
                 * this should be just one changeset.
                 */
                foreach (int pID in mybranch)
                {
                    _print(wr, pID);
                }
            }
        }
        else
        {
            /* we failed to find the requested chagneset id.
             * this means most likely that the parents were
             * properly decomposed from the merge changeset,
             * but that none of the children were retrieved and processed.
             */
        }
    }