You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Bo Berglund <bo...@gmail.com> on 2018/05/18 07:31:07 UTC

How to create source dir for externals files?

Problem:
--------
I have to modify an old application which was versioned at the time
using CVS. Its last release was back in 2013.

Migration to SVN:
-----------------
At the start of 2018 I migrated the CVS repository using cvs2svn so I
have all of the files available in svn.

CVS vs. SVN handling differences:
---------------------------------
But in CVS the project checkout is not using a CVS folder as source
but rather a "virtual module" defined in the CVSROOT/modules file. It
turns out that this project in particular has used 3 different virtual
folders embedded in the source tree but originating from three
different physical folders in CVS.

Using externals in SVN:
-----------------------
When migrating the CVS repository to SVN I had similar problems with
some applications still in active development and what I did was this:
I created a few subfolders below the source folders and copied in the
files needed into these. This was done on the repository files before
conversion.
Then I did the cvs2svn conversion and following that I created
externals in the projects that needed these files such that they would
be checked out with the project. This has worked fine so far.

Creating source folders for externals:
--------------------------------------
But for the application now in need of further work I did not do
anything like that and now I need to do it but inside of SVN so I can
get the same project functionality for these sources...

Question:
---------
Is it possible in svn to create subfolders in a main folder which
contains a *selection* of files from the main folder?
I want these files to be in the state they were in at an earlier date
than today because they have been changed from what they were at the
time and I need to get them as they were when a specific branch was
created (in CVS). I am looking at the state on say 2013-11-01.

If it is possible then what svn command is needed for the operation?

I am on svn 1.9.7 both on the server and client sides.
Both run on Windows, server is Windows Server 2016 and client is Win7.

I use the command line svn client rather than Tortoise or other GUI
tools.

Any advice welcome.


-- 
Bo Berglund
Developer in Sweden


Re: How to create source dir for externals files?

Posted by Bo Berglund <bo...@gmail.com>.
On Fri, 18 May 2018 12:30:22 +0200, Bo Berglund
<bo...@gmail.com> wrote:

>Of course I now have the option of just svn add-ing the two dirs in
>the wc and be done. But I feel that this is probably not the right
>thing to do, or just maybe it is....
>These common files are not supposed to change anyway...

On further thinking I might as well just add the two dirs to the
project in the state the files are in at the moment (all those years
ago). After all it is not actively developed anymore, just maintained
with small changes.

Thanks to Nico Kadel-Garcia who pointed it out in a private response!


-- 
Bo Berglund
Developer in Sweden


Re: How to create source dir for externals files?

Posted by Bo Berglund <bo...@gmail.com>.
On Fri, 18 May 2018 10:01:42 +0200, Johan Corveleyn
<jc...@gmail.com> wrote:

>I'm not entirely sure I fully understand what you need. But here are
>some things that may help you:

Thank you for your suggestions!
What I need is to get a couple of folders in the project populated
with some "common" files through the use of the svn externals system.
But to do that I have to create a subdirectory inside the source
"common" directory just containing the common files needed by the
project. And since these files have evolved since the project in
question was originally worked on I want the files in the state they
were in at that time.

Once that is done (on the server side) I can then in the working copy
of the project define the external as usual targeting the
common/selectedfiles folder in the server.

Meanwhile I have checked out the old project on a branch from the time
of last release, but of course I did not get the needed extra
directories. So I found an old CVS working copy from that time and
copied over the two folders into the new SVN working copy (removing
the CVS subdirs in the process).
Then I checked that the project built properly and it did.

Of course I now have the option of just svn add-ing the two dirs in
the wc and be done. But I feel that this is probably not the right
thing to do, or just maybe it is....
These common files are not supposed to change anyway...

-- 
Bo Berglund
Developer in Sweden


Re: How to create source dir for externals files?

Posted by Johan Corveleyn <jc...@gmail.com>.
On Fri, May 18, 2018 at 9:31 AM, Bo Berglund <bo...@gmail.com> wrote:
> Problem:
> --------
> I have to modify an old application which was versioned at the time
> using CVS. Its last release was back in 2013.
>
> Migration to SVN:
> -----------------
> At the start of 2018 I migrated the CVS repository using cvs2svn so I
> have all of the files available in svn.
>
> CVS vs. SVN handling differences:
> ---------------------------------
> But in CVS the project checkout is not using a CVS folder as source
> but rather a "virtual module" defined in the CVSROOT/modules file. It
> turns out that this project in particular has used 3 different virtual
> folders embedded in the source tree but originating from three
> different physical folders in CVS.
>
> Using externals in SVN:
> -----------------------
> When migrating the CVS repository to SVN I had similar problems with
> some applications still in active development and what I did was this:
> I created a few subfolders below the source folders and copied in the
> files needed into these. This was done on the repository files before
> conversion.
> Then I did the cvs2svn conversion and following that I created
> externals in the projects that needed these files such that they would
> be checked out with the project. This has worked fine so far.
>
> Creating source folders for externals:
> --------------------------------------
> But for the application now in need of further work I did not do
> anything like that and now I need to do it but inside of SVN so I can
> get the same project functionality for these sources...
>
> Question:
> ---------
> Is it possible in svn to create subfolders in a main folder which
> contains a *selection* of files from the main folder?
> I want these files to be in the state they were in at an earlier date
> than today because they have been changed from what they were at the
> time and I need to get them as they were when a specific branch was
> created (in CVS). I am looking at the state on say 2013-11-01.
>
> If it is possible then what svn command is needed for the operation?
>
> I am on svn 1.9.7 both on the server and client sides.
> Both run on Windows, server is Windows Server 2016 and client is Win7.
>
> I use the command line svn client rather than Tortoise or other GUI
> tools.
>
> Any advice welcome.

I'm not entirely sure I fully understand what you need. But here are
some things that may help you:

- Of course you can create subfolders wherever you want in an svn
repository (important thing to realise about Subversion: it does not
attach any special meaning to any folders, not even to "/trunk" or
"/tags". For the Subversion system (both client and server) those are
all just folders in a directory structure).

- You can copy files from anywhere in your directory structure to
another part. The source of a copy can also be an older revision of a
file. So you can do a "historical copy" if you will. The operation to
copy something from a previous point in history is (assuming you're in
a working copy where you want the file to be copied to):

    svn copy $URL/path/to/file@OLDREV .

This will put the 'file' in your current working directory, with
contents as they were in OLDREV (and with svn metadata of "copied from
.../file@OLDREV").
The nice thing about copying a file in this way (with 'svn copy' from
a historical URL) is that the line of history is preserved (due to the
"copied from" metadata). So if you 'svn log' that file, you'll still
see all of the old history too.

This technique is explained a bit more in "the book", in this chapter:
    http://svnbook.red-bean.com/nightly/en/svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.resurrect

- As far as externals are concerned, here too you can create external
definitions that refer to older revisions of files, by adding a peg
revision or operative revision to the externals definition. See:
    http://svnbook.red-bean.com/nightly/en/svn.advanced.externals.html
and you might also need to take a look at more explanation about "peg
revisions vs. operative revisions":
    http://svnbook.red-bean.com/nightly/en/svn.advanced.pegrevs.html

-- 
Johan