This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
fuss:subversion [2017/03/20 12:10] – [Ignore Files] office | fuss:subversion [2018/12/11 21:34] – [Ignore Files] office | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Add Missing Files Recursively ====== | ||
+ | |||
+ | <code bash> | ||
+ | svn status | grep " | ||
+ | </ | ||
+ | |||
+ | ====== Delete or Filter Revisions ====== | ||
+ | |||
+ | The generic procedure is the following: | ||
+ | * dump the svn repository with '' | ||
+ | * filter the dump file with '' | ||
+ | * create a new repository. | ||
+ | * load the modified dump file. | ||
+ | |||
+ | ===== Delete Revisions ===== | ||
+ | |||
+ | In order to delete revisions by number, say '' | ||
+ | |||
+ | * dump the svn repository and select the revisions that you want to keep: | ||
+ | |||
+ | <code bash> | ||
+ | svnadmin dump / | ||
+ | </ | ||
+ | |||
+ | * create a new repository: | ||
+ | |||
+ | <code bash> | ||
+ | svnadmin create / | ||
+ | </ | ||
+ | |||
+ | * import the dump: | ||
+ | |||
+ | <code bash> | ||
+ | svnadmin load / | ||
+ | </ | ||
+ | |||
+ | ===== Delete a Range of Revisions ===== | ||
+ | |||
+ | Deleting a range of revisions involves dumping the exclusion set around those revisions and then importing both dumps. Suppose we wanted to delete revision '' | ||
+ | |||
+ | * dump revision '' | ||
+ | * dump revision '' | ||
+ | * create a new repository. | ||
+ | * first load the first dump file '' | ||
+ | |||
+ | 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 '' | ||
+ | |||
+ | ===== Filter Dump Files ===== | ||
+ | |||
+ | In order to delete unwanted files or folders from a subversion repository, the '' | ||
+ | |||
+ | * dump the repository: | ||
+ | |||
+ | <code bash> | ||
+ | svnadmin dump / | ||
+ | </ | ||
+ | |||
+ | * now we can exclude or include files that will be either removed, respectively kept in the new dump file. | ||
+ | |||
+ | Excluding can be performed by: | ||
+ | |||
+ | <code bash> | ||
+ | svndumpfilter exclude somefile < repo.dump > newrepo.dump | ||
+ | </ | ||
+ | |||
+ | Including can be done by: | ||
+ | |||
+ | <code bash> | ||
+ | svndumpfilter include somefile < repo.dump > newrepo.dump | ||
+ | </ | ||
+ | |||
+ | Both inclusion and exclusion can be performed by pattern matching, for example, to exclude '' | ||
+ | |||
+ | <code bash> | ||
+ | svndumpfilter exclude --pattern ' | ||
+ | </ | ||
+ | |||
+ | * now create the new repository: | ||
+ | |||
+ | <code bash> | ||
+ | svnadmin create / | ||
+ | </ | ||
+ | |||
+ | * and load the filtered dump: | ||
+ | |||
+ | <code bash> | ||
+ | svnadmin load / | ||
+ | </ | ||
+ | |||
+ | ====== Checkout Repository and Overwrite Files ====== | ||
+ | |||
+ | 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 '' | ||
+ | |||
+ | To merge the copy being checked out with the local existing files, you would first clean all '' | ||
+ | <code bash> | ||
+ | svn --force co http:// | ||
+ | </ | ||
+ | |||
+ | which, from the documentation, | ||
+ | <code bash> | ||
+ | svn revert -R project | ||
+ | </ | ||
+ | |||
+ | and the local files will be overwritten by the files from the repository. | ||
+ | |||
+ | |||
+ | ====== Exporting Contents of Subversion Directory to Current Directory ====== | ||
+ | |||
+ | Suppose that you have some configuration files in a Subversion repository: | ||
+ | < | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | and that you wish to tell Subversion to download those files to ''/ | ||
+ | |||
+ | In such cases, you can use the export feature of Subversion. Change to the destination directory: | ||
+ | <code bash> | ||
+ | cd /etc/samba/ | ||
+ | </ | ||
+ | |||
+ | and now export the Subversion directory: | ||
+ | <code bash> | ||
+ | svn export http:// | ||
+ | </ | ||
+ | |||
+ | where: | ||
+ | * '' | ||
+ | * the dot '' | ||
+ | |||
+ | ====== Remove all Local Changes and Additional Files ====== | ||
+ | |||
+ | To remove all local changes recursively: | ||
+ | <code bash> | ||
+ | svn revert -R . | ||
+ | svn status --no-ignore | grep -E ' | ||
+ | svn update --force | ||
+ | </ | ||
+ | |||
+ | In case you do not wish to remove files that are not in the subversion repository, then do not issue the '' | ||
+ | |||
+ | ====== Ignore Files ====== | ||
+ | |||
+ | The following command will globally ignore files matching the patterns '' | ||
+ | |||
+ | <code bash> | ||
+ | svn propset svn: | ||
+ | *.pem | ||
+ | *.key | ||
+ | *.crt" . | ||
+ | </ | ||
+ | |||
+ | Alternatively, | ||
+ | <code bash> | ||
+ | svn propset svn:ignore " | ||
+ | *.pem | ||
+ | *.key | ||
+ | *.crt" . | ||
+ | </ | ||
+ | within a directory will make SVN ignore the files in that directory. | ||
+ | |||
+ | ====== Running Svnserve on Debian ====== | ||
+ | |||
+ | The '' | ||
+ | |||
+ | First create a user and group that '' | ||
+ | <code bash> | ||
+ | useradd svnserve | ||
+ | </ | ||
+ | |||
+ | Then the service file is created at ''/ | ||
+ | < | ||
+ | [Unit] | ||
+ | Description=Subversion protocol daemon | ||
+ | After=syslog.target network.target | ||
+ | |||
+ | [Service] | ||
+ | Type=forking | ||
+ | RuntimeDirectory=svnserve | ||
+ | PIDFile=/ | ||
+ | EnvironmentFile=/ | ||
+ | ExecStart=/ | ||
+ | User=svnserve | ||
+ | Group=svnserve | ||
+ | KillMode=control-group | ||
+ | Restart=on-failure | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=multi-user.target | ||
+ | Alias=svnserve.service | ||
+ | </ | ||
+ | |||
+ | where: | ||
+ | * '' | ||
+ | |||
+ | Next, the defaults file for Debian is created at ''/ | ||
+ | < | ||
+ | # svnserve options | ||
+ | DAEMON_ARGS=" | ||
+ | </ | ||
+ | |||
+ | where: | ||
+ | * ''/ | ||
+ | |||
+ | The ''/ | ||
+ | <code bash> | ||
+ | mkdir / | ||
+ | </ | ||
+ | |||
+ | and granted permission to the user and group specified in the system file: | ||
+ | <code bash> | ||
+ | chown -R svnserve: | ||
+ | </ | ||
+ | |||
+ | A matching logrotate file should be created at ''/ | ||
+ | < | ||
+ | / | ||
+ | daily | ||
+ | missingok | ||
+ | rotate 14 | ||
+ | compress | ||
+ | notifempty | ||
+ | create 640 svnserve svnserve | ||
+ | sharedscripts | ||
+ | postrotate | ||
+ | if / | ||
+ | / | ||
+ | fi; | ||
+ | endscript | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Now, systemctl is instructed to reload the daemon file with: | ||
+ | <code bash> | ||
+ | systemctl daemon-reload | ||
+ | </ | ||
+ | |||
+ | and finally '' | ||
+ | <code bash> | ||
+ | systemctl start svnserve | ||
+ | </ | ||
+ | |||
+ | ====== Fixing Bad Gateway Responses ====== | ||
+ | |||
+ | When attempting an SVN '' | ||
+ | < | ||
+ | svn: E175002: Commit failed (details follow): | ||
+ | svn: E175002: Unexpected HTTP status 502 'Bad Gateway' | ||
+ | </ | ||
+ | |||
+ | to address the issue, add to the Apache configuration file: | ||
+ | < | ||
+ | RequestHeader edit Destination ^https http early | ||
+ | </ | ||
+ | |||
+ | and restart Apache. | ||
+ | |||
+ | |||