ClearCase issue two files pointing to the same resource - path

We have multiple projects in a given ClearCase view. Somehow, we now have a handful of files that are pointing to the same resource in two different projects.
We had a JavaTestProject that was put in ClearCase as a sample project.
The code was used as a model to create a new project: JavaLiveProject.
For a few pieces of code with the same name, ClearCase has pointed the JavaTestProject to the JavaLiveProject file with the same name.
Using ClearCase Explorer, the View Path for JavaTestProject/MyJavaProgram.java looks like it belongs to JavaTestProject.
However, if you use the Properties of Element option, the full path is pointing to JavaLiveProject/MyJavaProgram.java.
If you check out and edit the file in either project, you are really editing JavaLiveProject/myJavaProgram.java.
We are not certain how this happened (we do not see any symlinks in ClearCase Explorer).
However, we would like to make it so that JavaTestProject/myJavaProgram.java does not affect JavaLiveProject/MyJavaProgram.java.
There are other instances where the code has the same name (MySampleProgram.java for instance) where this did not happen.
Any ideas?

The easiest way to troubleshoot that kind of situation is to leave the GUI aside for a moment, and see what the command-line interface returns:
In a DOS session, go to your (snapshot I presume) view and type:
cleartool ls
If there is a symlink (it shouldn't be since you didn't see it through the GUI, but I am just checking there), it would be displayed as:
JavaTestProject/MyJavaProgram.java --> C:\path\to\JavaLiveProject/MyJavaProgram.java
If not, check if there is some kind of OS-based symlink (like a Junction)
A cleartool descr -l of both "JavaTestProject/MyJavaProgram.java" and "JavaLiveProject/MyJavaProgram.java" can help troubleshoot the issue too.

After working with ClearCase support (internal, not official), the reason that the files were pointing to the same resource could not be determined. However, removing the files from the JavaTestProject seems to have cleared up the issue (it did not delete the files in JavaLiveProject).
I did make backup copies before deleting files from ClearClase, just in case.

Related

TFVC source control binding invalid when migrating to new workspace

I'm switching to a new machine and would like to keep my TF files as they are. Thus I simply copied the entire folder to the new machine's (same as the previous one - C:\TF), mapped it to the TF server's root, and attempted to open a solution from the file explorer, hoping that it would bind more or less automatically.
I then ran into issues similar to others that have been described elsewhere, such as here and here. VS/TF insist that the binding on the solution and all projects is "invalid".
Unbinding and re-binding does not work, the binding reappears but remains invalid.
Recreating the workspace does not work.
There is nothing funny about the solution file's content.
The relative paths are correct - if I remove the bindings and try to add the files to source control, it overwrites the already existing files in the source control explorer (the item previously appearing as a grayed-out "Not Downloaded" becomes white with an "add" pending change).
Tried mapping the workspace to a "fake" network drive that pointed to the new machine's hard drive (just in case TF was mixing up the identical paths), still the same.
Deleting Team Foundation's AppData settings doesn't work.
When I perform a get on the solution folder, though, the binding becomes healthy all of a sudden. In the end I performed the get, deleted all the new files and put the ones from the old machine in their place. VS/TF apparently had no issues with the binding then. It's a rather inconvenient way of achieving that end, though.
I'm forced to conclude that TF doesn't want me to bind my own, local files to source control without first performing a get in that workspace, even if the file paths match what is on the server. Question: why is that? Am I doing something conceptually wrong? Doing it the wrong way? Is this behavior an idiot-proof feature of the tool, or just a limitation?
You're doing it wrong :/. | it's a feature, not a bug.
The workspace is registered on the VSTS/TFS server as well as in the local workspace cache. After moving the folders over to a new machine (and to the same folder location), you need to tell VSTS/TFS the new computer name these files now reside on.
You have to run tf vc workspaces /updateComputerName:oldComputerName workspacename to update the workspace registration on the server.
But I'm afraid you need to do this before overwriting the workspace with a new mapping.
Now I think the only option is to use the Unbind option, save all, then open the source control menu again and rebind all the projects in the solution. Or edit the solution files manually (there's a tool for it as well).

Jenkins won't download svn:externals directory

I've added an svn:externals to my project, and it works great locally via TortoiseSVN. When I use Jenkins to pull from the same repository, it's not showing anything about the externals in the console output.
I read some other questions on here and I made sure my SVN version number in Jenkins was set to (1.6 externals to file) and restarted Jenkins. The problem is still occurring. Any ideas of something else I could set, or something I could use for troubleshooting? Thanks.
Oh, and the external directory is in the same repository, so I don't think it's an authentication issue as it builds fine without a reference to the external files.
I fixed this issue by selecting higher SVN Version Number on Jenkins 2.222.1.
Here is the procedure:
Manage Jenkins -> Configure System -> Subversion Workspace Version
Select at least v1.6. (The default one was 1.4 for me)
I may have had a very uncommon structure, but here's what worked for me...
First of all, here's the directory structure:
--Parent
----folder1
------subfolder1
------svnexternalfolder
----svnexternalfolder
As you can see, I had my svn external folder in two different levels of the project structure, but the Jenkins project was pointing directly at "folder1".
When first configured, it would never pull the files for my svn external folder (whether it was a full checkout, or svn update). This was configured with the svnexternals at the parent level.
My next try was to remove the svn externals at the parent, then specify just the higher location on the parent, then the lower location on folder1. This gave an error since the child svn directory had the same name as the other one.
So I flip-flopped the order of creating the svn external locations and did the child first (on "folder1"), then did the higher one on parent. Once I did that, everything started working.
Hope this helps someone else.
If you're curious about why I configured the directory structure this way, this was a PhoneGap project. apparently cordova/phonegap projects create their directory structures like this, the common folder beneath the parent is the "www" which houses all html, javascript, etc files, then those are also used under the platforms/ios, or platforms/android folders (in my example, I just called it folder1).

TFS MSBuild Copy Files from Network Location Into Build Directory

We are using TFS to build our solutions. We have some help files that we don't include in our projects as we don't want to grant our document writer access to the source. These files are placed in a folder on our network.
When the build kicks off we want the process to grab the files from the network location and place them into a help folder that is part of source.
I have found an activity in the xaml for the build process called CopyDirectory. I think this may work but I'm not sure what values to place into the Destination and Source properties. After each successful build the build is copied out to a network location. We want to copy the files from one network location into the new build directory.
I may be approaching this the wrong way, but any help would be much appreciated.
Thanks.
First, you might want to consider your documentation author placing his documents in TFS. You can give him access to a separate folder or project without granting access to your source code. The advantages of this are:
Everything is in source control. Files dropped in a network folder are easily misplaced or corrupted, and you have no history of changes to them. The ideal for any project is that everything related to the project is captured in source control so you can lift out a complete historical version whenever one is needed.
You can map the documentation to a different local folder on your build server such that simply executing the "get" of the source code automatically copies the documentation exactly where it's needed.
The disadvantage is that you may need an extra CAL for him to be able to do this.
Another (more laborious) approach is to let him save to the network location, and have a developer check the new files into TFS periodically. If the docs aren't updated often this may be an acceptable compromise.
However, if you wish to copy the docs from the net during your build, you can use one of the MSBuild Copy commands (as you are already aware), or you can use Exec. The copy commands are more complicated to use because they often populated with filename lists that are generated from outputs of other build targets, and are usually used with solution-relative pathnames. But if you're happy with DOS commands (xcopy/robocopy), then you may find it much easier just to use Exec to run an xcopy/robocopy command. You can then "develop" and test the xcopy command outside the MSBuild environment and then just paste it into the MSBuild script with confidence that it will work - much easier than trialling copy settings as part of your full build process.
Exec is documented here. The example shows pretty well how to do what you want, but in your case you can probably just replace the Command attribute with the entire xcopy/robocopy command (or even the name of a batch file) you want to use, so you won't need to set up the ItemGroup etc.

prevent Team Build dropping all binaries to the root of the drop folder

The default configuration of the Team Build Number Format is:
$(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)
It drops all output to \\foo\bar\MyBuildDef_20111031.1 Great stuff so far!
The small problem is that it drops all binaries in that directory without a good indication of the dependencies of the binaries.
How can you modify this property, or otherwise, to have the solution's binaries dropped in their respective project directories?
In the case above, I had expected the MVC website (complete with its bin directory) to be dropped. Instead, we got that PLUS the extra drop of the binaries in the root.
In other words: TFS, please stop dropping all binaries in the root; it looks messy, and it's confusing on which files belong/associated with what.
How can this be achieved with Team Build 2010?
This blog post should help you out: http://blogs.msdn.com/b/willbar/archive/2011/02/05/splitting-team-build-outputs-into-folders.aspx
Essentially, you create a new 'Platform' for each project. Team Build will put each platform in a different directory by default, so you get a different directory for each of your projects.
Build configuration dialog:
Drop folder output:
Unfortunately I have not found a good way to do this yet, though it has been a while since I tried to find a better solution then what I settled on.
Current have solutions for each desktop application, and one with all the websites. I then followed the instructions here to make each solution output into a separate folder.

is it possible to get a file from TFS into a local unmapped folder?

Looking at the docs for tf get I think the answer is no. Still, I could be wrong. I'd like to have a file that's mapped to C:\Projects\MyProject\SQL\myScript.sql. I'd then like to run a batch file that gets several files (including that one) from the repository, puts them into a local temp folder, runs them, then deletes them.
It's the first part that's the issue: I think that TFS won't let you get files into a folder without remapping the source folder to point to that folder first.
So I suppose I need to remap the remote folder to point to a new local folder (C:\Temp\Scripts for instance) then get the files, then map the folder back to where it was. Seems like an extra step that helps nothing.
Have a look at tf view to see if that does what you need. Otherwise, the usual pattern for doing stuff similar to this is to create a new workspace using the tf workspace command, map the folder, do a get then destroy the workspace.
Even better for you would probably to use the .NET API VersionControlServer.DownloadFile() - especially if you are doing his from a powershell script rather than a simple batch file.

Resources