ProcessCommandVersionHistory Results

If you are having a problem using Vault, post a message here.

Moderator: SourceGear

Post Reply
cameronkramr
Posts: 2
Joined: Wed Oct 02, 2024 8:00 am

ProcessCommandVersionHistory Results

Post by cameronkramr » Tue Oct 15, 2024 9:40 am

I'm trying to write an application that analyzes our version history in vault, but I'm having trouble with the output of ProcessCommandVersionHistory. I'm running the latest C# version of the Vault Client AP (10.2.0.1222).

There are two issues I'm running into. First, I am unsure how to filter and sort the VaultTxHistoryItems in the order that changes were committed to our repository. I try to sort by the TxDate element of the returned list, but sometimes I get anachronistic file states. For example, I'll see that a transaction is claimed by the TxDate to have happened in 3/17/2002, but I can tell from the file's internal comments that the state was from 2011. These appear spuriously throughout the transaction history and I can't find a way to differentiate them from real history. Furthermore, sometimes transactions will have the same TxDate down to the tick (second, since vault doesn't appear to use ms resolution). This makes it hard to figure out the order TxHistoryItems should be in, so I'm using TxID as a backup when dates are the same. I can't use TxID in general because TxID is obviously not ordered by the time that the history occurred.

The second major issue is that the results appears to be missing comments from commits past around 2008/2011 (ominous year?). There are ~113,000 results returned by ProcessCommandVersionHistory and only about ~20,000 comments attached to the results. I wasn't around in the time-frame that comments are entirely missing, but I am assured by my team that there should be comments. If I track transactions down in the the Vault Standard GUI, I can see the that the transactions should have comments, but they don't show up in the VaultTxHistoryItems for some reason.

Here is my function call to get all history items:

Code: Select all

 foreach (var i in ServerOperations.ProcessCommandVersionHistory(repoPath,
                                  									1,
                                                                            				VaultDateTime.Parse("1990-01-01"),
                                                                            				VaultDateTime.MaxValue,
                                                                            				0))
                                                                            				...
I think my issue might be related to the versionHistoryBeginVersion parameter, but I don't know what it should be or does in general (no real details on docs or forums).

I tried searching around the forum, but did no t find anything that helped. Thanks in advance.

jclausius
Posts: 3704
Joined: Tue Dec 16, 2003 1:17 pm
Location: SourceGear
Contact:

Re: ProcessCommandVersionHistory Results

Post by jclausius » Tue Oct 15, 2024 1:52 pm

ProcessCommandVersionHistory() will list the transactions that have been applied to a given Folder.

With that said, any time an object in the repository is changed, the parent folder and all of the ancestor folders up to and including $/ are also bumped by a version. So, it isn't just changes, but even a move or rename will create new History Versions for a folder or its parents.

In regards to parameters the API intellisense documentation should have descriptions for parameters, but I'll paraphrase some of them here:

- beginDate will set the "floor" of the first version of a folder that is on or after that provided date. If you do not want to set a floor, use VaultDate.EmptyDate() as the value to retrieve a folder's history since it was created.

- endDate will set the "ceiling" for the end version of a folder that is on or before that provided date. If you do not want to set a cap on the history, use VaultDate.EmptyDate() as the value to retrieve all history for after the beginDate.

- commentFilter will only retrieve versions where that passed in substring is found in the change set's comment

I don't know the source of your files, but if you ran them through something like Vault Folder Import of VSS Import the date of the transaction may not necessarily match the date of a given file.

In regards to comments, ProcessCommandVersionHistory uses the same exact call as the GUI Client's "View folder history by version." So, if you invoke history on a Folder (and hold down Shift if you've turned off the History options dialog), choose the "View folder history by version" option you should be able to compare those results to the results from the API.

---
Note, if you need history for a file or different reporting of history on a different object, please review the API documentation for:
- ProcessCommandHistory() (2 of them with differing parameters)
- ProcessCommandHistoryEx()


Hopefully this helps you get what you are looking for.
Jeff Clausius
SourceGear

cameronkramr
Posts: 2
Joined: Wed Oct 02, 2024 8:00 am

Re: ProcessCommandVersionHistory Results

Post by cameronkramr » Wed Oct 16, 2024 7:35 am

Thanks for the reply Jeff. We did import our repository from VSS around 2011 (before my time here). These issues seem to be an artifact from when the repository was migrated from VSS which appears to have been a messy process. Which api call(s) is used to generate the "Version details" window from the history by version->details button? I think that might be the way to get at the comments I am missing since comments appear in individual item comments but not the change set comment (what I was reading before). Specifically, I'm not sure how to go from a folder version to a list of comments associate with the files in that folder version.

If you have any tips for straightening out the timeline of the repository through api calls I would appreciate that as well. It really messes with our analysis when anachronistic file states show up in the folder version history. A way to differentiate between folder versions that are reported within the same second and may have adjacent folder version numbers but which may contain anachronistic state information would be helpful. The only reason I know about it now is that I'm able to manually see dated comments in the files themselves but I couldn't use that as a way to tell for sure since I can't guarantee that information is present in all files. I'm worried it might be a lost cause, but of you can think of anything I would greatly appreciate it.

jclausius
Posts: 3704
Joined: Tue Dec 16, 2003 1:17 pm
Location: SourceGear
Contact:

Re: ProcessCommandVersionHistory Results

Post by jclausius » Mon Oct 21, 2024 10:37 am

In regards to history, there are two types of comments:
  • A transaction comment
  • A transaction Item comment
When you look at version history, it will display the Transaction comment only. Then when you view the details, it will show the transaction comment above and any transaction item comments with each history item below. So that might explain some of what you're seeing.

To answer your question, the "Details..." button pretty much makes the same call as ProcessCommandTxDetail(). So, if you have the transaction id (TxID) info from the call to ProcessCommandVersionHistory(), you would use the transaction id in a call to ProcessCommandTxDetail() to see the details of the entire transaction. The transaction details will also have some of the dates that may better paint a picture for history.
Jeff Clausius
SourceGear

Post Reply