This is an old revision of the document!
svn status | grep "^\?" | awk '{print $2}' | xargs svn add
The generic procedure is the following:
svnadmin dump
.svndumpfilter
.
In order to delete revisions by number, say 1
through 500
, the procedure is as follows:
svnadmin dump /path/to/repo -r1:500 > repo.dump
svnadmin create /path/to/newrepo
svnadmin load /path/to/newrepo < repo.dump
Deleting a range of revisions involves dumping the exclusion set around those revisions and then importing both dumps. Suppose we wanted to delete revision 500
from a total of 1000
revisions, then we would:
1
to 499
to a file dump_1
.501
to 1000
by passing the –incremental
option to the svnadmin dump
command to a file dump_2
.dump_1
and then load the second dump file dump_2
.
Note that removing intermediary revisions will fail if new files have been added in the revisions to be deleted and then altered in following revisions because svnadmin
would, in that case, attempt to load changes to files that have not been created in the first place.
In order to delete unwanted files or folders from a subversion repository, the svndumpfilter
command is used that can pattern-match files or folders in a dump file and create a new dump with those files or folders excluded or included.
svnadmin dump /path/to/repo > repo.dump
Excluding can be performed by:
svndumpfilter exclude somefile < repo.dump > newrepo.dump
Including can be done by:
svndumpfilter include somefile < repo.dump > newrepo.dump
Both inclusion and exclusion can be performed by pattern matching, for example, to exclude pdf
files:
svndumpfilter exclude --pattern '*.pdf' < repo.dump > newrepo.dump
svnadmin create /path/to/newrepo
svnadmin load /path/to/newrepo < newrepo.dump
Subversion can be made to checkout a repository on top of an existing directory structure that may contain files in the repository to be checked out. If the checkout is executed without any flags, then Subversion will throw errors such as An obstructing working copy was found
.
To merge the copy being checked out with the local existing files, you would first clean all .svn
folders from the directory structure and then issue:
svn --force co http://svn.server.tld/project
which, from the documentation, will check out the repository on top of existing files and consider the local files to be local changes, marking them as modified. However, we want to overwrite the local files with the files from the repository and we thus need to chuck away any local "modifications". In order to do that, issue:
svn revert -R project
and the local files will be overwritten by the files from the repository.
Suppose that you have some configuration files in a Subversion repository:
/configuration-templates/samba/3/standalone/smb.conf /configuration-templates/samba/3/standalone/smb.conf.local /configuration-templates/samba/3/standalone/smb.conf.share
and that you wish to tell Subversion to download those files to /etc/samba
but without creating the standalone
directory and without creating a .svn
directory (that is, without keeping them under version control).
In such cases, you can use the export feature of Subversion. Change to the destination directory:
cd /etc/samba/
and now export the Subversion directory:
svn export http://svn.grimore.org/configuration-templates/samba/3/standalone --force .
where:
–force
will allow Subversion to overwrite any files in the current directory - this is necessary, otherwise Subversion will say that the current directory already exists - which is obviously the case since we are in /etc/samba/
..
at the end of the command will export the contents of the standalone
directory (ie: without ending up with /etc/samba/standalone
) - thus, it will only pull the configuration files.For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.