Reputation: 40721
The following action will only create a branch from the head revision of the trunk. How do I create a branch from a specific revision? Thanks.
$ svn copy http://svn.example.com/repos/calc/trunk \
http://svn.example.com/repos/calc/branches/my-calc-branch \
-m "Creating a private branch of /calc/trunk."
Upvotes: 120
Views: 147929
Reputation: 31
Try below one:
svn copy http://svn.example.com/repos/calc/trunk@rev-no
http://svn.example.com/repos/calc/branches/my-calc-branch
-m "Creating a private branch of /calc/trunk." --parents
No slash "\" between the svn URLs.
Upvotes: 0
Reputation: 56948
Check out the help command:
svn help copy
-r [--revision] arg : ARG (some commands also take ARG1:ARG2 range)
A revision argument can be one of:
NUMBER revision number
'{' DATE '}' revision at start of the date
'HEAD' latest in repository
'BASE' base rev of item's working copy
'COMMITTED' last commit at or before BASE
'PREV' revision just before COMMITTED
To actually specify this on the command line using your example:
svn copy -r123 http://svn.example.com/repos/calc/trunk \
http://svn.example.com/repos/calc/branches/my-calc-branch
Where 123
would be the revision number in trunk you want to copy. As others have noted, you can also use the @ syntax. I prefer the clearer separation of the revision # from the URL, personally.
As noted in the help, you can replace a revision # with certain words as well:
svn copy -rPREV http://svn.example.com/repos/calc/trunk \
http://svn.example.com/repos/calc/branches/my-calc-branch
Would copy the "revision just before COMMITTED".
Upvotes: 167
Reputation: 18320
append the revision using an "@" character:
svn copy http://src@REV http://dev
Or, use the -r [--revision] command line argument.
Upvotes: 20
Reputation: 42018
$ svn copy http://svn.example.com/repos/calc/trunk@192 \
http://svn.example.com/repos/calc/branches/my-calc-branch \
-m "Creating a private branch of /calc/trunk."
Where 192 is the revision you specify
You can find this information from the SVN Book, specifically here on the page about svn copy
Upvotes: 37