Beispiel #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);
        }
        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;
        }
 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);
        }
 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);
        }
 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;
 }
        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);
        }
        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 );
                }
            }
        }
Beispiel #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);
                }
            }
        }
        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;
            }
        }
Beispiel #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);
            }
        }
        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;
        }
Beispiel #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);
        }
        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);
            }
        }
        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;
            }
        }