You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Jim Lynch <ji...@gmail.com> on 2006/10/26 19:41:25 UTC

How can I add a number of files scattered over the directory tree?

I've a number of realted files I'd like to use svn to maintain but they are
located in widely scattered places, like /etc/ /usr/local/lib/cgi-bin,
/usr/local/etc, etc.  I know I could keep copies of them in a single file
but I'd like to be able to checkout them to their proper place, or is that a
bad idea?

I could also put thim in a single directory or small tree and use make and
install to move them.

What's the best way to handle this problem?

Thanks,
Jim.

Re: How can I add a number of files scattered over the directory tree?

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Oct 26, 2006, at 14:41, Jim Lynch wrote:

> I've a number of realted files I'd like to use svn to maintain but  
> they are located in widely scattered places, like /etc/ /usr/local/ 
> lib/cgi-bin, /usr/local/etc, etc.  I know I could keep copies of  
> them in a single file but I'd like to be able to checkout them to  
> their proper place, or is that a bad idea?
>
> I could also put thim in a single directory or small tree and use  
> make and install to move them.
>
> What's the best way to handle this problem?

The smallest unit you can check out is a directory; you cannot check  
out files. You can export files, but then you cannot edit them and be  
able to commit the changes.

You may want to just keep all these items in a single directory, or a  
few directories, in the repository, check this out to some new place,  
and then create symlinks from /etc, /usr/local/lib/cgi-bin and the  
other places to the files that you're versioning.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: How can I add a number of files scattered over the directory tree?

Posted by Alan Barrett <ap...@cequrux.com>.
On Fri, 27 Oct 2006, Les Mikesell wrote:
> > > Has anyone come up with a scheme to treat /etc from a set of
> > > similar machines as branches?
> >
> > I just use ${REPO}/hosts/${hostname}/${dirname} for that.  (Not
> > using the conventional {trunk,tags,branches} layout.)
>
> But does subversion know the ancestry so you can see if some change
> was made on host1 before it was duplicated to host2 or afterwords?

I haven't done that (log message comments have been enough so far), but
I suppose you could use svnmerge.py to merge between the host branches
(but try to make one the "master" so you don't have too many merges in
too many directions), or use mucc to copy stuff between host branches.

> Can you tell it to make a file or directory on host3 identical to the
> corresponding one on host2?

file=etc/fstab
source=${REPO}/hosts/host2 rev=123
target=${REPO}/hosts/host3
mucc \
    rm ${target}/${file} \
    cp ${rev} ${source}/${file} ${target}/${file}

--apb (Alan Barrett)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: How can I add a number of files scattered over the directory tree?

Posted by Les Mikesell <le...@gmail.com>.
On Fri, 2006-10-27 at 20:16 +0200, Alan Barrett wrote:
> On Fri, 27 Oct 2006, Les Mikesell wrote:
> > Has anyone come up with a scheme to treat /etc from a set of similar
> > machines as branches?
> 
> I just use ${REPO}/hosts/${hostname}/${dirname} for that.  (Not using the
> conventional {trunk,tags,branches} layout.)

But does subversion know the ancestry so you can see if some
change was made on host1 before it was duplicated to host2
or afterwords?  Can you tell it to make a file or directory
on host3 identical to the corresponding one on host2?  I
want to be able to track the changes across machines that
start out as clones and have a simple way of propagating
changes made anywhere to some or all the others.

-- 
  Les Mikesell
   lesmikesell@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: How can I add a number of files scattered over the directory tree?

Posted by Alan Barrett <ap...@cequrux.com>.
On Fri, 27 Oct 2006, Les Mikesell wrote:
> Has anyone come up with a scheme to treat /etc from a set of similar
> machines as branches?

I just use ${REPO}/hosts/${hostname}/${dirname} for that.  (Not using the
conventional {trunk,tags,branches} layout.)

--apb (Alan Barrett)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: How can I add a number of files scattered over the directory tree?

Posted by Les Mikesell <le...@gmail.com>.
On Fri, 2006-10-27 at 09:38 -0400, Thomas Harold wrote:

> Putting /etc under version control is what finally got me comfortable 
> enough with SVN to start our migration away from SOS/VSS.  Originally, I 
> just created a local repository on the same machine to hold the 
> information, but now we have a central SVN server running in a Xen DomU.

Has anyone come up with a scheme to treat /etc from a set of similar
machines as branches?  I've always thought it would be nice to be
able to see a history of diffs among a set of machine configurations
and perhaps pull changes from one to another but could never figure
out how to get it started. Another nice touch would be to push
the package database used by rpm/apt-get, etc. into a subversion
repository so you could easily duplicate program installations
across machines with exactly matching versions.

> I'm currently working on getting our remote web servers (at a data 
> center) to transmit their web/ftp log files to the central SVN server 
> over ssh.  Since SVN is so efficient over the wire, I'm thinking that 
> I'm going to schedule a job every few hours (maybe as often as every 
> hour) that will do the add/commit.  Basically using SVN as a fancy 
> rsync, but with full history and the source machine can't cover its tracks.

If you are just using it for backups and history, you might look
at backuppc.  It can use rsync as the tranport, compresses the
files, and uses hardlinks to compress all duplicates into one
copy so you can keep a long history online.

-- 
  Les Mikesell
   lesmikesell@gmail.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: How can I add a number of files scattered over the directory tree?

Posted by Thomas Harold <tg...@tgharold.com>.
Jim Lynch wrote:
> I was wondering how you got around doing an import of everything, I 
> uinderstand now.

Good good :)

Putting /etc under version control is what finally got me comfortable 
enough with SVN to start our migration away from SOS/VSS.  Originally, I 
just created a local repository on the same machine to hold the 
information, but now we have a central SVN server running in a Xen DomU.

One thing that I'm not sure of is how well things will work if we were 
to rebuild the server.  As long as we're backing up the .svn folders and 
include them in the restore, things will probably work just fine.

Other then that, it meets our primary goal of having /etc and other 
configuration files under version control.

I'm currently working on getting our remote web servers (at a data 
center) to transmit their web/ftp log files to the central SVN server 
over ssh.  Since SVN is so efficient over the wire, I'm thinking that 
I'm going to schedule a job every few hours (maybe as often as every 
hour) that will do the add/commit.  Basically using SVN as a fancy 
rsync, but with full history and the source machine can't cover its tracks.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: How can I add a number of files scattered over the directory tree?

Posted by Jim Lynch <ji...@gmail.com>.
On 10/26/06, Thomas Harold <tg...@tgharold.com> wrote:
>
>
> I'm assuming that you're trying to version /etc and other hand-edited
> (or user-changed) files.  We do it on our servers as well, just not sure
> if our way is the best way.

Exactly.


First, we have a central SVN server that uses SSH for authentication
> with public keys.  We create a "sys-machinename" account there, create a
> new repository (/var/svn/sys-machinename), create a group called
> svn-sys-machinename and give it rights to the folder.  That's the
> administrative end for us.  Having individual repositories for each
> system keeps things easy for us, although there are arguments to be made
> for using a single repository for multiple systems.


 OK I understand, thank.

I was wondering how you got around doing an import of everything, I
uinderstand now.


Jim.

Re: How can I add a number of files scattered over the directory tree?

Posted by Thomas Harold <tg...@tgharold.com>.
Jim Lynch wrote:
> I've a number of realted files I'd like to use svn to maintain but they 
> are located in widely scattered places, like /etc/ 
> /usr/local/lib/cgi-bin, /usr/local/etc, etc.  I know I could keep copies 
> of them in a single file but I'd like to be able to checkout them to 
> their proper place, or is that a bad idea? 
> 
> I could also put thim in a single directory or small tree and use make 
> and install to move them. 

I'm assuming that you're trying to version /etc and other hand-edited 
(or user-changed) files.  We do it on our servers as well, just not sure 
if our way is the best way.

First, we have a central SVN server that uses SSH for authentication 
with public keys.  We create a "sys-machinename" account there, create a 
new repository (/var/svn/sys-machinename), create a group called 
svn-sys-machinename and give it rights to the folder.  That's the 
administrative end for us.  Having individual repositories for each 
system keeps things easy for us, although there are arguments to be made 
for using a single repository for multiple systems.

Next, I go the machine that is going to be versioned, go to the root 
folder and do a "svn co" against the empty repository.

# cd /
# svn co svn+ssh://sys-machname@svn.example.com/var/svn/sys-machname /

Because this repository (or URL) is empty, it does no damage to the 
machine.  (But we also have 2 backup systems in place.  An rsync 
snapshot that runs daily as a lazy admin versioning system and a more 
official backup system that is designed for bare-metal backup and restore.)

Then I start adding folders.

# svn add -N usr
# svn add -N usr/local
# svn add -N usr/local/sbin
# svn add -N usr/local/sbin/*
# svn ci -m "added local scripts in usr/local/sbin"
# svn add -N usr/src
# svn add -N usr/src/linux
# svn add -N usr/src/linux/.config
# svn ci -m "current kernel configuration"
# svn add etc
# svn ci -m "base /etc snapshot"
# mount /boot
# svn add boot
# svn ci -m "contents of boot partition"
(rinse repeat as needed)

It's basically an in-place import into a new repository.  The existing 
folders become working copies.  I never plan on checking these files out 
to another system (other then to my laptop for reference).  Then, 
whenever I make a change to a configuration file, I go and do the 
adds/deletes and commit the changes to the repository with a comment.

My rule of thumb is that anything that will be hand-created or isn't 
part of a base distro configuration needs to be versioned.  We don't 
bother the add the whole /usr/src/linux tree (for example) because we 
can always download the sources again.  It's the .config file that we 
need to keep track of.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org