Combining files from different projects into a new project?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Combining files from different projects into a new project?

Bo Berglund
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

Reply | Threaded
Open this post in threaded view
|

Re: Combining files from different projects into a new project?

Ryan Schmidt-8

On Dec 26, 2017, at 02:00, Bo Berglund wrote:

> 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

Reply | Threaded
Open this post in threaded view
|

Re: Combining files from different projects into a new project?

Lorenz-2
Ryan Schmidt wrote:

>On Dec 26, 2017, at 02:00, Bo Berglund wrote:
>
>> 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
>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

Reply | Threaded
Open this post in threaded view
|

Re: Combining files from different projects into a new project?

Bo Berglund
In reply to this post by Ryan Schmidt-8
On Tue, 26 Dec 2017 12:23:45 -0600, Ryan Schmidt
<[hidden email]> wrote:

>
>On Dec 26, 2017, at 02:00, Bo Berglund wrote:
>
>> 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

Reply | Threaded
Open this post in threaded view
|

Re: Combining files from different projects into a new project?

Bo Berglund
In reply to this post by Lorenz-2
On Wed, 27 Dec 2017 06:23:29 +0000, Lorenz <[hidden email]> wrote:

>Ryan Schmidt wrote:
>>On Dec 26, 2017, at 02:00, Bo Berglund wrote:
>>
>>> 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
>>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

Reply | Threaded
Open this post in threaded view
|

Re: Combining files from different projects into a new project?

Branko Čibej
In reply to this post by Bo Berglund
On 27.12.2017 10:54, Bo Berglund wrote:

> On Tue, 26 Dec 2017 12:23:45 -0600, Ryan Schmidt
> <[hidden email]> wrote:
>
>> On Dec 26, 2017, at 02:00, Bo Berglund wrote:
>>
>>> 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

Reply | Threaded
Open this post in threaded view
|

Re: Combining files from different projects into a new project?

Branko Čibej
On 27.12.2017 12:41, Branko Čibej wrote:

> On 27.12.2017 10:54, Bo Berglund wrote:
>> On Tue, 26 Dec 2017 12:23:45 -0600, Ryan Schmidt
>> <[hidden email]> wrote:
>>
>>> On Dec 26, 2017, at 02:00, Bo Berglund wrote:
>>>
>>>> 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
Reply | Threaded
Open this post in threaded view
|

Re: Combining files from different projects into a new project?

Bo Berglund
On Wed, 27 Dec 2017 12:46:36 +0100, Branko ?ibej <[hidden email]>
wrote:

>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

Reply | Threaded
Open this post in threaded view
|

Re: Combining files from different projects into a new project?

Daniel Shahaf-2
In reply to this post by Branko Čibej
Branko Čibej wrote on Wed, 27 Dec 2017 12:41 +0100:
> 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).

> 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.
Reply | Threaded
Open this post in threaded view
|

Re: Combining files from different projects into a new project?

Bo Berglund
On Wed, 27 Dec 2017 22:58:10 +0000, Daniel Shahaf
<[hidden email]> wrote:

>Branko ?ibej wrote on Wed, 27 Dec 2017 12:41 +0100:
>> 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.

>> 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

Reply | Threaded
Open this post in threaded view
|

Re: Combining files from different projects into a new project?

Ryan Schmidt-8

On Dec 27, 2017, at 17:34, Bo Berglund wrote:

> 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.


> 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.