Is it normal that SVN external files are not committed?

Teno picture Teno · Oct 16, 2012 · Viewed 7.7k times · Source

I'm fairly new to Subversion and recently learned how to automatically import files which belong to other repositories using svn:externals. And now when I commit the trunk folder and create a tag to take a snapshot of the project, the files/folders defined as externals won't be added to the tag folder.

For example, I have this folder structure

Z:\repos\repoA

Z:\repos\repoB

Z:\Projects\workB

I have set svn:externals on Z:\Projects\workB to file:///Z:/repos/repoA/trunk/lib trunk/lib so that repoA's lib folder is automatically added to the current working directory, Z:\Projects\workB\trunk. And actually when I perform SVN Update, the lib folder is created under the trunk folder.

After editing some files and performing SVN Commit... on Z:\Projects\workB\trunk, I selected TortoiseSVN -> Branch/Tag from the context menu. In the To Path field, typed tags/1.0.1 and pressed OK. The 1.0.1 tag was successfully created.

After I performed SVN Update on Z:\Projects\workB\tags, a folder named 1.0.1 appeared but without external files.

Is this normal? I expected the imported files also would be there since they are in the trunk folder of the working directory.


I created two public repositories at Assembla for anyone to test this out.

The second repository has the externals definition which pulls down the lib folder from the first repository. When I create a tag of the current trunk files from the second repository, it does not add the external files to the tag folder. Also when I check out the tag folder, it won't add the external files to the local working copy.

Answer

Dunes picture Dunes · Oct 16, 2012

When you set the externals property it does not copy the files from the external repository to your working repository. Rather it just creates a "note" on where to fetch those files from in future.

Thus, when you create your tag svn doesn't bother to copy the actual files that are externally linked. Instead it just copies the "note". Were you to perform a checkout of your tags/1.0.1 directory (or an update if it is already locally checked out) then you would notice that it would correctly pull down the relevant externals even thought these files do not exist in the working repository.

edit:

Ah, I've finally seen the problem. You set your external in the root directory rather than in the trunk directory.

The best way to view svn is that it is just a filesystem, the whole idea of trunk, tags and branches are just conceptual ideas and each directory is no different to the next.

Thus, when you copy trunk over to the tags directory the external properties do not get transferred as they are not part of the trunk directory (they only says to put external items in trunk). To solve you should remove the external properties from the root directory and add them to trunk. Next time you create a tag the external properties should be transferred.

The following command:

svn propget svn:externals file:///Z:/Projects/workB/trunk

should output:

file:///Z:/repos/repoA/trunk/lib lib