Latest Subversion Interview Questions
1) Explain what is SVN?
SVN or Subversion is an open source control system; it is used to trace all the changes made to your source code or files. It is a repository used to manage files, folders, directories and the modification made to these files over a period of time. While SVN repository provides a complete history of changes made to the files and can easily track if someone had made changes in the file.
2) Mention what is the difference between GIT and SVN repository?
The difference between SVN and GIT is
Git does not support “commits” across multiple branches or tags. Subversion allows the creation of folders at any location in the repository layout
Gits are unchangeable while subversion enables committers to treat a tag a branch and to create multiple revisions under a tag root
Git is less preferred for handling large files or frequently changing binary files while SVN is capable of handling multiple projects stored in the same repository
3) List out what all things should be stored in SVN repository?
In SVN repository you can store
Source Code
Build scripts
Test data used by QA
DB schema
Project settings (When whole team is using the same IDE)
Project documentation (Internal and External)
Minutes of meetings, significant e-mails and info from the web
Expensively generated artifacts
And other documents related to the project
4) Mention what is the command to add a file or dir?
To add a file or dir in SVN the command you will use
svn add filename
svn add dirname
5) List out the common subversion commands?
Common subversion commands include
Import
Checkout
Commit
Update
Other than these it also has command like revert, move, copy and merge.
6) Explain what is the difference between commit and update?
Update is used to update the local workspace with the changes made by the team to the repository, while commit is the process to implement changes from local to repository, in simple words, upload a file into repository.
7) Explain how you can apply a patch in SVN?
To apply a patch in SVN, you are required to “Create Patch” by making changes and generating the .diff file. Then this .diff file can be implemented to the new code base using “Apply Patch” .
8) Mention what is the command to create a new directory under version control?
Command to create a new directory under version control includes
svn mkdir directory
svn mkdir http://url/directory
9) Mention how you can import your existing directory into the new repository?
The command you will use to import your existing directory into the new repository you have to write
svn import/home/mysurface/programming file:///home/mysurface/repo/programing_repo-m “initial import”
10) Mention what is the command to see what is inside the repository?
Command svn list file:///home/mysurface/repo/programming_repo is used to see what is inside the repository.
11) Mention what is the command use to view the difference between the local version and repository version?
The command uses to view the difference between the local and repository version is
svn diff filename
svn diff dirname
12) Mention what does the result codes G and R in svn indicates?
The result codes G and R in svn indicates
G code: Changes on the repo were automatically merged into the working copy
R code: This code indicates that item has been replaced in your working copy. This means the file was programmed or scheduled for deletion, and a new file with the same name was scheduled for addition in its place
13) Mention what is the function of Revert in subversion?
“Revert” function will remove your local changes and reload the latest version from the repository.
14) Explain how you can revert to a previous version?
To retrieve a previous version, you have to use “revert” command. But revert command will simply erase local edits, what you actually need is to “merge” command. For example, you have a file [abc.txt] and the current version is 101, and you want version 201. Then you will use the command like
svn merge –r 101:201 abc.txt
svn commit –m “Reverted to revision 201” abc.txt
15) Mention what are the command that can be used to move some subset of code and history of this code from one SVN repo to another?
Following commands can be used
svnadmin dump
svndumpfilter include
svnadmin load
svn remove
16) List out what is the best practices for SVN?
Best practices for SVN is
Update and Test before commit
Work from your own local workspace
Commit small autonomous changes
Validate the files you are committing, you actually changed
Keep in touch with repository
Watch for conflicts
Always group your check-in logically
Use comment
17) Explain what checkout command is and how to use the checkout command in SVN?
Check-Out command in SVN is used to create a local workable copy of your project retrieved from the local repository.
For example, you have a project located in the repository created at URL location http://www.guru99.com/svn/myrepo/myproject. So you have to checkout myproject into your local system assuming myrepo is a public repository. You will use code
svn co http://www.guru99.com/svn/myrepo/myproject .
This command will copy all your files to your current directory. If you want checkout the directory which is in a private repository, you will then use the following command
svn co http://www.guru99.com/svn/privaterepo/myproject –username admin –password admin