Example #1
0
        /// <summary>Creates the graph for the current branch.</summary>
        /// <param name="revisions">Revisions to create graph for.</param>
        /// <param name="database">database the revisions came from (to look up parents)</param>
        /// <returns>Graph.</returns>
        internal Graph Create(Snapshot snapshot, string branch)
        {
            Graph graph = _buildGraph(_name);

            _colors.Clear();

            RevisionIdx.iterator it = snapshot.find(branch);

            for (; it != RevisionIdx.End(); ++it)
            {
                int c = 0;
                /* only want to evaluate the 4-parent part on non-branch parents. */
                foreach (string parent in it.value().Parents)
                {
                    Revision p = snapshot.rev(parent);
                    if (p != null && p.Branch == it.value().Branch)
                    {
                    }
                    else
                    {
                        ++c;
                    }
                }

                if (c < 4)
                {
                    _printParentsFull(graph, it.value(),
                                      (parent) => { return(snapshot.rev(parent)); });
                }
                else
                {
                    _printParentsPartial(graph, it.value(),
                                         (parent) => { return(snapshot.rev(parent)); });
                    /* so, let's collapse some of the history. */
                }

                if (OnProgress != null)
                {
                    OnProgress(this, new System.EventArgs());
                }
            }

            return(graph);
        }
Example #2
0
        internal void save(SQLiteStorage.SQLiteCache db)
        {
            object data = db.start();

            for (BranchChangesets.iterator bit = _branchChangesets.begin();
                 bit != _branchChangesets.end();
                 ++bit)
            {
                for (RevisionIdx.iterator rit = bit.value().begin();
                     rit != bit.value().end();
                     ++rit)
                {
                    TFSDB.logger.DebugFormat("s[{0}]", rit.value().ID);

                    /* database. */
                    db.save(data, rit.value());
                }
            }

            db.end(data);
        }
Example #3
0
        public byte[] serialize()
        {
            MemoryStream  w = new MemoryStream();
            XmlSerializer s = new XmlSerializer(typeof(Revision));

            RevisionIdx.iterator it = _changesetIdx.begin();
            for (; it != _changesetIdx.end(); ++it)
            {
                s.Serialize(w, it.value());
                w.Write(MAGIC_BYTES, 0, MAGIC_BYTES.Length);
            }

            w.Flush();
            w.Close();
            byte[] result = w.ToArray();
            return(result);
        }