Version Control with Subversion: Tortoise SVN – III

Hello All, I am here again with some more SVN commands which you may like or which may help you, while using SVN for any app :).

This is the continuous part of Version Control with Subversion and the previous two are listed below.

1 – Version Control with Subversion: Tortoise SVN
2 – Version Control with Subversion: Tortoise SVN – II

This time, we will check some more SVN useful commands, and let’s jump into the SVN sea, without wasting our time :-D.

svn diff <Old File Path> <New File Path>

This plays a big role in SVN commands and while managing the code. This command helps to display the differences between two revisions or paths, so that developers can check what has been changed by any other developer or by herself/himself with effect to different dates.

Options
1. -r [--revision] ARG -> ARG (some commands also take ARG1:ARG2 range), a revision argument can be NUMBER(revision number), DATE(revision at start of the date), HEAD(latest in repository), BASE(base rev of item’s working copy), COMMITTED(last commit at or before BASE), PREV(revision just before COMMITTED)
2. -c [--change] ARG -> The change made by revision ARG (like -r ARG-1:ARG). If ARG is negative this is like -r ARG:ARG-1
3. --old ARG -> Use ARG as the older target
4. --new ARG -> Use ARG as the newer target
5. --depth ARG -> Limit operation by depth ARG (’empty’, ‘files’, ‘immediates’, or ‘infinity’)
6. --diff-cmd ARG -> Use ARG as diff command
7. --internal-diff -> Override diff-cmd specified in config file
8. -x [--extensions] ARG -> Default: ‘-u’. -u (–unified), -b (–ignore-space-change), -w (–ignore-all-space), –ignore-eol-style(Ignore changes in EOL style), -p (–show-c-function).
9. --no-diff-deleted -> Do not print differences for deleted files
10. --show-copies-as-adds -> Don’t diff copied or moved files with their source
11. --notice-ancestry -> Notice ancestry when calculating differences
12. --summarize -> Show a summary of the results
13. --changelist [--cl] ARG -> Operate only on members of changelist ARG
14. --force -> Force operation to run
15. --xml -> Output in XML
16. --git -> Use git’s extended diff format

svn revert <File Name>

As the name implies, it reverts/undo all the local changes or it also used to resolve any file in conflicted state.

Options
1. --targets ARG -> Pass contents of file ARG as additional args
2. -R [--recursive] -> Descend recursively, same as –depth=infinity
3. --depth ARG -> Limit operation by depth ARG (’empty’, ‘files’, ‘immediates’, or ‘infinity’)
4. -q [--quiet] -> Print nothing, or only summary information
5. --changelist [--cl] ARG -> Operate only on members of changelist ARG

svn resolve <File Path>

This command is helpful to resolve conflicts on the files or directories.

Options
1. --targets ARG -> Pass contents of file ARG as additional args
2. -R [--recursive] -> Descend recursively, same as –depth=infinity
3. --depth ARG -> Limit operation by depth ARG (’empty’, ‘files’, ‘immediates’, or ‘infinity’)
4. -q [--quiet] -> Print nothing, or only summary information
5. --accept ARG -> Specify automatic conflict resolution source (‘base’, ‘working’, ‘mine-conflict’, ‘theirs-conflict’, ‘mine-full’, ‘theirs-full’)

svn cleanup <File Path>

This command is required to cleanup the working copy recursively. Mainly, it is needed when the working copy has been locked, while any issues/conflicts.

Options
1. --diff3-cmd ARG -> Use ARG as merge command

svn merge <Source File Path> <Target File Path>

This command is used to merge the differences between source files to a working copy path. If anyone will not provide target file path, then the changes will be applied to the current working directory.

Options
1. -r [--revision] ARG -> ARG (some commands also take ARG1:ARG2 range), a revision argument can be NUMBER(revision number), DATE(revision at start of the date), HEAD(latest in repository), BASE(base rev of item’s working copy), COMMITTED(last commit at or before BASE), PREV(revision just before COMMITTED)
2. -c [--change] ARG -> The change made by revision ARG (like -r ARG-1:ARG). If ARG is negative this is like -r ARG:ARG-1
3. --depth ARG -> Limit operation by depth ARG (’empty’, ‘files’, ‘immediates’, or ‘infinity’)
4. -q [--quiet] -> Print nothing, or only summary information
5. --force -> Force operation to run
6. --dry-run -> Try operation but make no changes
7. --diff3-cmd ARG -> Use ARG as merge command
8. --record-only -> Merge only mergeinfo differences
9. -x [--extensions] ARG -> When Subversion is invoking an external diff program, ARG is simply passed along to the program. But when Subversion is using its default internal diff implementation, or when Subversion is displaying blame annotations, ARG could be -u (–unified), -b (–ignore-space-change), -w (–ignore-all-space), –ignore-eol-style, -p (–show-c-function).
10. --ignore-ancestry -> Ignore ancestry when calculating merges
11. --accept ARG -> Specify automatic conflict resolution action (‘postpone(p)’, ‘working’, ‘base’, ‘mine-conflict(mc)’, ‘theirs-conflict(tc)’, ‘mine-full(mf)’, ‘theirs-full(tf)’, ‘edit(e)’, ‘launch(l)’)
12. --reintegrate -> Merge a branch back into its parent branch
13. --allow-mixed-revisions -> Allow merge into mixed-revision working copy. Use of this option is not recommended! Please run ‘svn update’ instead.

Ohh!! that’s a lot guys 🙂 … We went through almost all the basic commands, that could be required, on SVN usage. We listed all the options for each command, which could be possible with the main command.

In my next blog, we will go through the process of creating project, managing the project with the commands, we already went through. So, STAY TUNED for my next blog, that will cover some more commands. Hope you will like this blog.

Thanks 🙂 and will be happy to listen from you 🙂 :).

Version Control with Subversion: Tortoise SVN

The word Version Control represents Revision Control or Source Control, which ultimately specify to control the source code, by managing multiple revisions of the same unit of information.

In simple words, we can say, Version Control System is a software that helps software developers to work together and also maintains complete history of their work by keeping all the work as per version.

Then, what is Subversion … 😕 …

Actually, Subversion is a free or open source version control system (VCS). That is, Subversion manages files and directories and it keeps the record of all the changes made to any file/folder. It keeps all the older revisions as history to examine the code in later time or to check how the data has been changed.

Apache Subversion which is often abbreviated as SVN, is a software versioning and revision control system distributed under an open source license.

Understood something … 🙂 nice 😎 … Let’s check the brief advantages of using it :).

Advantages :-
– Allow developers to work simultaneously.
– Centralized the code.
– Maintain complete history of all developers work.
– Do not overwrite each others changes.
– Enables collaboration between developers.
– Backup and restore the code.
– Short term and long term code revert.

There are a lot more advantages, which you will innovate while using SVN :P.

So, let’s check some terminology of SVN in rough manner.

Repository :-
Repository is a central location in which data is stored and managed. It is the heart/central part of any Version Control System. It keeps all the files, folders, history of data. It can be accessed over a network, as it will be stored in a central position. Repository acts as a server and version control tool acts as client. SVN client can connect to repository over network and can get/set the changes from/to repository, so that the latest changes will be visible to other developer/user by updating the changes.

Trunk :-
It is the main body of development. Generally, it is a directory where all the main development happens and that’s why is usually checked out by developers to work on the project.

Tags :-
Tags are markers to highlight notable revisions in the history of the repository. Usually it will be a point in time on the trunk or a branch that you wish to preserve. We mainly create tags to keep a preservation of a major release. This is the most stable point of the software before major revisions on the trunk were applied.

Branches :-
A branch will be a copy of code or side-line of development derived from a certain point to make larger, experimental, major changes to the code while preserving the untouched code in the trunk. If the major changes, experiment work according to plan, then they can be merged back to the trunk. Other developer can take an update of the working copy and can get the latest code.

SVN Commit :-
Commit means committing/saving the changes into repository. All users need to commit the changes he/she made to the code to make it available for other user.

SVN Update :-
Update means getting the latest data from repository. It brings changes from the repository into your working copy, so that you will get the latest changes made by any user. If we provide any revision number, then it brings the code till that revision, what committed. If no revision is given, it brings your working copy up to date with the HEAD revision.

SVN Log :-
It shows committed log messages from the repository. It will list the details of the committed files with comments, with date and time, when it got committed.

SVN Revert :-
Revert means, to go back to the previous step/stage what already have been accomplished. It reverts any local changes made to a file or directory, property changes made to any folder and it also resolves any conflicted state.

SVN Cleanup :-
It recursively clean up the working copy, removing locks from the working copy and resuming unfinished operations. If for some reason, a Subversion command cannot complete successfully, perhaps due to server problems, then working copy will get locked, then clean up command is necessary to unlock the process.

SVN Switch :-
Generally, switch means, relocating to any other place. Here, SVN switch update working copy to a different URL. If developer is currently on one branch, and done with the changes what has been asked for, then after committing the current branch, developer can now switch to the trunk or any other branch.

SVN Merge :-
SVN merge apply the differences between two sources to a working copy path. It is used to merge the specified files into the trunk so that the latest changes would be overwritten into the trunk, but then need to commit the changes on trunk, to be reflected for other users.

SVN Import :-
The svn import is a quick way to copy an unversioned tree of files into a repository, creating intermediate directories as necessary. SVN import doesn’t require a working copy, and the files are immediately committed to the repository.

 

Hmmm… We went through some of the terminology which is essential to know while using SVN.

So, please say, should we now use any of the Version Control or not to manage the code :-|.

If we got the points and advantages of using SVN, then :cool:, we are all set and now Ready … Steady … Go …… with Subversion :D.

Thanks 🙂 and will be happy to listen from you 🙂 :).