How to do code review with TFS 2015 in Powerbuilder 12.6? - tfs

I am analyzing TFS to review code for a project built in Powerbuilder. Below is how things are set up:
We connect to TFS repository from Powerbuilder using MSSCCI plugin. fyi, Powerbuilder bundles the objects and stores in pbl file(powerbuilder library). Everything is kind of encrypted in pbl. Perhaps TFS is unable to recognize the pbl so objects like windows, datawindows, structure are placed in TFS server repository.
Say we have a library name project.pbl which have window1, window2 etc. Now in TFS, we have folder same as library name - project and in that folder we have the objects window1 and window2. When we get the source from TFS, we have the folder copied to our local folder along with the objects.
Now my question is:
1.When we make change to any object in Powerbuilder and check in, how does TFS knows the changes since it does not have information about the library?
2.If I check out an object and make a change, the changes are not visible in object in TFS. It would be visible only after code is checked in. In this case, how can I submit the code for code review prior to check-in?
Is there any other approach which I can take for code review?
Thanks,
Ashish

1) via the PBG file. From a quick Google search:
When you add a target or an object (in a target that is not under source control) to source control, PowerBuilder creates a PBG file. A PBG file maps objects in a target to a particular PBL in a PowerScript or .NET target. One PBG file is created per PBL , so there can be multiple PBG files for these types of target.
2) Not sure what 'submit the code for code review' is but if you are using TFS to track the defects / work via workitems you can link any changed objects to the workitem during check in. In my experience you should have (at least) a Development branch and a Production branch. All changes are made to the Development branch. If the code review or testing reveals a problem with code, it goes back to the developer. If everything is okay, the changes are then merged into the production branch.

With TFS if you use the Git repository instead of TFVC and if you upgrade to PowerBuilder 2017 R3 then PowerBuilder will save the non-binary (text) version of your objects (e.g. SRD, SRW, etc.).

Related

TFS Repository deleting status after upgrading major version

In the past, we seem to have created a TFS repository that was not part of a project. It seems that this is no longer supported by TFS in recent versions.
After updating TFS 2013 to 2015 and then 2017 we did not immediately notice the problem, but looking in the Collection Management screen on the web portal shows that the "Project" (which is not a project) is marked in a "Deleting" status.
The Microsoft page about this says that if you want to keep the code, no action needs to be taken. That "Deleting" status worries me however.
Is there any way to add an existing repo to a project? I can create a new project. I can add a new repo to a project. Can I add an existing repo to a project?
Alternatively, can I "Un-Deleting" that repo somehow?
That page have described this very clear:
Otherwise, no action is required. Placeholder team projects are
hidden in Web Access and Team Explorer in Visual Studio. Therefore,
they have no significant effect on day-to-day usage. As with any
other deleted item in Version Control, you can still access the
corresponding project in Source Control Explorer if the Show/Hide
Deleted Items button is enabled.
As you said, Placeholder team projects are not real team projects. When you delete a real team project, it will permanently removes data associated with that project from the database. You cannot recover it later.
They are just as deleted folders/items in TFS, you could undelete them in Visual Studio Source Control. Just select the deleted folders and right click it select undelete , and check in pending changes. Then you could get/download all files in the repo to local. Create a new team project, add files to the project, finally delete the particular placeholder project.
Since there is no way to import deleted files to either a existing project or a new project. Above is a safety workaround, the only disadvantage is it will lose the source control history of those folders. Otherwise, you could also take no action as the page suggested, the Placeholder team project will not be deleted. If you encounter any problem about this, you could contact the TFS support.

Mark project changes as pending in source control

I have a small C# console program which uses the AddItem() method of Microsoft.Build.Evaluation.Project to add several language .resx files to all the Projects in several Solutions. This is working fine.
The issue is, those changes do not appear as pending changes in source control. I would like to see the .csproj files marked as pending change and the new .resx as pending adds. What APIs should be used to do this? I found the SccAdd() native API (https://learn.microsoft.com/en-us/visualstudio/extensibility/sccadd-function) but it looks like something that would need to be called by the IDE, not from my command line utility.
Environment: The c# console program is VS2015. The projects it is modifying are VS2008 Compact Framework 3.5. The current Source Control system is TFS 2015.
You could use TFS API to pend changes in a workspace then check in files to TFS. Use the Workspace.PendAdd method queues files or a folder for addition to the version-control repository. Either create a temporarily workspace or use the one your project file located.
Here is a detail example of using the TFS API to add pending changes, checkin code. You could aslo take a look at this question: Calls to `Workspace.PendAdd` not adding items

How to identify files updated outside of TFS

We have a nopCommerce website of a client's that one of their IT guys was modifying views directly on the web server. They now want to do more extensive changes so we want to put the baseline NopCom code in TFS.
Then, ideally, we'd like to be able to identify all the views that were changed directly on the web server and have those changed views be recognize as changes in TFS source control to check-in.
Is there anyway to do this in Visual Studio/TFS in batch? i.e. it would be great to do a check-in locally so all the base code of NopCom was checked in to TFS, then download the website files and overwrite them in the local workspace and have TFS recursively do a diff and determine if any new files were added or existing ones changed and mark those for check-in.... I know...I'm probably dreaming, but any other smart workarounds appreciated as well, assuming this won't work.
TFS does what you want. To set up Team Foundation Version Control (TFVC) on your dev machine, you just need to create a workspace and then add your code. Check link: https://www.visualstudio.com/en-us/docs/tfvc/set-up-team-foundation-version-control-your-dev-machine
When your codebase is under version control, you can develop your app, create and open files in Solution Explorer and write your code, while version control does other work for you. When you check files in and out, it keeps track of your changes and creates a history of your project.
You can use the Diff window to clearly see the difference by comparing folders or files. You can compare server folders and local folders to each other, and view the differences between the contents of each folder. You can compare two server files, two local files, or a server file against a local file and view the differences between the files.
You can get more details about TFVC from website below: https://www.visualstudio.com/en-us/docs/tfvc/overview

TFS Server 2012 and Promoting changes

I started using TFS Team explorer 2012 and happen to notice a new process called promoting. As I understand it, the Team Explorer detect any changes made to the files outside of the TFS explorer and count them for promotion? Am I right?
How do I take care of the situation where I made a change to the file which is already checked out through TFS, then made a change via Windows Explorer\Notepad but dont want to include the changes made through the Windows Explorer\Notepad.
This is a new feature of TFS 2012 called Local Workspaces.
You are correct in that changes made outside of visual studio can be included in the check-in by promoting them, if they are not already under source control.
If they are already in source control and you do not want to commit them, then you would need to right click the file and choose Exclude. This will move the file from Included Changes into Excluded Changes.
If you do not like the new Local Workspaces you can tell TFS to go back to the old model of Server Workspaces:
Open Team Explorer
Go to Settings
Under Team Project Collection select Source Control
Click the Workspace Settings Tab
Here you can choose the workspace type.
While everything that discens said is correct, one thing bears explicit mention: there is no change to the level of granularity of Team Foundation Server. You still check out files and edit files and check-in files.
In your example, if you have a file checked out and you edit it in Notepad, the changes will be checked in. There is no change here from previous behaviors. There is no way to keep these changes from being checked in, short of saving the file with a different file name.

How can I migrate TFS source from one team project to another?

We've decided to go with a different template for our team project and want to move all of source under that team project. We are not concerned with migrating work items, but we would like to keep the version history of the source files, if possible. I tried the TFS to TFS migration tool on code plex and it seems to only move the most recent version of each source file over.
We are on TFS 2008 and the team projects are on the same server.
EDIT: It looks like the move function may work. I've seen some concerns posted about whether or not this moves all the history for a given file.
If you do a move from within TFS, that should register as just another action to be saved in the history. Your other history should be kept intact, even when moving across projects.

Resources