Discussion:
Combining files from different projects into a new project?
Bo Berglund
2017-12-26 08:00:44 UTC
Permalink
I have just converted about 8 GB worth of CVS repositories (32800
files) into 9 svn repositories with a number of top level projects
each with its own set of trunk, tags and branches subfolders.

There are a number of "virtual" projects where the CVS "modules" was
used to compose a set of project unique files together with a
selection of common files from different directories into a module
that could be checked out and built.
In an earlier thread I asked about how I could simulate this in svn
and to use the "svn externals" system was adviced.

When I am now facing actually doing this I find that (unless I am
mistaken) the externals only reference whole directories, which is not
what I want. I need individual files from a couple of source
directories containing commonly used files in every such project.

Is it actually possible to do this in Subversion?

Say I have Common, PCommon and Library as top level directories on the
server repository. There are also ProjA, ProjB etc which hold project
unique files and folders.
In CVS there are modules definitions named ProjectA, ProjectB etc and
these use different selections of files from the Common, PCommon and
Library directories as well as all of the content of ProjA or ProjB
etc.

In the checkout of ProjectA there will be a structure of folders as
follows:
ProjectA
|-- Cmn (selection from /Common)
|-- Lib (selection from /Library)
|-- PCm (selection from /PCommon)
|-- Src (all of ProjA)

Do I now have to create new projects from scratch using files exported
from the various locations and copied into a new project structure to
be imported into svn again? This will effectively isolate the common
and library files from their sources and duplicate files into many
locations....
--
Bo Berglund
Developer in Sweden
Ryan Schmidt
2017-12-26 18:23:45 UTC
Permalink
Post by Bo Berglund
In an earlier thread I asked about how I could simulate this in svn
and to use the "svn externals" system was adviced.
When I am now facing actually doing this I find that (unless I am
mistaken) the externals only reference whole directories, which is not
what I want. I need individual files from a couple of source
directories containing commonly used files in every such project.
Is it actually possible to do this in Subversion?
Yes, file externals are possible in Subversion 1.6 and later.

http://svnbook.red-bean.com/en/1.7/svn.advanced.externals.html
Lorenz
2017-12-27 06:23:29 UTC
Permalink
Post by Ryan Schmidt
Post by Bo Berglund
In an earlier thread I asked about how I could simulate this in svn
and to use the "svn externals" system was adviced.
When I am now facing actually doing this I find that (unless I am
mistaken) the externals only reference whole directories, which is not
what I want. I need individual files from a couple of source
directories containing commonly used files in every such project.
Is it actually possible to do this in Subversion?
Yes, file externals are possible in Subversion 1.6 and later.
http://svnbook.red-bean.com/en/1.7/svn.advanced.externals.html
but not accross different repositories

from: http://svnbook.red-bean.com/en/1.7/svn.advanced.externals.html
Post by Ryan Schmidt
File externals cannot refer to files from other repositories. A file
external's URL must always be in the same repository as the URL that
the file external will be inserted into.
--
Lorenz
Bo Berglund
2017-12-27 10:18:19 UTC
Permalink
Post by Lorenz
Post by Ryan Schmidt
Post by Bo Berglund
In an earlier thread I asked about how I could simulate this in svn
and to use the "svn externals" system was adviced.
When I am now facing actually doing this I find that (unless I am
mistaken) the externals only reference whole directories, which is not
what I want. I need individual files from a couple of source
directories containing commonly used files in every such project.
Is it actually possible to do this in Subversion?
Yes, file externals are possible in Subversion 1.6 and later.
http://svnbook.red-bean.com/en/1.7/svn.advanced.externals.html
but not accross different repositories
from: http://svnbook.red-bean.com/en/1.7/svn.advanced.externals.html
Post by Ryan Schmidt
File externals cannot refer to files from other repositories. A file
external's URL must always be in the same repository as the URL that
the file external will be inserted into.
Does this mean thta I can forget about externals then?
I imported the CVS repositories by creating a master repository for
each existing CVS repository and then cvs2svn was set to import each
top level directory as a separate item. I am very confused about the
terminology used here since sometimes documentation exeplifies a
repository by a single project (like my top level CVS directories) and
sometimes it looks like they talk about "projects" within a single
repository.
Which limitation is there really in the externals case?

But then again, as I feared when reading the docs, it seems like an
external can only be a directory and not a file within a directory...

It seems impossible to check out a single file from a svn
repository...
--
Bo Berglund
Developer in Sweden
Bo Berglund
2017-12-27 09:54:36 UTC
Permalink
On Tue, 26 Dec 2017 12:23:45 -0600, Ryan Schmidt
Post by Ryan Schmidt
Post by Bo Berglund
In an earlier thread I asked about how I could simulate this in svn
and to use the "svn externals" system was adviced.
When I am now facing actually doing this I find that (unless I am
mistaken) the externals only reference whole directories, which is not
what I want. I need individual files from a couple of source
directories containing commonly used files in every such project.
Is it actually possible to do this in Subversion?
Yes, file externals are possible in Subversion 1.6 and later.
http://svnbook.red-bean.com/en/1.7/svn.advanced.externals.html
It seems like the externals have to be directories and not individual
files....
I tried to check out a file from svn but it failed miserably:

svn co https://server/svn/pc/project/trunk/file.pas src
svn: E200007: URL 'https://server/svn/pc/project/trunk/file.pas'
refers to a file, not a directory
--
Bo Berglund
Developer in Sweden
Branko Čibej
2017-12-27 11:41:59 UTC
Permalink
Post by Bo Berglund
On Tue, 26 Dec 2017 12:23:45 -0600, Ryan Schmidt
Post by Ryan Schmidt
Post by Bo Berglund
In an earlier thread I asked about how I could simulate this in svn
and to use the "svn externals" system was adviced.
When I am now facing actually doing this I find that (unless I am
mistaken) the externals only reference whole directories, which is not
what I want. I need individual files from a couple of source
directories containing commonly used files in every such project.
Is it actually possible to do this in Subversion?
Yes, file externals are possible in Subversion 1.6 and later.
http://svnbook.red-bean.com/en/1.7/svn.advanced.externals.html
It seems like the externals have to be directories and not individual
files....
You can only check out directories. Files in the same repository,
however, can be linked as externals.

You really should take time to read the book, since this the first time
you're using Subversion. Most of your questions are answered in detail
there.

-- Brane
Branko Čibej
2017-12-27 11:46:36 UTC
Permalink
Post by Branko Čibej
Post by Bo Berglund
On Tue, 26 Dec 2017 12:23:45 -0600, Ryan Schmidt
Post by Ryan Schmidt
Post by Bo Berglund
In an earlier thread I asked about how I could simulate this in svn
and to use the "svn externals" system was adviced.
When I am now facing actually doing this I find that (unless I am
mistaken) the externals only reference whole directories, which is not
what I want. I need individual files from a couple of source
directories containing commonly used files in every such project.
Is it actually possible to do this in Subversion?
Yes, file externals are possible in Subversion 1.6 and later.
http://svnbook.red-bean.com/en/1.7/svn.advanced.externals.html
It seems like the externals have to be directories and not individual
files....
You can only check out directories. Files in the same repository,
however, can be linked as externals.
You really should take time to read the book, since this the first time
you're using Subversion. Most of your questions are answered in detail
there.
Also, as a matter of best practice: with Subversion, it's generally
better to use one large repository than a number of small ones. And
instead of trying to replicate the structure you used with CVS, you
should think about structuring your data so that it fits Subversion's
model better. It takes a bit of getting used to but is definitely worth
it in the long run.

-- Brane
Bo Berglund
2017-12-27 12:23:31 UTC
Permalink
Post by Branko Čibej
Also, as a matter of best practice: with Subversion, it's generally
better to use one large repository than a number of small ones. And
instead of trying to replicate the structure you used with CVS, you
should think about structuring your data so that it fits Subversion's
model better. It takes a bit of getting used to but is definitely worth
it in the long run.
The reason we have CVS divided into several repositories is that we
use it for different departments to version all kinds of files.
Security mandades that we keep these isolated from each other.
Also if one has a monolitic respository there will be such a huge
amount of directories at the top level....

When moving to svn I have split one of the repositories in two to
separate code accessed by consultants from code and other sensitve
files only for our own employees.
--
Bo Berglund
Developer in Sweden
Daniel Shahaf
2017-12-27 22:58:10 UTC
Permalink
Post by Branko Čibej
You can only check out directories. Files in the same repository,
however, can be linked as externals.
The alternative to "checking out a file" is to checkout the directory at
--depth=empty and then pull just the one file. The externals definition
syntax however makes no provision for specifying depth at the time of
checkout of the parent working copy (I assume it can be effected later).
Post by Branko Čibej
You really should take time to read the book, since this the first time
you're using Subversion. Most of your questions are answered in detail
there.
That's good advice.
Bo Berglund
2017-12-27 23:34:21 UTC
Permalink
On Wed, 27 Dec 2017 22:58:10 +0000, Daniel Shahaf
Post by Daniel Shahaf
Post by Branko Čibej
You can only check out directories. Files in the same repository,
however, can be linked as externals.
The alternative to "checking out a file" is to checkout the directory at
--depth=empty and then pull just the one file. The externals definition
syntax however makes no provision for specifying depth at the time of
checkout of the parent working copy (I assume it can be effected later).
Well, I have now come to the conclusion that I have to re-do the
migration of the CVS repository where this is a problem (virtual CVS
modules are only used for the PC repo and then only for a number of
Windows projects).

And before cvs2svn is done I will manually create a couple of CommonXX
"projects" by copying a subset of the RCS files needed into new top
level directories, or possibly into subdirectories of the Common
module.
Then it should be possible to use these as the externals source in the
projects that need them.

So, I assume I can define an external target in a project as Common
and pointing it to Common/XX and another external as Lib and pointing
that to Common/YY?
Or do I have to put them into the root of the repository (single dir)?

This would duplicate the files in the repository (I have now counted
through all of them and it turns out they are 12 or possibly 15 in all
and they could be divided into two dirs. Both the source dirs hold
something like 40-50 files, which I don't want to clutter the projects
with but having one or two extra unneeded file in one or two projects
does not hurt much...

Since I want to get rid of the already imported pc repository on the
server (VisualSVN) so I can repeat the conversion and import of the
same but with slightly tweaked contents, what is the best way to do
it?
Notice that I don't want to version this "change", I want to
completely erase the existing repo "pc" and start over.
Post by Daniel Shahaf
Post by Branko Čibej
You really should take time to read the book, since this the first time
you're using Subversion. Most of your questions are answered in detail
there.
That's good advice.
Well, I *have* read parts of the book, but it is 458 pages....
And asking here directs me to further detailed reading. ;)
--
Bo Berglund
Developer in Sweden
Ryan Schmidt
2017-12-29 01:57:34 UTC
Permalink
Post by Bo Berglund
So, I assume I can define an external target in a project as Common
and pointing it to Common/XX and another external as Lib and pointing
that to Common/YY?
Or do I have to put them into the root of the repository (single dir)?
Subversion does not care what you put into your repository. You can put any files and directories into it in any arrangement that pleases you.
Post by Bo Berglund
Since I want to get rid of the already imported pc repository on the
server (VisualSVN) so I can repeat the conversion and import of the
same but with slightly tweaked contents, what is the best way to do
it?
Notice that I don't want to version this "change", I want to
completely erase the existing repo "pc" and start over.
You can simply erase the repo using your operating system's delete function. You don't need to tell the Subversion server about the repository deletion.
Continue reading on narkive:
Loading...