Jump to content

Is this SVN set up properly? I don't think I'm in Trunk.


Go to solution Solved by kicken,

Recommended Posts

How do I tell? I have it set up and I'm able to check out and check in, everything seems to work great, now I want to create some tags so I can deploy to production but I'm pretty sure I'm in the base folder and not in any sort of trunk folder. When I go into my local folder on my desktop I have the trunk, tags and branches folders in there, that doesn't seem right. I only have one project set up on the server and will only need this one. 

 

I'm using this custom script to serve it at boot:

https://help.ubuntu.com/community/Subversion

 

Specifically this: 

# svnserve - Subversion server
#

description     "Subversion server"

start on (local-filesystems and net-device-up IFACE=lo and started udev-finish)
stop on runlevel [06]

chdir /home/svn

respawn

respawn limit 2 3600

exec /usr/bin/svnserve --foreground --daemon --config-file /etc/svnserve.conf --root /usr/local/svn/

Under /usr/local/svn I have a folder named "repositories" and inside there I have my single project folder. Inside that I have my trunk, tags and branches folders.

 

When I checked out my project I used svn://development.xxxxxxxx.com

 

Should I move something to be working out of trunk instead? This is what I would like to have.

Under /usr/local/svn I have a folder named "repositories" and inside there I have my single project folder. Inside that I have my trunk, tags and branches folders.

If I'm understanding you correctly then no, what you have setup does not sound correct. I've never used svnserve (I serve via apache) but from what it sounds like the -r parameter should point to a folder which contains a bunch of repositories. Each repository needs to be initialized via svnadmin create.

 

So for example you should have within /var/local/svn a single folder for your project, say my-super-project. After you create that folder you'd cd into it and initialize it with svnadmin create .

 

After it's initialized it should look something like:

kicken@web1:~/svn/my-super-project$ ls -l
total 24
drwxrwxr-x 2 kicken kicken 4096 Dec 19 17:20 conf
drwxrwsr-x 6 kicken kicken 4096 Dec 19 17:20 db
-r--r--r-- 1 kicken kicken    2 Dec 19 17:20 format
drwxrwxr-x 2 kicken kicken 4096 Dec 19 17:20 hooks
drwxrwxr-x 2 kicken kicken 4096 Dec 19 17:20 locks
-rw-rw-r-- 1 kicken kicken  246 Dec 19 17:20 README.txt
Checkout that repository into another folder somewhere.

kicken@web1:~/svn-wc$ svn co svn://localhost/my-super-project
Checked out revision 0.
kicken@web1:~/svn-wc$ ls -l
total 4
drwxrwxr-x 3 kicken kicken 4096 Dec 19 17:23 my-super-project
Setup your trunk/tags/branches structure by adding it to the working copy you just checked out.

kicken@web1:~/svn-wc/my-super-project$ svn mkdir branches tags trunk
A         branches
A         tags
A         trunk
If you want you could also add your initial project files to trunk at this point or any other directories you want.

 

Then commit the first revision.

kicken@web1:~/svn-wc/my-super-project$ svn commit -m "Initial setup"
Adding         branches
Adding         tags
Adding         trunk
Committing transaction...
Committed revision 1.
Edited by kicken

If I'm understanding you correctly then no, what you have setup does not sound correct. I've never used svnserve (I serve via apache) but from what it sounds like the -r parameter should point to a folder which contains a bunch of repositories. Each repository needs to be initialized via svnadmin create.

 

So for example you should have within /var/local/svn a single folder for your project, say my-super-project. After you create that folder you'd cd into it and initialize it with svnadmin create .

 

After it's initialized it should look something like:

kicken@web1:~/svn/my-super-project$ ls -l
total 24
drwxrwxr-x 2 kicken kicken 4096 Dec 19 17:20 conf
drwxrwsr-x 6 kicken kicken 4096 Dec 19 17:20 db
-r--r--r-- 1 kicken kicken    2 Dec 19 17:20 format
drwxrwxr-x 2 kicken kicken 4096 Dec 19 17:20 hooks
drwxrwxr-x 2 kicken kicken 4096 Dec 19 17:20 locks
-rw-rw-r-- 1 kicken kicken  246 Dec 19 17:20 README.txt
Checkout that repository into another folder somewhere.

kicken@web1:~/svn-wc$ svn co svn://localhost/my-super-project
Checked out revision 0.
kicken@web1:~/svn-wc$ ls -l
total 4
drwxrwxr-x 3 kicken kicken 4096 Dec 19 17:23 my-super-project
Setup your trunk/tags/branches structure by adding it to the working copy you just checked out.

kicken@web1:~/svn-wc/my-super-project$ svn mkdir branches tags trunk
A         branches
A         tags
A         trunk
If you want you could also add your initial project files to trunk at this point or any other directories you want.

 

Then commit the first revision.

kicken@web1:~/svn-wc/my-super-project$ svn commit -m "Initial setup"
Adding         branches
Adding         tags
Adding         trunk
Committing transaction...
Committed revision 1.

 

Yes, I've already used svnadmin to create the directories and they already have that structure, the structure on my server is in /usr/local/svn/repositories/project/

 

How do I tell if I have checked out the correct folder? Right now everything is working and I'm on revision 11 I think. I just don't know if I'm working in the correct folder.

Running svn info in your working copy will tell you what you checked out. svn ls ^/ (use ^^/ if your in a windows command prompt) will list the root of that repository so you can see what it contains. If you do not see your trunk / tags / branches folders in the root then you goofed something up.

 

Based on your description I suspect you might have created trunk, tags, and branches as separate repositories.

Edited by kicken

Running svn info in your working copy will tell you what you checked out. svn ls ^/ (use ^^/ if your in a windows command prompt) will list the root of that repository so you can see what it contains. If you do not see your trunk / tags / branches folders in the root then you goofed something up.

 

Based on your description I suspect you might have created trunk, tags, and branches as separate repositories.

 

Oh cool, here's what I got:

 

 

daniel@daniel:~/NetBeansProjects/development.xxxx.com$ svn info

Path: .
Working Copy Root Path: /home/daniel/NetBeansProjects/development.xxxx.com
URL: svn://development.xxxx.com
Relative URL: ^/
Repository Root: svn://development.xxxx.com
Repository UUID: 1c66111f-7632-4e47-97ff-b76c4ce8172a
Revision: 0
Node Kind: directory
Schedule: normal
Last Changed Rev: 0
Last Changed Date: 2016-11-22 11:20:37 -0700 (Tue, 22 Nov 2016)
 

 

 

daniel@daniel:~/NetBeansProjects/development.xxxx.com$ svn ls ^/

addFile.php
addUser.php
alertmanagement.php
branches/
contract.php
controller/
css/
dashboard.php
details.php
dollars_per_truck.php
elements/
favicon.ico
filemanagement.php
finishQuote.php
finishedbuildings.php
fonts/
fullquote.php
fullsoldbuilding.php
get.php
getDebug.php
getPurchaseOrder.php
getQuote.php
get_purchase_order_details.php
getmaterials.php
getuser.php
home.php
images/
img/
inc/
includes/
index.php
insertQuote.php
javascript/
jquery.mb.extruder.jquery.json
login_check.php
logout.php
lumber.php
material_management.php
materialsmarkup.php
model/
modules/
nav.php
options.php
orderQuote.php
parts/
pdf/
pdf-loader.php
phpinfo.php
posts.php
price-grouping.php
priceMatch.php
printPurchaseOrder.php
printQuote.php
product-details.php
products.php
quote-functions.php
quote-header.php
quote.php
quotedetails.php
quotedetails_conflict-20161031-151509.php
quotes.php
rates.php
refine-search.php
reports.php
review-management.php
robots.txt
savePurchaseOrder.php
sendLightboxMessage.php
slider-old/
soldbuildings.php
tags/
test.html
test.php
trunk/
trusses.php
updateassigned.php
uploads/
usermanagement.php
view/
 

 

Did I check out the correct directory? Am I using the trunk like I should be?

All your files are in the root beside your trunk, tags, and branches directory. You need to move them from the root into the trunk. After you've moved everything and committed the change svn ls ^/ should only show trunk, tags, and branches directories.

 

kicken@web1:~/svn-wc/my-super-project$ svn ls ^/
branches/
tags/
trunk/
Rename your current working copy to something else as a backup then re-checkout the repository but specify the trunk in the url.

kicken@web1:~/svn-wc$ svn co svn://localhost/my-super-project/trunk my-super-project

daniel@daniel:~/NetBeansProjects/development.xxxx.com$ svn info

Revision: 0

Last Changed Rev: 0

Last Changed Date: 2016-11-22 11:20:37 -0700 (Tue, 22 Nov 2016)

That seems incorrect. That implies that you've made no revisions since creating your repository, but you claim above to be on revision 11. The root directory should always be on the most recent revision.

That seems incorrect. That implies that you've made no revisions since creating your repository, but you claim above to be on revision 11. The root directory should always be on the most recent revision.

 I'm definitely using it:

daniel@daniel:~/NetBeansProjects/development.xxxx.com$ svn commit -m "test"
Sending        css/quote.css
Transmitting file data .done
Committing transaction...
Committed revision 15.

Should I still move the files? Do I have something else wrong?

Should I still move the files? Do I have something else wrong?

Yea, if it lets you commit fine then go ahead and get things organized.

 

I'm not sure why it shows as revision 0 when you do an info check. You can try doing an info check against the URL and see if that is any different:

svn info svn://development.xxxx.com
Or ask for the log and ensure it shows all your history:

svn log svn://development.xxxx.com
What's the structure of the files and folders under /usr/local/svn/ like? Post the output of some ls -l commands (or tree if you have it).

What's the structure of the files and folders under /usr/local/svn/ like? Post the output of some ls -l commands (or tree if you have it).

 

Last login: Mon Dec 19 20:53:34 2016 from 68.145.xxx.xx
integrity@integrity-server:~$ cd /usr/local/svn
integrity@integrity-server:/usr/local/svn$ ls -l
total 8
-rw------- 1 root root   31 Nov 22 11:22 passwd-team
drwxrwsr-x 3 root svn  4096 Nov 22 11:20 repositories
integrity@integrity-server:/usr/local/svn$ cd repositories/
integrity@integrity-server:/usr/local/svn/repositories$ ls -l
total 4
drwxrwsr-x 9 integrity svn 4096 Nov 23 10:42 development.xxxx.com
integrity@integrity-server:/usr/local/svn/repositories$ cd development.xxxx.com/
integrity@integrity-server:/usr/local/svn/repositories/development.xxxx.com$ ls -l
total 36
drwxrwsr-x 2 integrity svn 4096 Nov 23 10:42 branches
drwxrwsr-x 2 integrity svn 4096 Nov 22 14:51 conf
drwxrwsr-x 6 integrity svn 4096 Dec 20 09:51 db
-r--r--r-- 1 integrity svn    2 Nov 22 11:20 format
drwxrwsr-x 2 integrity svn 4096 Nov 22 11:20 hooks
drwxrwsr-x 2 integrity svn 4096 Nov 22 11:20 locks
-rw-rw-r-- 1 integrity svn  246 Nov 22 11:20 README.txt
drwxrwsr-x 2 integrity svn 4096 Nov 23 10:42 tags
drwxrwsr-x 2 integrity svn 4096 Nov 23 10:42 trunk

Edited by DeX

In addition to my last post:

daniel@daniel:~/NetBeansProjects/development.xxxx.com$ svn info svn://development.xxxx.com
Path: .
URL: svn://development.xxxx.com
Relative URL: ^/
Repository Root: svn://development.xxxx.com
Repository UUID: 1c66111f-7632-4e47-97ff-b76c4ce8172a
Revision: 16
Node Kind: directory
Last Changed Author: dan
Last Changed Rev: 16
Last Changed Date: 2016-12-20 12:53:55 -0700 (Tue, 20 Dec 2016)

Also I want to be sure I'm moving these files properly. Is this correct?

 

1. "svn cp" all local files into the trunk directory (except trunk and tags)

2. "svn commit" the change

3. rename my current working copy - how?

4. check out the files again in the same directory but specify the trunk

 

This way the files will still be in the same directory but they'll be checked into / out of the trunk folder on the server.

  • Solution

Use svn move to move the files. Eg:

svn move addFile.php addUser.php alertmanagement.php ... trunk/
After the commit just rename your working copy folder to move it out of the way so you can check out a new copy.

daniel@daniel:~/NetBeansProjects$ mv development.xxxx.com development.xxxx.com-old
daniel@daniel:~/NetBeansProjects$ svn co svn://development.xxxx.com/trunk development.xxxx.com

Use svn move to move the files. Eg:

svn move addFile.php addUser.php alertmanagement.php ... trunk/
After the commit just rename your working copy folder to move it out of the way so you can check out a new copy.

daniel@daniel:~/NetBeansProjects$ mv development.xxxx.com development.xxxx.com-old
daniel@daniel:~/NetBeansProjects$ svn co svn://development.xxxx.com/trunk development.xxxx.com

 

Thanks, I did it! How can we confirm if it worked?

daniel@daniel:~/NetBeansProjects/development.xxxx.com$ svn info
Path: .
Working Copy Root Path: /home/daniel/NetBeansProjects/development.xxxx.com
URL: svn://development.xxxx.com/trunk
Relative URL: ^/trunk
Repository Root: svn://development.xxxx.com
Repository UUID: 1c66111f-7632-4e47-97ff-b76c4ce8172a
Revision: 20
Node Kind: directory
Schedule: normal
Last Changed Author: dan
Last Changed Rev: 20
Last Changed Date: 2016-12-20 15:39:58 -0700 (Tue, 20 Dec 2016)
Edited by DeX

svn ls ^/
Should show only your branches, tags, and trunk directories.

 

Then to make a tag something you copy it to the tags directory under a new name, for example:

svn cp ^/trunk ^/tags/release-1.0 -m "Release 1.0 tag"
Branching is the same, but then you copy to the branches directory then switch to the new copy.

svn cp ^/trunk ^/branches/foo-feature -m "A branch to work on the new foo feature"
svn switch ^/branches/foo-feature
To merge a branch back into trunk switch back to trunk and use the merge command.

svn switch ^/trunk
svn merge ^/branches/foo-feature .

# Check for conflicts or any problems.  Once everything is good
svn commit -m "Merge foo feature"
svn ls ^/
Should show only your branches, tags, and trunk directories.

 

Then to make a tag something you copy it to the tags directory under a new name, for example:

svn cp ^/trunk ^/tags/release-1.0 -m "Release 1.0 tag"
Branching is the same, but then you copy to the branches directory then switch to the new copy.

svn cp ^/trunk ^/branches/foo-feature -m "A branch to work on the new foo feature"
svn switch ^/branches/foo-feature
To merge a branch back into trunk switch back to trunk and use the merge command.

svn switch ^/trunk
svn merge ^/branches/foo-feature .

# Check for conflicts or any problems.  Once everything is good
svn commit -m "Merge foo feature"

 

Oh man, you're making me very excited to start trying this stuff out. I was going to try and learn how the branching works but now I see it's very simple! I also intend on using the tags for deployment, a previous client has a script for pushing tag versions into production using symlinks so I'm going to attempt to get that working. You really helped me a lot and I appreciate it immensely, thank you.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.