简体   繁体   中英

SVN Externals, how to list on the Server and how to branch?

We are migrating to Subversion and are deciding how best to deal with shared objects. I am aware of Externals and are looking to use these. We maintain a number of database-oriented applications which make extensive use Oracle Packages. Sometimes the same functionality is required in multiple apps so we reuse an object from app1 in app2. Two questions arise, as below.

1/ If we start with a shared object, create in app1, saved into SVN in its repository structure and shared to app2 via an external. Can we at a later time branch this object in app2 and diverge? Will the history of the newly diverged object in app2 show its history back to and including its history as an external from app1?

EDIT: for clarification, after the branch app1.object != app2.object. So we have an object, we share it and some time later we wish to diverge the 2 objects. We would like to be able to follow the history of app2.object back to and including the time when it was a copy of app1.object

2/ Can we identify each end point of an external link? That is to say is there a utility that would tell me that app2, app5 and app6 all make use of object app1.object? I am aware of SVN List question but this works on the Working Copy, ideally I would like to be able to run something on the server that looks at the repository. I have in mind writing a user-accessible tool for identifying end points of each external for object 'X'.

So a very short response to #1 is, yes you can branch. However you'll need to modify the externals so that they use the new branch. So first you would branch the shared project (via svn copy), and then you would modify the external in app2 to point at the new branch. And yes, as long as the branching is done correctly all of your history will remain intact.

As for your second question, as far as I'm aware no such utility exists. If you need to find this out it would be simple enough to automate with a script. It would need to check out all potential projects, iterate through each one and inspect the externals. Using a dictionary you could keep track of which repositories are referred to by other repositories. Then a little formatting and bam! You're cooking with fire. Hope this helps.

  1. Don't sure I understand the question. In your case app2 just reference to app1. You can not branch app1 in context of app2 - app1 is not controlled by svn in app2 tree, its merely checkout in app2 tree to construct desired directory structure according to your requirements (.eg for building app2 etc.)

  2. When you use svn:externals, it's good practice to indicate revision number of external resource (see here ). For example:

    third-party/skins/toolkit -r21 http://svn.example.com/skin-maker

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM