Page 1 of 1

Writing an import utility with ChangeSetItem_CopyBranch

Posted: Fri Apr 16, 2010 8:46 am
by surak8
While writing an import utility to populate Vault from my previous SCM, I have been attempting to follow Eric Sink's methodology of installing all file-modifications in a folder called trunk and then, to create branches using ClientInstance methods GetByLabel_GetStructure and then to Commit a ChangeSetItem_CopyBranch, which MOSTLY works.

The problem with this is that the entire structure, and ALL files are duplicated within the newly created. However, I am looking for ONLY those files which also have the given LABEL as well.

Is there any way to do this? Short of deleting files, following the ChangeSetItem_CopyBranch?

Re: Writing an import utility with ChangeSetItem_CopyBranch

Posted: Fri Apr 16, 2010 8:50 am
by surak8
Sorry, also, can you please describe the labelSubItemPath parameter to
GetByLabel_GetStructure.

I am wondering if I can somehow use this parameter to help me.

thanks,

Re: Writing an import utility with ChangeSetItem_CopyBranch

Posted: Fri Apr 16, 2010 1:55 pm
by jeremy_sg
Branches are designed to hold all items that get branched, not just the items that will change. The benefit of structuring this way is that a get of the branch will get all files needed for that branch to be built.

The normal way of achieving the desired workflow:

1. Code in trunk up to the release of version 1.0.
2. Branch 1.0 to $/branches/1.0
3. Code 2.0 changes in $/trunk, any subsequent edits to 1.0 go in $/branches/1.0
4. When you need to release 1.0.1, Label $/branches/1.0.
5. If you need to code 1.0.2 features, code them in $/branches/1.0.

By labeling each release, you are still guaranteed to be able to get the code as of any certain release, but you don't necessarily need a full branch for each 1.0.x release.

So as you're importing your (PVCS?) data, branch the first time that you see a 1.0 label, and apply edits for all the changes off that label.

As for your specific question, if you choose to go that route, it is possible to call copybranch on a file-by-file basis to customize your resulting overall branch.