views:

38

answers:

2

I know that people recommend that externals should always point to tags or be pinned to specific revisions (or both for the belts-and-braces brigade!). I'm comfortable with this approach when the external points to a unchanging or slowly changing dependency. However, sometimes I need to take an external on a rapidly changing dependency and then it is less effort (though riskier) to set the external to point to the trunk of the dependency.

What I would really like is an intermediate feature which I'm going to call a "tracking external". They way it should work is as follows:

a) If I checkout head, I get head of the external

b) If I check out revision X, I get revision X of the external

This would allow me to always recreate old revisions but also allow me to be exposed to the latest changes of the dependency.

This feature does not seem to exist in SVN, but it seems like an obvious feature to implement. Does anyone know if this feature exists or is planned, or if it can be emulated through some SVN trickery?

Thanks Akash

A: 

If you just use a branch in an external without specifying a particular revision than this external is floating which means every time you update it you will get the head of that branch...You can do the same in using the trunk. But before you going to release you have to pin that external to a particular state, best practice is to use a tag for this.

khmarbaise
Sorry, I've tidied up the formatting of my question to make it clearer what I'm looking for. I *don't* want a normal floating external, neither do I want a pinned one. I want one that gets me revision X of the external when I check out revision X of my code and gets revision Y of the external when I check out revision Y of my code.
Akash
+1  A: 

I think what your asking isn't the correct use of externals. You're doing it wrong.

Externals pull in code from...somewhere else. That 'somewhere else' could be a different location in your current repository, or it could be a different repository on your machine, or a repository hosted on a machine on the other side of the world...

Outside of some special situation where you keep your repository and the external(s) in revision-lockstep (which you could do if your externals are being pulled from a different location in the same repository,) wanting to checkout revision X of your repository along with same revision X in the external repository(ies) is going to end in failure.

How are can you ensure that the main repositories revisions stay in sync with the external repositories revisions? What is supposed to happen when your repository is at revision 1000, and the external'd repository is only at revision 300?

To actually take a stab at answering your question: I've no idea if anything like this is planned for future versions of SVN, but I would bet not. As far as 'trickery', you could perhaps accomplish this by creating some sort of wrapper-script that could modify the external properties to pin them at the revision your planning on checking out BEFORE you actually check out. Not something I would consider practical, nor entirely trivial.

Yoopergeek
Thanks, I should have specified that I'm pulling externals from the same repository. I completely agree that my use case is meaningless otherwise.Do you think that in this special case it is still an incorrect use of externals? It seems like a valid scenario to me.
Akash
I think your planned use it not the intended use of externals. Whether that equates to 'incorrect' is up to you. Personally, I would shy away from it. It becomes a crutch/special-case in your repository. If, in the future, for whatever reason, you need or want to piece-out the externals into different repositories, you'll have to change/stop-using your specialized external-pinning-scheme... Instead of changing your methodology now (a small 'pain') , you're potentially causing much greater grief/pain in the future.
Yoopergeek