Hi folks,
I will appologize in advance as i"m new to VB6 and VSS OLE Automation so pardon my ignorance if it's an easy answer (which i'll take at this point)! Quick background: Previous employee who worked with our production build tool left the company so i'm holding the bag with a homegrown tool built in VB6 that we use to pull data from VSS via the OLE api to create builds.
During a build, we put a recursive label on the entire project as a way to "checkpoint" when a build was cut. Normally we just pull the latest version of files from VSS but my boss wants us to be able to pull from a specific version/label. I'm working on a chunk of code which loops through a VSS object's versions, trying to match up to a passed in "label". If we match the label, i want to pull that explicit version of the file. The code is unable to pull the file by version if the version was attached to a label vs a "true" version # applied by a checkin, branch, etc. I'm beginning to think the problem is that because the label was applied at the top level, the version # attached to a child object (with that same label) won't allow us to grab the file at that point in time.
Case in point. I have a file $/A/B/test.pdf. During a build, we apply a label to $/A recursively. In the VSS UI, if i were to do a "Show History" for a given timeframe on the file test.pdf, I'd see 4 entries. The most recent 2 are only labels applied at the /A project level recursively. The latter 2 entries show up as actual version #'s because they were file checkins or branches.
<my attempt at History UI view> Version User Date Action <pic of label icon> Cascoli 9/08/09 8:36a Labeled '5.0002.0338' <pic of label icon> Cascoli 8/07/09 8:36a Labeled '5.0002.0336' 2 Cascoli 7/15/09 8:36a Branched at version 2 1 Cascoli 7/01/09 8:36a Created
From the UI, you can see versions 1 and 2 are true versions (so to speak) but i only see the version #'s (3 and 4) for the last two entries if i highlight each entry and click Details button. The code does a basic search through the versions of the file object and grabs the label attached. If it matches the label we're looking for, we take the Version # and set the object to that specific file version. Unfortunately, setting the object to versions 3 and 4 fails later on when I do the "get". If I did the same object set but with version 1 or 2, it works fine. Any ideas? Actual code is below. Thanks in advance!
... For Each oVSSVersion In moVSSItem.Versions(VSSFLAG_HISTIGNOREFILES + VSSFLAG_RECURSNO) If UCase(oVSSVersion.Label) = UCase(sLabel) Then Set moVSSItem = moVSSItem.Version(oVSSVersion.VersionNumber) bLabelMatchFound = True Exit For End If Next oVSSVersion If Not (bLabelMatchFound) Then Set moVSSItem = Nothing End If ...
' Call the Get method with the proper switches for the kind of file being retrieved moVSSItem.Get sLocalPath, VSSFLAG_REPREPLACE Or IIf(bWriteable, VSSFLAG_USERRONO, VSSFLAG_USERROYES)
|