tags:

views:

120

answers:

4

How to make tags for multiple projects within one revision?
For example, if it needs to tag with the same name:

svn copy svn://localhost/BigProject/Project1/trunk svn://localhost/BigProject/Project1/tags/1.0.0 --message "1.0.0"
svn copy svn://localhost/BigProject/Project2/trunk svn://localhost/BigProject/Project2/tags/1.0.0 --message "1.0.0"
...
svn copy svn://localhost/BigProject/ProjectX/trunk svn://localhost/BigProject/ProjectX/tags/1.0.0 --message "1.0.0"

But that snippet makes X revisions. So, how to make just one revision or how to integrate all in one?
Another question is, how to commit similar modifications within one revision?
TIA

Edition for better understanding reasons:

  • Tag revision number is used in the versions of the projects. So, in that case above, all projects have different versions with the same tag.
  • Different version is needed only when specific modification was done just for one project. It is forcing to add fourth octet to the version number.
  • Yearning to reduce repeated X times log messages for entire BigProject.
A: 

My feeling is that this is not possible. And to be honest, I don't see why it should. What are you trying to achieve (besides having N tags created in the same revision)? Or phrased differently: why would you need this? The idea of tags (to a certain extent) being to free you from remembering revision numbers and allowing you to "put together" mixed revisions I think does indicate that you do not need to achieve what you are trying.

To get "Tag 1.0.0" you would then just checkout Project1..N/tags/1.0.0 and don't worry about revision numbers.

On the other hand: you could create one tag for all Projects. That would give you one revision number for it. For this to work you first would have to create a (local) working copy in the form you want your tag to be. And then tag this. But I am not sure if this is what you want...

Unfortunately I do not quite understand the second question. What do you mean by similar modifications? Similar to each other or similar to the first question?

scherand
@scherand I mean similar modifications to all projects, like refactorings. And see my edit for understanding reasons.
cubanacan
+1  A: 

svn help says:

usage: copy SRC[@REV]... DST                                             

When copying multiple sources, they will be added as children of DST,
which must be a directory.                                           

  SRC and DST can each be either a working copy (WC) path or URL:
    WC  -> WC:   copy and schedule for addition (with history)
    WC  -> URL:  immediately commit a copy of WC to URL
    URL -> WC:   check out URL into WC, schedule for addition
    URL -> URL:  complete server-side copy;  used to branch and tag
  All the SRCs must be of the same type.

You could try WC -> WC copying and then commit.


Edit:
WC/dir WC/dir2 -> URL seems to be working too Thus you'll have only trunk to checkout.

svn copy dir1 dir2 https://mysvnserver/svn/dy_test/tags/1.0.0 -m "tag 1.0.0."


Edit2: added --parents : make intermediate directories

svn copy --parents dir1 dir2 https://mysvnserver/svn/dy_test/tags/1.0.0 -m "tag 1.0.0."
Dmitry Yudakov
Yes, it could be done that way, but it needs to checkout overall BigProject with all tags and branches.
cubanacan
@cubanacan See my edit, maybe this will work for you
Dmitry Yudakov
@Dmitry Yudakov I have done your advice (svn copy Project1/trunk Project2/trunk svn://localhost/BigProject/tags/1.0.0 -m "tag 1.0.0.") and get (svn: Cannot commit both 'Project1\trunk' and 'Project2\trunk' as they refer to the same URL)
cubanacan
It worked for me, I think you problem is somewhere else, google have plenty of hints for this error
Dmitry Yudakov
@Dmitry Yudakov Can you give me some more details about how it works for you.
cubanacan
I have the trunk of my project, then I copy 2 of its directories to a tag. I noticed that it gives error `'/svn/dy_test/tags/1.0.0' path not found` if 1.0.0 doesn't exist, so I added `--parents` option. It works this way.
Dmitry Yudakov
Your problem seems different, it's like you've copied Project1 to Project2 along with `.svn` directory and then try to copy it them both do a tag. That's what "they refer to the same URL" error could mean.
Dmitry Yudakov
@Dmitry Yudakov Thanks for details, I've found my mistake. Look at my posted answer, I've tried to do your advice on that new structure of WC `svn copy --parents Project1 Project2 svn://localhost/BigProject/tags/1.0.0 -m "1.0.0"`, but now svn said `svn: 'Project1' is not under version control`, and at the same time if I do `svn copy --parents Project1 Project1 svn://localhost/BigProject/tags/1.0.0 -m "1.0.0"` svn said OK.
cubanacan
@Dmitry Yudakov Can you give me any suggestions on previous comment?
cubanacan
I can't explain it. Does `svn info Project1` gives correct information or returns an error? Are you trying with clean Working Copy of your BigProject?
Dmitry Yudakov
@Dmitry Yudakov `svn info Project1` gives correct information, also I was trying with cleaning up, but get the same effect. It looks like an svn bug.
cubanacan
+1  A: 

I don't believe you can do what you want, at least not in one revision. This is a side effect of your setup, which does branching at the project level, instead of at the BigProject level. You won't be able to just create one release tag for the whole thing that way. I am guessing, though, that what you really care about is an easy way to bundle all your projects together, not that it is a single revision.

Here's what I suggest:

First do what you've already shown above (a bunch of SVN Copy commands) to create your 1.0.0 tags on all of your projects. Then create an area of your choosing (BigProject/tags may not make senss, given the layout you've already got - just pick a location.)

I'll go with svn://localhost/Releases/BigProject/ for my own purposes, since you may want it to be distinct from the 'BigProject' folder heirarchy, otherwise I'd just pick /BigProject/tags.

Within that, create a folder with the name of the tag you are using, 1.0.0.

Now you have:

svn://localhost/Releases/BigProject/1.0.0

Checkout that folder. Add an svn property, svn:externals, with the content:

svn://localhost/BigProject/Project1/tags/1.0.0
svn://localhost/BigProject/Project2/tags/1.0.0
svn://localhost/BigProject/ProjectX/tags/1.0.0

Now you can checkout svn://localhost/Releases/BigProject/1.0.0 to have all of your projects at the 1.0.0 tag.

Joshua McKinnon
@Joshua McKinnon It seems you missed a relative directory path after URLs in the content of `svn:externals`.
cubanacan
@Joshua McKinnon Oh, thanks for useful svn property, which could solve one of questions.
cubanacan
@cubanacan my syntax was probably not perfact, since I was going from memory, and paths might be a bit off. I'm glad the externals thing itself was useful, though
Joshua McKinnon
A: 

Based on post by Joshua McKinnon, I have found solution for my second question (about committing within one revision):

  1. Create a folder, for example trunk.
  2. Checkout that folder from svn://localhost/BigProject/trunk.
  3. Add an svn property, svn:externals, with the content:

    svn://localhost/BigProject/Project1/trunk Project1
    svn://localhost/BigProject/Project2/trunk Project2
    ...
    svn://localhost/BigProject/ProjectX/trunk ProjectX
    
  4. Update trunk to have all trunks of your projects in the same working copy.

  5. Now, the bundle with similar modifications could be committed within same revision to all projects.

Edition for solution to the first question (tagging within one revision).

I researched many approaches and simplest solution seems to be the restructuring of the repo:

BigProject
    tags
    trunk
        Project1
            branches
            trunk
        Project2
            branches
            trunk
        ProjectX
            branches
            trunk

And now could be used just simple svn copy line:

svn copy svn://localhost/BigProject/trunk svn://localhost/BigProject/tags/1.0.0
cubanacan