There are several similar questions but i couldnt find any close enough not to warrent a fresh question.
We have a mercurial controlled vs2010 solution comprising 40+ projects.
We also have a contractor working remotely on a portion of one of the projects, a Labview FPGA+RT+DotNetAssembly.I would ideally like to put his code into "ContractorsSVNRepo" (see below) of our Mercurial repo, and when i want an update i download his svn repo, if im happy with it then commit to our mercurial repo.
I have access to his svn repo for his portion of the project, however he doesnt have access to our Mercur开发者_开发百科ial repo for Security/IP reasons. And since im not that familiar with mercurial i dont even know if its possible to give him access only to only one folder of a repo so this is what i had come up with.
Will this work? can it be done? do i just create an svn repo in the target folder, download it and then only add the files i want in mercurial to our repo? will the two scc systems get in a twist/play well together? I would just try it and see what happens but im not that familiar with mercurial yet and dont want to risk wrecking our mercurial repo and not be able to recover it quickly.
OurAppsMercurialRepo
Proj1
Proj2
Proj3
Proj3Folder1
Proj3Folder2
Proj3Folder3
ContractorsSVNRepo
...
Proj40
Edit 1:
I dont think i've done this right as Pulling changes from another machine only pulls the .hgsub file, it doesnt pull the svn repo (or from what i can tell, even try as ive not been asked for or added any login details yet).i did this on my machine:
HG init ContractorsSVNRepo Created .hgsub with "ContractorsSVNRepo = [svn]https://ContractorsRepo.com/svn/trunk" in it HG add .hgsub svn co https://ContractorsRepo.com/svn/trunk ContractorsSVNRepo HG status HG commit -m "Subrepositories added"However, when i pull on another machine all it does it pull the .hgsub file. the docs linked suggest that doing a pull on the main repo will pull both repos, but its only pulling the mercurial one? am i missing something from these steps?
Edit2:
Inside OurAppsMercurialRepo:
svn co http://svn.contractor.com/svn/proj4other/trunk Proj3/ContractorsSVNRepoPut the following inside .hgsub file directly inside OurAppsMercurialRepo:
Proj3/ContractorsSVNRepo = [svn]http://svn.contractor.com/svn/proj4other/trunkFrom now, when you commit OurAppsMercurialRepo, the revision of the subversion checkout at the time of the commit is stored in mercurial
Thanks for the reply however this didnt change anything im afraid, it still doesnt download/update the svn source on pulling the main repo and i now get an error with my path name
"Abort: path contains illegal component: ". I suspect this is because our path names have "." in them so im going to give up and create a seperate svn repo and copy the files i want into mercurial manually. it wont fail, it wont cause other developers a headache and i dont waste any more time on this.Yes Possible. See mercurial Subrepos -> https://www.mercurial-scm.org/wiki/Subrepository
Inside OurAppsMercurialRepo
:
svn co http://svn.contractor.com/svn/proj4other/trunk Proj3/ContractorsSVNRepo
Put the following inside .hgsub
file directly inside OurAppsMercurialRepo
:
Proj3/ContractorsSVNRepo = [svn]http://svn.contractor.com/svn/proj4other/trunk
From now, when you commit OurAppsMercurialRepo
, the revision of the subversion checkout at the time of the commit is stored in mercurial. E.g. your locally used ContractorsSVNRepo
is not forced to be their latest.
If you fear that they remove the subversion repository after some time, you can first make a cron/scheduled task that pull->convert the svn repo every night/hour/5 minutes. The magic point here is HgSubversion that can convert a Subversion repository in a mercurial one and keep the mapping inbetween. Then you use the mercurial repository as a subrepo as above:
After installing HgSubversion, convert the subversion repository to a mercurial one:
hg clone -U http://svn.contractor.com/svn/proj4other proj4otherconverted
(I removed the trunk
part at the end as HgSubversion can also convert branches and tags)
Then schedule this command inside the proj4otherconverted
directory:
hg pull
Inside OurAppsMercurialRepo
make directory Proj3
then:
hg clone http://hg.yourcompany.com/hg/proj4otherconverted Proj3/ContractorsSVNRepo
Put the following inside .hgsub
file directly inside OurAppsMercurialRepo
:
Proj3/ContractorsSVNRepo = http://hg.yourcompany.com/hg/proj4otherconverted
精彩评论