DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD Ports and Packages

FreeBSD Ports and Packages Installation and upgrading of ports and packages on FreeBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 23rd September 2008
tanked tanked is offline
Fdisk Soldier
 
Join Date: May 2008
Posts: 56
Default Subversion and system files

Hello, I'm on FreeBSD 7.0 and I've installed Subversion with the intention of placing my system files (/etc and /usr/local/etc) under revision control. Can someone give me a clue on how to do this in Subversion? When I create a repository from /etc all I'm doing is taking a copy of those files; when I check them out and edit them I'm just editing the copy, not the actual file in /etc. Can some explain to me how I'm supposed to be doing this, I've never used any type of revision control software before.

Many thanks.
Reply With Quote
  #2   (View Single Post)  
Old 23rd September 2008
ephemera's Avatar
ephemera ephemera is offline
Knuth's homeboy
 
Join Date: Apr 2008
Posts: 537
Default

scheme:

- we will create our repository in /root/svnrepo_etc.
- /etc will be the working directory.

initial setup:

- create our svn repo. the svn repository is addressed using a URL.
# svnadmin create file:///root/svnrepo_etc

- add the config files to the repo. (you can also add files selectively instead of the whole /etc dir.)
# svn import /etc file:///root/svnrepo_etc -m "etc repo is born"

- make /etc a working copy. (sorry, i can't think of a less convoluted way to do this)
# svn checkout --force file:///root/svnrepo_etc /etc

ready for action:

# svn info

# svn log

# cd /etc

- ok, now lets modify rc.conf
# echo "# test" >> rc.conf

- check for (as yet uncommited) changes made to the files in /etc
# svn status

- check what we have modified in rc.conf. (compare working copy with last commited ver.)
# svn diff rc.conf

- lets now commit rc.conf to the repo. (note: always use good descriptive messages.)
# svn commit -m "just testing svn, no real change was commited" rc.conf

- check all the revisions of a file
# svn log rc.conf

- show differences b/w revision 1 and 2
# svn diff -r1:2 rc.conf

- show rev. 2 of the file
# svn cat -r2 rc.conf | less

- go back to revision 1
# svn update -r1 rc.conf

- discard as yet uncommited changes
# svn revert rc.conf

backup strategy:

- just save a copy of the /root/svnrepo_etc directory.

hopefully this is enough to get you started.

further reading:

http://svnbook.red-bean.com/en/1.5/index.html

Last edited by ephemera; 23rd September 2008 at 05:00 PM.
Reply With Quote
  #3   (View Single Post)  
Old 23rd September 2008
tanked tanked is offline
Fdisk Soldier
 
Join Date: May 2008
Posts: 56
Default

Thankyou very much ephemera, regarding making /etc the working copy, I did find the following in the subversion FAQ but I don't understand it (which is why I posted on this forum):

Quote:
How can I do an in-place 'import' (i.e. add a tree to Subversion such that the original data becomes a working copy directly)?

Suppose, for example, that you wanted to put some of /etc under version control inside your repository:

# svn mkdir file:///root/svn-repository/etc \
-m "Make a directory in the repository to correspond to /etc"
# cd /etc
# svn checkout file:///root/svn-repository/etc .
# svn add apache samba alsa X11
# svn commit -m "Initial version of my config files"

This takes advantage of a not-immediately-obvious feature of svn checkout: you can check out a directory from the repository directly into an existing directory. Here, we first make a new empty directory in the repository, and then check it out into /etc, transforming /etc into a working copy. Once that is done, you can use normal svn add commands to select files and subtrees to add to the repository.

There is an issue filed for enhancing svn import to be able to convert the imported tree to a working copy automatically; see issue 1328.
Does any of this make any sense to you?
Reply With Quote
  #4   (View Single Post)  
Old 23rd September 2008
ephemera's Avatar
ephemera ephemera is offline
Knuth's homeboy
 
Join Date: Apr 2008
Posts: 537
Default

Ah yes, thats a cleaner way to do what I had given in the "initial setup" section.

Typically, what happens is that the user/programmer will get a working copy (or update his working copy) from the repo., make changes to his local copy (working copy) of the files and subsequently commit his changes back to the repo.
the first time the user does a checkout, a .svn dir. is automatically created in his working copy. This dir. is required for svn to work. But in our case we are starting with an empty repo. so there is nothing to checkout and adding files from /etc to the repo doesn't automatically make /etc a working copy (ie. no .svn is created). so the problem was how to make /etc a working copy. (Or atleast thats my understanding of it. )

Last edited by ephemera; 23rd September 2008 at 06:17 PM.
Reply With Quote
  #5   (View Single Post)  
Old 23rd September 2008
ephemera's Avatar
ephemera ephemera is offline
Knuth's homeboy
 
Join Date: Apr 2008
Posts: 537
Default

If you are new to SCM do check out this howto (i think the author explains it very well): http://www.ericsink.com/scm/index.html

Last edited by ephemera; 23rd September 2008 at 06:47 PM.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cleaning Portsnap files in /var/db/portsnap/files bram85 FreeBSD Ports and Packages 2 5th October 2009 09:54 AM
Unable to make install on Subversion port Fuitad FreeBSD Ports and Packages 2 28th July 2008 04:49 PM
Moving files Weaseal Programming 2 14th July 2008 07:30 AM
FreeBSD making the move from CVS to Subversion drhowarddrfine FreeBSD Installation and Upgrading 9 8th June 2008 05:29 PM
Which file system use to share data on Bsd system? aleunix Other BSD and UNIX/UNIX-like 2 1st June 2008 04:14 PM


All times are GMT. The time now is 08:29 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick