Exemplo n.º 1
0
        private VaultHistoryQueryRequest PrepareQuery(VaultClientHelper client)
        {
            VaultHistoryQueryRequest history = new VaultHistoryQueryRequest();

            history.BeginDate = VaultDate.EmptyDate();
            history.EndDate   = VaultDate.EmptyDate();

            history.DateFilterMask = VaultQueryRequestDates.DoNotFilter;
            history.CommentFilter  = VaultQueryRequestComments.FilteredComment;

            history.Recursive = true;
            history.RepID     = client.Client.ActiveRepositoryID;

            VaultClientFolder vcfolder = client.Client.TreeCache.Repository.Root.FindFolderRecursive("$");

            history.TopName  = vcfolder.FullPath;
            history.TopID    = vcfolder.ID;
            history.IsFolder = true;

            // set the sort order
            history.Sorts = new long [] {
                (long)(VaultQueryRequestSort.NameSort | VaultQueryRequestSort.AscSort),
                (long)(VaultQueryRequestSort.VersionSort | VaultQueryRequestSort.AscSort),
            };

            return(history);
        }
Exemplo n.º 2
0
        private VaultHistoryQueryRequest PrepareQuery( VaultClientHelper client )
        {
            VaultHistoryQueryRequest history = new VaultHistoryQueryRequest();

            history.BeginDate = VaultDate.EmptyDate();
            history.EndDate = VaultDate.EmptyDate();

            history.DateFilterMask = VaultQueryRequestDates.DoNotFilter;
            history.CommentFilter = VaultQueryRequestComments.FilteredComment;

            history.Recursive = true;
            history.RepID = client.Client.ActiveRepositoryID;

            VaultClientFolder vcfolder = client.Client.TreeCache.Repository.Root.FindFolderRecursive( "$" );
            history.TopName = vcfolder.FullPath;
            history.TopID = vcfolder.ID;
            history.IsFolder = true;

            // set the sort order
            history.Sorts = new long [] {
                                            (long) (VaultQueryRequestSort.NameSort    | VaultQueryRequestSort.AscSort),
                                            (long) (VaultQueryRequestSort.VersionSort | VaultQueryRequestSort.AscSort),
            };

            return history;
        }
Exemplo n.º 3
0
 private VaultTxDetailHistoryItem [] GetChanges( VaultClientHelper client, VaultTxHistoryItem changeSet )
 {
     string changeSetComment = null;
     VaultTxDetailHistoryItem [] changes = { };
     client.Client.Connection.GetTxDetail( client.Client.ActiveRepositoryID, changeSet.TxID, ref changeSetComment, ref changes );
     FillInMissingComments( changes, changeSetComment );
     return changes;
 }
        private VaultTxDetailHistoryItem [] GetChanges(VaultClientHelper client, VaultTxHistoryItem changeSet)
        {
            string changeSetComment = null;

            VaultTxDetailHistoryItem [] changes = { };
            client.Client.Connection.GetTxDetail(client.Client.ActiveRepositoryID, changeSet.TxID, ref changeSetComment, ref changes);
            FillInMissingComments(changes, changeSetComment);
            return(changes);
        }
Exemplo n.º 5
0
 private long GetFolderId( VaultClientHelper client, string repositoryPath )
 {
     VaultClientFolder folder = client.Root.FindFolderRecursive( repositoryPath );
     if( folder == null )
     {
         throw new ApplicationException( "Could not find folder \"" + repositoryPath + "\"" );
     }
     return folder.ID;
 }
        private long GetFolderId(VaultClientHelper client, string repositoryPath)
        {
            VaultClientFolder folder = client.Root.FindFolderRecursive(repositoryPath);

            if (folder == null)
            {
                throw new ApplicationException("Could not find folder \"" + repositoryPath + "\"");
            }
            return(folder.ID);
        }
Exemplo n.º 7
0
 private VaultTxHistoryItem [] GetChangeSets( VaultClientHelper client, string featureBranch )
 {
     int count = 0;
     string queryToken = null;
     client.Client.Connection.VersionHistoryBegin( VaultClientHelper.MaxQuerySize, client.Client.ActiveRepositoryID, GetFolderId( client, featureBranch ), VaultDate.EmptyDate( ), VaultDate.EmptyDate( ), 0, ref count, ref queryToken );
     VaultTxHistoryItem [] historyItems = null;
     client.Client.Connection.VersionHistoryFetch( queryToken, 0, count - 1, ref historyItems );
     client.Client.Connection.VersionHistoryEnd( queryToken );
     return historyItems;
 }
Exemplo n.º 8
0
        public void Add( VaultClientHelper client, VaultHistoryItemBase historyItem )
        {
            VaultClientFile file = client.Root.FindFileRecursive( historyItem.ID );
            if( file == null )
                return;

            string fullPath = file.FullPath;

            Add( fullPath, fullPath, historyItem.Version, file.Version, historyItem.TxDate, historyItem.UserName, historyItem.Comment );
        }
        private VaultTxHistoryItem [] GetChangeSets(VaultClientHelper client, string featureBranch)
        {
            int    count      = 0;
            string queryToken = null;

            client.Client.Connection.VersionHistoryBegin(VaultClientHelper.MaxQuerySize, client.Client.ActiveRepositoryID, GetFolderId(client, featureBranch), VaultDate.EmptyDate( ), VaultDate.EmptyDate( ), 0, ref count, ref queryToken);
            VaultTxHistoryItem [] historyItems = null;
            client.Client.Connection.VersionHistoryFetch(queryToken, 0, count - 1, ref historyItems);
            client.Client.Connection.VersionHistoryEnd(queryToken);
            return(historyItems);
        }
Exemplo n.º 10
0
        private void MergeResults( VaultClientHelper client, VaultHistoryDataSet destination, VaultHistoryItem [] history, string featureTag )
        {
            if( history == null )
                return;

            foreach( VaultHistoryItem item in history )
            {
                if( HistoryQueryHelper.IsChangeRelatedToTask( item.Comment, featureTag ) )
                {
                    destination.Add( client, item );
                }
            }
        }
Exemplo n.º 11
0
        private void MergeResults(VaultClientHelper client, VaultHistoryDataSet destination, VaultHistoryItem [] history, string featureTag)
        {
            if (history == null)
            {
                return;
            }

            foreach (VaultHistoryItem item in history)
            {
                if (HistoryQueryHelper.IsChangeRelatedToTask(item.Comment, featureTag))
                {
                    destination.Add(client, item);
                }
            }
        }
Exemplo n.º 12
0
        private ChangeHistoryDataSet GetVersions( string[] featureTags, VaultRepositoryAuthSettings connectionSettings )
        {
            using( VaultClientHelper client = new VaultClientHelper( connectionSettings ) )
            {
                VaultHistoryQueryRequest query = PrepareQuery( client );
                VaultHistoryDataSet versions = new VaultHistoryDataSet();

                foreach( string featureTag in featureTags )
                {
                    query.CommentSubstring = featureTag;
                    MergeResults( client, versions, Process( client, query ), featureTag );
                }

                return versions;
            }
        }
Exemplo n.º 13
0
        private ChangeHistoryDataSet GetVersions(string[] featureTags, VaultRepositoryAuthSettings connectionSettings)
        {
            using (VaultClientHelper client = new VaultClientHelper(connectionSettings))
            {
                VaultHistoryQueryRequest query    = PrepareQuery(client);
                VaultHistoryDataSet      versions = new VaultHistoryDataSet();

                foreach (string featureTag in featureTags)
                {
                    query.CommentSubstring = featureTag;
                    MergeResults(client, versions, Process(client, query), featureTag);
                }

                return(versions);
            }
        }
Exemplo n.º 14
0
        private VaultHistoryItem[] Process( VaultClientHelper client, VaultHistoryQueryRequest query )
        {
            // Start the query
            int nRowsRetrieved = 0;
            string strQryToken = null;
            VaultHistoryItem[] histitems = null;

            client.Client.Connection.HistoryBegin( query, VaultClientHelper.MaxQuerySize, ref nRowsRetrieved, ref strQryToken );

            if( nRowsRetrieved > 0 )
            {
                client.Client.Connection.HistoryFetch( strQryToken, 0, nRowsRetrieved - 1, ref histitems );
            }

            client.Client.Connection.HistoryEnd( strQryToken );

            return histitems;
        }
Exemplo n.º 15
0
        private VaultHistoryItem [] Process(VaultClientHelper client, VaultHistoryQueryRequest query)
        {
            // Start the query
            int    nRowsRetrieved = 0;
            string strQryToken    = null;

            VaultHistoryItem[] histitems = null;

            client.Client.Connection.HistoryBegin(query, VaultClientHelper.MaxQuerySize, ref nRowsRetrieved, ref strQryToken);

            if (nRowsRetrieved > 0)
            {
                client.Client.Connection.HistoryFetch(strQryToken, 0, nRowsRetrieved - 1, ref histitems);
            }

            client.Client.Connection.HistoryEnd(strQryToken);

            return(histitems);
        }
Exemplo n.º 16
0
        public ChangeHistoryDataSet GetVersions(string featureBranch, VaultRepositoryAuthSettings connectionSettings)
        {
            using (VaultClientHelper client = new VaultClientHelper(connectionSettings))
            {
                VaultHistoryDataSet results = new VaultHistoryDataSet(featureBranch);
                foreach (VaultTxHistoryItem changeSet in GetChangeSets(client, featureBranch))
                {
                    foreach (VaultHistoryItemBase change in GetChanges(client, changeSet))
                    {
                        if (change != null)
                        {
                            // Don't query promotion info because it's done via branches, not labels.
                            results.Add(client, change);
                        }
                    }
                }

                return(results);
            }
        }
Exemplo n.º 17
0
        public ChangeHistoryDataSet GetVersions( string featureBranch, VaultRepositoryAuthSettings connectionSettings )
        {
            using( VaultClientHelper client = new VaultClientHelper( connectionSettings ) )
            {
                VaultHistoryDataSet results = new VaultHistoryDataSet( featureBranch );
                foreach( VaultTxHistoryItem changeSet in GetChangeSets( client, featureBranch ) )
                {
                    foreach( VaultHistoryItemBase change in GetChanges( client, changeSet ) )
                    {
                        if( change != null )
                        {
                            // Don't query promotion info because it's done via branches, not labels.
                            results.Add( client, change );
                        }
                    }
                }

                return results;
            }
        }