Bulk-renaming object files in TFS, prep for SSC
JohnHWk
Posts: 3 Bronze 2
We have a manually-managed TFS folder (VS 2015, TFS 2013) that was originally populated with another tool. Object files have suffixes by type, e.g. MyReportSproc.Procedure.sql, Patients.View.sql, etc. SSC doesn't do this, and we'd like to maintain history as we migrate. I'm trying to use tf.exe or cmdlets to bulk-rename these files to strip the excess object type, then I can use the existing folders for SSC and retain existing object history. There are hundreds of these, so manually renaming them isn't really a great option.
I can write a simple tf command that "works", except that it coughs a workspace error - seemingly because it sees multiple workspaces and can't tell which I want to use. Using "tf workspaces" with the relevant URL doesn't help, maybe because the new SSC workspaces are all under the same URL as the existing folders?
I know this isn't directly about SSC, but that's the context in which I'm trying to do this. I've done a lot of googling and the only cmdlet samples I found are old (2010?), and use features apparently deprecated in the TFS 2015 cmdlets. TF.exe would definitely work if only I could resolve the workspaces issue.
I can write a simple tf command that "works", except that it coughs a workspace error - seemingly because it sees multiple workspaces and can't tell which I want to use. Using "tf workspaces" with the relevant URL doesn't help, maybe because the new SSC workspaces are all under the same URL as the existing folders?
I know this isn't directly about SSC, but that's the context in which I'm trying to do this. I've done a lot of googling and the only cmdlet samples I found are old (2010?), and use features apparently deprecated in the TFS 2015 cmdlets. TF.exe would definitely work if only I could resolve the workspaces issue.
Tagged:
Best Answer
-
way0utwest Posts: 312 Rose Gold 1What's the workspace error? I would start here, perhaps post a note on SO (https://stackoverflow.com/questions/1267967/how-can-i-bulk-rename-files-using-powershell) or MSDN forums. That's a separate issue from prepping.
Once you get this, for the SOC (SQL Source Control), you'll have issues with the comparison (I think), because the text format of the code may look different to the SOC/Compare engine. What I'd do here is probably use a working folder config first, to get your code from the db into flat files. Then copy those manually to a local working folder for commit back to TFS and get a "clean" copy of the view of the code that SOC uses. I suspect you need to do this.
Editor, SQLServerCentral
Answers
I did spend some quality time with that StackOverflow article among others, but that's where the workspace error comes in. The exact text of the error is
"Unable to determine the workspace. You may be able to correct this by running 'tf workspaces /collection:TeamProjectCollectionUrl'."
Sadly, executing that command (with the correct URL) doesn't give any errors itself, but also doesn't stop the error message. This is where I suspect the multiple SOC workspaces in addition to my own under the single URL is stopping me. It seems like there should be a way to help tf.exe resolve to a specified workspace, but I haven't been able to find an example of that.
I'll try posting over at StackOverflow and see what I can learn.