Initial commit of major projects to mercurial - delphi

I have over 10 years of software projects that I would like to commit to Hg.
This is for code related to Delphi 7, and includes 3rd party licensed libraries, open source libs managed with svn, and my own code (I'm planning a migration to Delphi XE5).
The 3rd party and svn-derived libs generally have components installed in the Delphi IDE, and should be kept at "latest" version (as a roll-back will generally bork the IDE), so I just back them up (they were svn externals that never got rolled-back).
My layout is as follows:
-Licensed
|-(third party libs)
...
-SVNRoot
|-(various open source from svn)
...
-CodeRoot
|
|-common (common to all projects)
|
|--major1
| |
| |-common (common to the major1 software)
| |
| |-Cust1 (projects for customer1)
| | |
| | |-C1Proj1
| | |
| | |-C1ProjN
| |
| |-Cust2
| |
| |-C2Proj1
| |
| |-C2ProjN
|
|--major2
| |
... ...
That is, a "common" folder with code that I generally include in all my projects, regardless of where they are deployed.
Then a breakdown by major product, with sub-projects customized by customer.
I've read a variety of tutorials, but I seem to be missing something...
I see how I can add everything under CodeRoot to a local repository by moving to ..\CodeRoot and running Hg Init.
It isn't clear to me that I'd be happy having everything under a single repository.
OTOH, if that topmost "common" folder isn't in everything, I have a problem.
The "common" under each major project has the same issue.
I'm not sure yet what my "granularity" should be - a repository per MajorProject, or per CustProject.
So - Questions:
1) If I go with "per MajorProject" - how to handle that topmost "common" folder?
2) If I go with "per CustProject" - how do I handle the topmost AND per-major project common folders (if they are handled differently than topmost)
3) finally if I want to create a remote central repository (instead of local), how do I safely move all my files to a remote central repository before cloning it local to my machine?
TIA.
Cheers,
EdB

I would definitely not stick everything in one repository, although you might use sub-repostories within a top level. I havent used those myself however.
I would suggest split it up in the smallest chunks that make sense. You can always pull from multiple repos into a new repo if you later decide you actually want a larger grouping.
With regards to getting the files into a central, server held repo. Just push to it, or on the server clone from your local repo.

For 1) and 2), they both can be answered with sub-repositories. The main repository is also a repository, so your common folder will be handled by the main repository, and all your major projects will be in their own sub-repos.
Now, choosing whether or not you wish to use sub-repos for customer is up to you, though.
As for 3), once you have your local repo, make a clone on the central repository you wish to use. For Mercurial, once a repo has been cloned, it does not know in itself that it is a clone. They are linked through a reciprocal path, but clones are in no way different than the original!

Related

Teamcity auto build on project level

I have a Bitbucket project and it is designed in such a way, I have to create new repository as slide-project with copying base-framework-code(bfc) since each slide is unique in its own way(kind of animated learning slides) so utilizing the bfc to create a separate repo.
It looks like below - Solutions is project and it contains repositories(named as slides):
-> Solutions |
| -> Base-Framework-Code(bfc)(master)
| -> slide-01 |(master)
|src
|bfc
|package.json
| -> slide-02 |(develop)
|src
|bfc
|package.json
| -> slide-03 |(feature)
|src
|bfc
|package.json
My requirement is to implement TeamCity auto build feature in Solutions project itself.
When developers create a new slide-xx(a new repository), auto build should be triggered to that slide repo(for starters consider master).
Can I achieve this with TeamCity?
Please help with sharing any kind of resource.
PS. I'm new to TeamCity and still learning, I have gone through docs and demos and I know its working with specific repository with specific branches.
Thanks in Advance!

TFS Workspaces including common code

We're working on getting better use out of our TFS/TFVC server and move to benefit from TFS Work Items, and I have been put in charge of figuring out how to do so.
We have a lot of projects, most of them working with common code libraries. Our way of implementing new features have been to just include a reference to the code and build it all together when changes are needed, instead of referencing DLLs for the libraries.
My question revolves around setting up workspaces that don't end up making this a hassle when updating code in common libraries as well as the main project being worked on.
In working with this briefly, I have created multiple team projects for each product we're developing and it looks like the individual developer has to make sure to move between all the workspaces connected to the individual project and check in code for each of them. I feel like this is clunky and that there must be a better way to get this done.
A structure could look similar to this:
ROOT
|- Common Code
|- Team projects (each having their own backlog and referencing "Common Code"
|--- Product one
|--- Product two
|--- Product three
Would a better approach be to work on a single workspace and just create teams and have backlogs for each or is there a clean way of allowing the developers to utilize a common code library from individual Team Projects?
There are a lot of considerations going into the setup of your team projects. The most important reason to separate out to different project is security. If you have a need to ensure that different projects can't see the metadata of other projects, then a single Team Project is a bad idea.
If your teams have major differences in the process they follow, they may also have a need for different Team Projects, as the Process can only be defined at the Project level and all teams under the same Team Project have to follow the same process (either Scrum, CMMI, Agile or a custom Process). It may be worth to move your teams to the same process template though, there are not too many differences between Scrum and Agile, so unless you depend on CMMI or a heavy custom template, you can practice Scrum and something other kind of Agile in either template with a little bit of fantasy.
In all other cases it may be valuable to consider creating a single Team Project and using Team Backlogs to represent your projects. This approach is commonly called the "One project to rule them all" setup.
As for your "common code" project, I'd personally consider using the Package Management features of Visual Studio Team Services to generate NuGet packages of changes made to common code. The ALM Rangers have written some guidance on setting this up in the past, it's not updated to the latest version of VS and TFS, but it does give a nice outline of the process. Then include these common libraries as NuGet package references to your other projects. This gives you more control over when specific projects upgrade to a specific version of the common libraries and it results in a nice separation between the different projects using the common libraries. After having done this, it's also easier to setup things like Continuous Integration, Gated Checkins etc. working with complex workspaces will make that harder as well as you'll find out.
So it'll look like:
+- YourAccount.visualstudio.com
+- CompanyProject (Team Project)
+- TFVC Repository (Can only be one)
+- Common (folder)
+- Project 1 (folder)
+- Project 2 (folder)
+- Project 3 (folder)
+- Package Management nuget repository
+- Common
+- Teams
+- Root / Company
+- Project 1
+- Project 2
+- Project 3
If you move your projects to Git, it also becomes a little easier, as you can have multiple Git Repositories under the same Project.

Branching for a Patch in Team Foundation Server 2012

I'll preface this question with the statement that we are likely using TFS incorrectly based on some early misunderstandings on how TFS works, versus how GIT works.
Background:
We have a main branch which is where we do all of our development.
When we are ready to release, we create a branch off of the main branch and name it by the version (ex, "v8.10.0").
We compile and release from this new branch.
We then proceed with development back on the main branch.
If a critical issue is discovered with the previous release, and we are mid-stream in a sprint on the development branch, then we need to create a patch for the previous version. In this case, we create a new branch off of the release branch and start fixing the problem on that new branch (ex "v8.10.1").
Then we want to get the fix(es) we applied on the 8.10.1 branch into the main branch, and so we perform a merge from 8.10.1 to dev, and that is where the problems start to happen. This merge is a baseless merge and without fail that merge takes hours to complete, involves a lot of manual merging, and at the end of the process there are usually a handful of files that got botched in the merge process. Even worse, TFS usually decides that it can auto-merge some of the files and it tends to do this completely wrong and we wind up with completely ruined code.
There seems to be a flaw in our basic understanding of how to accomplish this task, and though it does not happen often, it always bites us, so what are we missing, and what is the correct way to do what I have outlined above?
Well there are many strategies of branching and only you can decide which is most suitable for you. What I see from the question is that you have main development branch and release branches. You have no branch for testing. You have no branches for parallel development. You have branches for hotfixes. One way to organize branches is:
O----------------main dev branch------------------>
| ^
V |
O---------------release branch---------------->
| ^
V |
O--------------hotfix branch------------->
So you have 1 branch for main work in development. Branch for realese from main(one branch not per release). And branch for hotfix from release. For versioning you can apply labling on release branch(https://msdn.microsoft.com/en-us/library/ms181439.aspx). Now you can merge without problems from main to release, from release to hotfix and back from hotfix to realese and from release to main.
In reality things get a little complicated with testing branch and parallel development branches. In my project we use something like this:
O--------parallel dev2---------------------------->
^ |
| V
| O---parallel dev1---------------------------->
| ^ |
| | V
O------------------main dev branch---------------->
| ^
V |
O--------------test branch------------------->
| ^
V |
O--------------relese branch------------->
But without all this, your design should also work. The main reason you have problems is that you are doing a baseless merge when you could merge hotfix branch back to release branch and from release back to main branch.

TFS Team Projects structure for AGILE development

Our team works on a Agile methodology, having specialized teams in different parts of the product. Currently we have everything in a single Team Project, but we want to restructure everything so that we can apply a nice functional continuous build as right now, we have a build definition for our backoffice and one for our website. The problem is that if we make any change inside that team project, even if it's a text file, everything will go to queue and that is causing us big problems. So, this is how we would kill our problems:
# = Project Collection, > = Team Project, | = VS project
# PRODUCT
> Core
| CoreProject
> Integrations
| IntegrationsProject ( makes use of CoreProject )
> Backoffice
| BackofficeProject ( makes use of CoreProject and IntegrationsProduct)
> WebSite
| WebsiteProject ( makes use of CoreProject and IntegrationsProduct)
What this would allow us:
- Diminish the amount of builds in the queue
- Create branches of Integrations, which would not be changed often
- Restrict access to Integrations and Core to specialized teams ( even if i know this can be done in other way )
Questions:
Is this the possible best solution for our requirements? If not, what
would it be?
Let's say, working in WebsiteProject solution and having projects from diferent team projects in that solution, is it possible to checkin does projects?
Thanks!
I suggest having one big team project, and just have 4 root folders in version control, and 4 build definitions that have the workspaces mapped to each of the 4 root folders. So long as you have the build workspaces mapped appropriately, checking in files to one folder, won't trigger the builds for the other folders.
This also allows you to set separate security permissions on each root folder should you wish.

TFS and shared projects in multiple solutions

Our .NET team works on projects for our company that fall into distinct categories. Some are internal web apps, some are external (publicly facing) web apps, we also have internal Windows applications for our corporate office users, and Windows Forms apps for our retail locations (stores). Of course, because we hate code reuse, we have a ton of code that is shared among the different applications. Currently we're using SVN as our source control, and we've got our repository laid out like this:
- = folder, | = Visual Studio Solution
-SVN
- Internet
| Ourcompany.com
| Oursecondcompany.com
- Intranet
| UniformOrdering website
| MessageCenter website
- Shared
| ErrorLoggingModule
| RegularExpressionGenerator
| Anti-Xss
| OrgChartModule etc...
So..
The OurCompany.com solution in the Internet folder would have a website project, and it would also include the ErrorLoggingModule, RegularExpressionGenerator, and Anti-Xss projects from the shared directory.
Similarly, our UniformOrdering website solution would have each of these projects included in the solution as well.
We prefer to have a project reference to a .dll reference because, first of all, if we need to add or fix a function in the ErrorLoggingModule while working on the OurCompany.com website, it's right there. Also, this allows us to build each solution and see if changes to shared code break any other applications. This should work well on a build server as well if I'm correct.
In SVN, there is no problem with this. SVN and Visual Studio aren't tied together in the way TFS's source control is. We never figured out how to work this type of structure in TFS when we were using it, because in TFS, the TFS project was always tied to a Visual Studio Solution. The Source Code repository was a child of the TFS Project, so if we wanted to do this, we had to duplicate the Shared code in each TFS project's source code repository. As my co-worker put it, this "breaks every known best practice about code reuse and simplicity". It was enough of a deal breaker for us that we switched to SVN.
Now, however, we're faced with truly fixing our development processes, and the Application Lifecycle Management of TFS is pretty close to exactly what we want, and how we want to work. Our one sticking point is the shared code issue.
We're evaluating other commercial and open source solutions, but since we're already paying for TFS with our MSDN Subscriptions, and TFS is pretty much exactly what we want, we'd REALLY like to find a way around this issue.
Has anybody else faced this and come up with a solution?
If you've seen an article or posting on this that you can share with me, that would help as well.
As always, I'm open to answers like "You're looking at it all wrong, bonehead, HERE'S the way it SHOULD be done.
I think there's some misunderstandings here. First, you can have multiple (as many as you want) solutions in a single TFS project. Also, a single Visual Studio project can have any number of solutions referring to it.
Second, what version of TFS are you using? 2010 is different from 2005/08 in how it handles TFS projects.
Under 2008, there are several ways to approach this depending on what you want to get out of it. You can either have multiple TFS projects or a single TFS project.
I'll start with multiple.
Set up a TFS project for your shared library type code, and others for each regular project you have. As part of the development process on this shared library, check in the completed assemblies. Then Branch those assemblies into any other TFS project you want to use them in. When you do a feature update or bug fix to the shared library, simply merge the branch into any other TFS project you want the updates to go into.
This allows you to make shared changes for a single app without having to push all of them.
If you want a single TFS project holding everything, just add folders for each Visual Studio project you want. The visual studio solutions can refer back to projects outside of their base tree without issue. Now, when configuring things like Builds for each solution, make sure you limit what directory the build server pulls from / watches. That way you don't have it building one of your internal sites when changes were made to an external site.
Only recording this in the hope that it helps someone else some day, I fear I'm a little too late to answer your original question ;)
We have a very similar situation, and your question (and subsequent answers) made it very easy for us to set up TFS properly.
To use your example to explain our setup:
# = Project Collection, > = Team Project, | = VS project
# SVN
> Internet
| OurCompany
| OurCompany2
> Intranet
| UniformOrdering
| MessageCentre
> Shared
| ErrorLogging
| RegularExpression
This means that work can be assigned (using Scrum templates in Sharepoint) to any of the Team Projects (which are SAAS apps in our case) and the developer can choose to open any or all of the VS Projects to get the job done.
The majority of the senior developers (those that are across multiple products) have one VS Solution (maybe "WholeEnterprise.sln" to continue the analogy) that contains ALL the different VS Projects and can therefore work on any/all of them at any one time. We can also ensure that projects build properly, and all the dependencies are up to date before pushing an update.
The structure of this in your operating system of choice is totally up to you! Some of us have replicated the structure of TFS, others have a totally flat hierarchy... This doesn't seem to make a difference at the end of the day.

Resources