问题
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
回答1:
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.
回答2:
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!
来源:https://stackoverflow.com/questions/22677891/initial-commit-of-major-projects-to-mercurial