branching files twice to the same branch  
Author Message
geert0721





PostPosted: Team Foundation Server - Version Control, branching files twice to the same branch Top

Hello,

We are moving our source code control system from pvcs to tfs.

During this process I encountered the following strange behaviour during a branch operation.

I'll list the actions I performed.

1. create a directory with a file under source control : $repository/main/A/file0.txt

2. branch the 'main' folder to branch 'test', using the branch UI. This generates $repository/test/A/file0.txt

3. I then found out that I forget to add file1.txt to directory A and to branch that too. So I created $repository/main/A/file1.txt

4. I did exactly the same branch operation as in 2., i.e. branching main to test

5. The result is not that $repository/test/A/file1.txt is created as pending branch checkin, but that the entire main folder is reproduced under the test folder as pending checkin. I.e. the pending checkin now is $repository/test/main/A/<file0 and file1>.txt

This is not what I wanted, nor expected. I can understand the behaviour of tfs-vc, but at least I would expect a warning.

Can someone give me a way to 'capture' this behaviour, so I can stop the checkin before the files are branched to a wrong location, or alternatively, a way to branch 'forgotten files' without having to do it file by file.

Thanks,

Geert



Visual Studio Team System21  
 
 
Martin Woodward





PostPosted: Team Foundation Server - Version Control, branching files twice to the same branch Top

Just to understand, is your problem that you branched to $/repository/test/main/A the second time rather than into $/repository/test/A

In step 2, what where your branch source and targets and then in step 4 what where they

Cheers,

Martin.


 
 
Richard Berg MSFT





PostPosted: Team Foundation Server - Version Control, branching files twice to the same branch Top

Branches are always recursive. If you branch $/a to $/b there's no way to stop all of its children from coming along (at least with the Branch command...)

It sounds like that you really want to do is Merge. Once you've created a branch, the Merge command is in charge of keeping the source & target in sync. If you merge from $/repository/main to $/repository/test, TFS will pend the appropriate branches (and edits, renames, etc.) for you.

 
 
Dvorsky Slavomir





PostPosted: Team Foundation Server - Version Control, branching files twice to the same branch Top

This is not the way the TFS behaves.

You should do it this way :

1. add file file1.txt to $repository/main/A/file1.txt

2. checkin pending chnage (ie. file1.txt)

3. right click on $repository/main/ folder and choose Merge ... merge dialog opens ...

4. merge the "add file file1.txt"  from $repository/main/  to branch $repository/test/...


 
 
geert0721





PostPosted: Team Foundation Server - Version Control, branching files twice to the same branch Top

Hello,

you are all quite right, I should perform a merge operation to get file1.txt in branch test

The problem I encountered occured when I did a programmatic (using the API) to bring over existing code to TFS.  After add and branch,  I found out that I forgot some files.  So I did rerun the fixed program, that did get file0.txt and file1.txt,  added file1.txt and did the branch.

One issue still remains.  In both cases, I specified to branch 'main' to 'test'.

The first time, a 'test' folder was created alongside the 'main' folder (i.e.  A/main and A/test).

The second time, a new main folder was created under test.  So I ended up with A/main (containing file0 and file1), A/test (containing file0) and A/test/main (containing file0 and file1).

It appears to me that a folder for the branch is created if it does not yet exist (case 1), while if the branch folder allready exists, the folder to branch is placed as a subfolder (case2).

So I was surprised that the branch command behaved differently in both cases.

Anyhow, this is the first time I use this kind of forum and I am very pleased (happy) for the fast and usefull response.

Thanks,

Geert


 
 
geert0721





PostPosted: Team Foundation Server - Version Control, branching files twice to the same branch Top

In both cases, I specified $repository/main as the source of the branch and$repository/test as the destination (and name) of the branch.

See the my post further along the line.

Cheers,

Geert